Handle a click event on a polygon Charts without having the tooltip popping up - Javascript highcharts

Javascript examples for highcharts:Chart Tooltip

Description

Handle a click event on a polygon Charts without having the tooltip popping up

Demo Code

ResultView the demo in separate window

<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 () {/*  w ww .j  av a  2  s.  co  m*/
    $('#container').highcharts({
        tooltip: {
            enabled: false
        },
        series: [{
            states: {
                hover: {
                    enabled: false
                }
            },
            type: 'polygon',
            name: 'I am a polygon',
            data: [
                [153, 42],
                [149, 46],
                [166, 45]
            ],
            color: '#ff0000',
            events: {
                click: function (e) {
                    var polygon = e.currentTarget;
                    console.log(polygon.name);
                }
            }
        }]
    });
});

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <script src="https://code.highcharts.com/highcharts-more.js"></script> 
      <script src="https://code.highcharts.com/modules/exporting.js"></script> 
      <div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>  
   </body>
</html>

Related Tutorials