Javascript examples for highcharts:Stock Chart
range Selector button in stock chart
<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 ww .jav a 2 s. com*/ $.getJSON('https://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?', function (data) { // Create the chart $('#container').highcharts('StockChart', { rangeSelector : { selected : 1, inputEnabled: $('#container').width() > 480 }, title : { text : 'AAPL Stock Price' }, series : [{ name : 'AAPL', data : data, tooltip: { valueDecimals: 2 } }] }); setInterval(function() { var chart = $('#container').highcharts(); var selected = chart.rangeSelector.selected; $('#selectedButton').html("Selected button index: " + selected + "<br/>" + "Selected button text: " + chart.rangeSelector.buttonOptions[selected].text + "<br/>" + "Selected button type: " + chart.rangeSelector.buttonOptions[selected].type); }); }); }); </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: 400px; min-width: 310px"></div> <div id="selectedButton"></div> </body> </html>