Show Pie Slice chart Name on hover - Javascript highcharts

Javascript examples for highcharts:Pie Chart

Description

Show Pie Slice chart Name on hover

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 () {/*from   w w w. j a v a  2s . com*/
    $('#container').highcharts({
        chart: {
            plotBackgroundColor: null,
            plotBorderWidth: 0,
            plotShadow: false
        },
        title: {
            text: '<span style="color: red;">&uarr;&uarr;&uarr;<br>Risk<br> ofInjury</span> ',
            align: 'center',
            verticalAlign: 'middle',
            useHTML:true,
            y: -20,
        },
        plotOptions: {
            pie: {
                dataLabels: {
                    enabled: true,
                    distance: -50,
                    style: {
                        fontWeight: 'bold',
                        color: 'white',
                        textShadow: '0px 1px 2px black'
                    }
                },
            }
        },
        tooltip: {
                useHTML: true,
               //followPointer: false,
             //   formatter: function() {
             //       return point.key + '<br><ul><li>List Item Test</li></ul>';
              //  }
            formatter: function() {
    return '<b>'+ this.point.name +'</b>:<br><ul><li>List Item Test</li></ul>' ;
}
        },
        series: [{
            type: 'pie',
            name: 'Factors',
            innerSize: '40%',
            data: [
                ['Data 1', 16],
                ['Data 2',16],
                ['Data 3',16],
                ['Data 4', 16],
                ['Data 5', 16],
                ['Data 6',16],
            ]
        }]
    });
});

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.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