Javascript examples for highcharts:Pie Chart
Adding narrative to pie chart
<html> <head> <title>Highcharts Demo</title> <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 w w . j av a2 s. c o m*/ $('#companyName').highcharts({ chart: { plotBackgroundColor: null, plotBorderWidth: null, plotShadow: true, type: 'pie' }, title: { text: 'Division' }, subtitle: { text: 'Quarter 1 (0/17/2015 - 10/23/2015)' }, legend: { layout: 'vertical', align: 'right', verticalAlign: 'top', x: -40, y: 40, floating: true, borderWidth: 1, backgroundColor: ((Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'), shadow: true }, tooltip: { pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>' }, plotOptions: { pie: { allowPointSelect: true, cursor: 'pointer', showInLegend: true, dataLabels: { enabled: true, format: '<b>{point.name}</b>: {point.percentage:.1f} %', style: { color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black' }, connectorColor: 'silver' } } }, series: [{ type: 'pie', name: '', data: [ ['Department 1', 334], ['Department 2', 224], ['Department 3', 105], ['Department 4', 19], ['Department 5', 1] ] }] }, function (chart) { // on complete chart.renderer.label('Adding narrative to<br> pie chart (highcharts)', 250, 200, null, 100, 100) .css({ color: '#FFFFFF' }) .attr({ fill: 'rgba(0, 0, 0, 0.75)', padding: 8, r: 5, zIndex: 6 }) .add(); }); }); </script> </head> <body> <script src="https://code.highcharts.com/highcharts.src.js"></script> <div id="companyName" style="height: 300px; width: 400px;"></div> </body> </html>