Highcharts Demo
author(s): Torstein Hønsi
by Geo George
HTML
<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>
JavaScript
Highcharts.chart('container', {
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie',
events:{
load: function(){
/***/
var chart = e.context,
total = chart.series[0].points[0].total,
legend = chart.legend;
chart.update({
legend: {
title: {
text: ' <span style="font-size: 14px; color: black; font-weight: bold">Issues </span><br/><span style="font-size: 12px; color: black; font-weight: normal">(Total: ' + total + ')</span>'
}
}
});
for (var i = 0, len = legend.allItems.length; i < len; i++) {
var t=legend.allItems[i];;
// content= '<b>'+ t.name +'</b>: '+ Math.round(t.percentage*100)/100 + ' %';
//jQuery($(t.legendItem.element)).tooltip({title:content,html:true});
}
/***/
}
}
},
title: {
text: 'Browser market shares in January, 2018'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name}</b>: {point.percentage:.1f} %',
style: {
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
}
}
}
},
series: [{
name: 'Brands',
colorByPoint: true,
data: [{
name: 'Chrome',
y: 61.41,
sliced: true,
selected: true
}, {
name: 'Internet Explorer',
y: 11.84
}, {
name: 'Firefox',
...