Highcharts Stock Demo
author(s):
Torstein Hønsi
HTML
<div id="container" style="height: 400px; min-width: 600px"></div>
<script src="http://code.highcharts.com/stock/highstock.js"></script>
<script src="http://code.highcharts.com/stock/modules/exporting.js"></script>
JavaScript
$(function () {
(function (H) {
// Wrap getSegments to change gapSize functionality to work based on time (milliseconds)
H.wrap(H.Series.prototype, 'getSegments', function (proceed) {
var cPR = this.xAxis.closestPointRange;
this.xAxis.closestPointRange = 1;
proceed.apply(this, Array.prototype.slice.call(arguments, 1));
this.xAxis.closestPointRange = cPR;
});
}(Highcharts));
$('#container').highcharts('StockChart', {
rangeSelector: {
selected: 1
},
plotOptions: {
line: {
gapSize: 300000 // 5 minutes in milliseconds
}
},
series: [{
name: 'USD to EUR',
data: [
[0,1],
[1000,1],
[5000,1],
[306000,1], // Gap 5:01
[310000,1],
[315000,1],
[320000,1],
[625000,1], // Gap 5:05
[645000,1],
]
}]
});
});