JSFiddle - React, Tailwind, and code Playground
by anikettiwari
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>
JavaScript
$(function () {
var x=0, y=0;
$('#container').highcharts({
legend: {
enabled: false
},
chart: {
type: 'pie'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
dataLabels: {
enabled: false
},
showInLegend: true
}
},
series: [{
name: 'Brands',
colorByPoint: true,
data: [{
name: '1',
y: 26
}, {
name: '2',
y: 24,
}, {
name: '3',
y: 10
}, {
name: '4',
y: 4
}, {
name: '5',
y: 2
}, {
name: '6',
y: 12
}]
}]
},function (chart) { // on complete
$.each(chart.series[0].data, function(i,p){
y+=p.y;
x++;
});
chart.renderer.label('all y: '+y+' , all x: '+x, 20, 370, 'callout', 100)
.css({
color: '#000000'
})
.attr({
fill: '#ffffff',
padding: 8,
r: 5,
zIndex: 6
})
.add();
});
});