Javascript examples for highcharts:Chart Label
Highcharts datalabel 'callout' shape for donut chart
<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"> Highcharts.chart('container', { chart: {/*from w w w . j a v a2 s .co m*/ events: { render: function() { var chart = this, series = chart.series[0], renderer = chart.renderer; series.points.forEach(function(p) { var dl = p.dataLabel, x = dl.x + chart.plotLeft, y = dl.y + chart.plotTop, chartCenterX = chart.chartWidth / 2, chartCenterY = chart.chartHeight / 2, anchorX, anchorY; // destroy the old label if (dl.customLabel) { dl.customLabel.destroy(); } // definitions for all the directions if (x < chartCenterX && y < chartCenterY) { // right bottom corner chevron anchorX = x + 30; anchorY = y + 50; } // more should be added here // create custom label dl.customLabel = renderer.label(p.name, x, y, 'callout', anchorX, anchorY).attr({ fill: 'blue' }).css({ color: 'white' }).add(); }); } } }, plotOptions: { pie: { dataLabels: { enabled: true, style: { fontWeight: 'bold', color: 'white' }, connectorWidth: 0, distance: 40, format: '' }, startAngle: 0, endAngle: 360, center: ['50%', '50%'] } }, series: [{ type: 'pie', innerSize: '80%', data: [ ['Firefox', 10.38], ['IE', 56.33], ['Chrome', 24.03], ['Opera', 31.44] ] }] }); </script> </body> </html>