Javascript examples for highcharts:Line Chart
get the name property of a selected point in a line chart
<html> <head> <title>Highcharts Demo</title> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script> <script src="https://code.highcharts.com/highcharts.js"></script> <div id="container" style="height: 400px"></div> <button id="button" class="autocompare">Get selected points</button> <script type="text/javascript"> var chart = Highcharts.chart('container', { xAxis: {/* ww w. jav a2 s .com*/ categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, plotOptions: { series: { allowPointSelect: true } }, series: [{ data: [{name: 'test1', y: 29.9}, {name: 'test2', y: 71.5}, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] }] }); $('#button').on('click', function() { var chart = $('#container').highcharts(); var selectedPoints = chart.getSelectedPoints(); console.log(selectedPoints[0].name); }); </script> </body> </html>