percentage variability position in pie chart - Javascript highcharts

Javascript examples for highcharts:Pie Chart

Description

percentage variability position in 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"> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.src.js"></script> 
      <div id="container"></div> 
      <script type="text/javascript">
var chart = Highcharts.chart('container', {
  chart: {/*w  w w  .j av  a2  s. c o  m*/
     width: 400,
    height: 300,
    type: 'pie',
    events: {
      load: function() {
        var points = this.series[0].points;
        points.forEach((p) => p.connector.destroy()); // destroy connectors
            // set fixed position for both points
        points[0].dataLabel.attr({
          x: 300,
          y: 100
        });
        points[1].dataLabel.attr({
          x: 75,
          y: 100
        });
      }
    },
  },
  series: [{
    data: [52, 30],
    dataLabels: {
      enabled: true,
      format: '{y}'
    }
  }]
});

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

Related Tutorials