Click Event - Javascript highcharts

Javascript examples for highcharts:Chart Event

Description

Click Event

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <style id="compiled-css" type="text/css">

#container {/*w ww  . j ava2s.c  om*/
   min-width: 310px;
   max-width: 800px;
   height: 400px;
   margin: 0 auto
}


      </style> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <div id="container"></div> 
      <script type="text/javascript">
Highcharts.chart('container', {
    series: [{
        data: [1, 2, 3, 4, 5]
    }, {
        data: [1, 2, 3, 4, 5].reverse()
    }, {
        data: [2, 2, 2, 2, 2]
    }, {
        data: [3, 3, 3, 3, 3]
    }, {
        data: [4, 4, 4, 4, 4]
    }],
    plotOptions: {
        series: {
            point: {
                events: {
                    click: function() {
                        console.log(this.series.chart.hoverPoints)
                    }
                }
            }
        }
    },
    tooltip: {
        shared: true
    }
});

      </script>  
   </body>
</html>

Related Tutorials