data labels are infront of each slice in pie chart - Javascript highcharts

Javascript examples for highcharts:Pie Chart

Description

data labels are infront of each slice in pie chart

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://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
      <script type="text/javascript">
$(function() {//from  w  ww  . j  a va2 s  .com
  var asset_allocation_pie_chart = new Highcharts.Chart({
    chart: {
      renderTo: 'container'
    },
    title: {
      text: 'Current Asset Allocation',
      style: {
        fontSize: '17px',
        color: 'red',
        fontWeight: 'bold',
        fontFamily: 'Verdana'
      }
    },
    subtitle: {
      text: '(As of ' + 'dfdf' + ')',
      style: {
        fontSize: '15px',
        color: 'red',
        fontFamily: 'Verdana',
        marginBottom: '10px'
      },
      y: 40
    },
    tooltip: {
      pointFormat: '{series.name}: <b>{point.percentage}%</b>',
      percentageDecimals: 0
    },
    plotOptions: {
      pie: {
        size: '60%',
        cursor: 'pointer',
        series: {
          dataLabels: {
            enabled: true,
            format: '{point.name}: {point.y:.1f}%'
          }
        }
      }
    },
    series: [{
      type: 'pie',
      name: 'Asset Allocation',
      data: [
        ['Investment Grade Bonds', 100],
        ['High Yield Bonds', 200],
        ['Hedged Equity', 300],
        ['Global Equity', 400],
        ['Cash', 500],
        ['Cash', 500],
        ['Hedged Equity', 300],
        ['Global Equity', 400],
        ['Cash', 500],
        ['High Yield Bonds', 200],
        ['Hedged Equity', 300],
        ['Global Equity', 400],
        ['Cash', 500],
        ['High Yield Bonds', 200],
        ['Hedged Equity', 300],
        ['Global Equity', 400],
      ]
    }],
    exporting: {
      enabled: false
    },
    credits: {
      enabled: false
    }
  });
});

      </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; margin: 0 auto"></div>  
   </body>
</html>

Related Tutorials