Created
April 21, 2015 19:50
-
-
Save KMax/d21732de0cf72f40a2d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function () { | |
$('#container').highcharts({ | |
chart: { | |
type: 'area' | |
}, | |
tooltip: { | |
formatter: function () { | |
var msg = ""; | |
$.each(this.points, function() { | |
var index = this.series.xData.indexOf(this.x); | |
var to = this.series.xData[index+1] > 0 ? | |
this.series.xData[index+1] : this.x; | |
var from = this.x == to ? | |
this.series.xData[index-1] : | |
this.series.xData[index]; | |
if (from > to) { | |
var temp=to; | |
to=from; | |
from=temp; | |
} | |
msg += '<b>Window</b> ' + this.point.name; | |
msg += '<br/> time: [' + from + ' : ' + to + ']'; | |
msg += '<br/>'; | |
console.log(this); | |
}); | |
return msg; | |
}, | |
shared: true | |
}, | |
yAxis: { | |
title: { | |
text: 'Windows' | |
}, | |
labels: { | |
enabled: false | |
} | |
}, | |
xAxis: { | |
labels: { | |
format: '{value} ms' | |
} | |
}, | |
plotOptions: { | |
area: { | |
fillOpacity: 0.5, | |
pointStart: 60000 | |
} | |
}, | |
series: [{ | |
name: "odd window", | |
data: [ | |
{x:0, y:1, name: '#1'}, {x:60000 | |
, y:1, name: '#1'}, | |
null, | |
{x:93827, y: 1, name: '#3'}, {x:178771, y: 1, name: '#3'} | |
] | |
}, { | |
name: "even window", | |
data: [ | |
{x:60000, y:1, name: '#2'}, {x:95091 | |
, y:1, name: '#2'}, | |
null | |
] | |
}] | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment