Javascript examples for highcharts:Chart Configuration
setExtremes() to display the correct interval for one day
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript"> $(function() {/*from w w w . j ava 2s .c o m*/ $.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?', function(data) { $('#container').highcharts('StockChart', { rangeSelector: { buttons: [{ type: '', count: 2, text: 'My dates' },{ type: 'hour', count: 1, text: '1h' }, { type: 'day', count: 1, text: '1d' }, { type: 'month', count: 1, text: '1m' }, { type: 'year', count: 1, text: '1y' }, { type: 'all', text: 'All' }], }, title : { text : 'AAPL Stock Price' }, xAxis: { events:{ afterSetExtremes: function(e) { if (e.trigger == "rangeSelectorButton" && e.rangeSelectorButton.text == "My dates"){ setTimeout(function(){Highcharts.charts[0].xAxis[0].setExtremes(1198681756385,1368144000000) }, 1); } }, } }, series : [{ name : 'AAPL', data : data, tooltip: { valueDecimals: 2 } }] }); }); }); </script> </head> <body> <script src="https://code.highcharts.com/stock/highstock.js"></script> <script src="https://code.highcharts.com/stock/modules/exporting.js"></script> <div id="container" style="height: 500px; min-width: 500px"></div> </body> </html>