Javascript examples for highcharts:Pie Chart
Create space for negative value in 3D pie chart
<html> <head> <title>Highcharts Demo</title> <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 2 s .c om $('#container').highcharts({ chart: { type: 'pie', options3d: { enabled: true, alpha: 45, beta: 0 } }, title: { text: 'Browser market shares at a specific website, 2014' }, tooltip: { pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>' }, plotOptions: { pie: { allowPointSelect: true, cursor: 'pointer', depth: 35, dataLabels: { enabled: true, formatter: function() { console.log(this); var point = this.point; return this.key + " - value: " + (point.negY ? point.negY : point.y); } } } }, series: [{ type: 'pie', name: 'Browser share', data: [ ['Firefox', -45.089], ['IE', 26.8], ['Chrome', -10], ['Safari', 8.5], ['Opera', 6.298], ['Others', 0.7] ].map(function(pointArr) { var newPoint = { name: pointArr[0] }, value = pointArr[1]; if (value < 0) { newPoint.y = 0; newPoint.negY = value; } else { newPoint.y = value } return newPoint; }) }] }); }); </script> </head> <body> <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/highcharts-3d.js"></script> <script src="https://code.highcharts.com/modules/exporting.js"></script> <div id="container" style="height: 400px"></div> </body> </html>