labels display values and names for pie chart - Javascript highcharts

Javascript examples for highcharts:Chart Value

Description

labels display values and names for pie chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js"></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> 
      <script type="text/javascript">
Highcharts.chart('container', {
    chart: {/*from w w  w  . jav a  2 s.co  m*/
        plotBackgroundColor: null,
        plotBorderWidth: null,
        plotShadow: false,
        type: 'pie'
    },
    plotOptions: {
          pie: {
              allowPointSelect: true,
              cursor: 'pointer',
              dataLabels: {
                  enabled: true,
                   distance: -30,
                   format: '<b>{point.name}</b>: {point.y:,.2f}',
              },
              showInLegend: true
          }
    },
    series: [{
          name: 'Types',
          colorByPoint: true,
          data: [ {
              name: 'Debtors',
              y: 10.38
          }, {
              name: 'Suppliers',
              y: 4.77
          },
        ]
      }]
});

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

Related Tutorials