Highcharts Demo
author(s):
Torstein Hønsi
by AbhishekRohan
HTML
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>
JavaScript
// Build the chart
Highcharts.chart('container', {
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie',
events: {
render: function() {
var chart = this,
textX = chart.plotLeft + chart.series[0].center[0],
textY = chart.plotTop + chart.series[0].center[1];
if (chart.customImage) {
chart.customImage.attr({
x: textX - 52.5,
y: textY - 52.5,
});
} else {
chart.customImage = chart.renderer.image(
'https://i.imgur.com/ffPnYu1.png',
textX - 52.5,
textY - 52.5,
105, //slightly bigger than 100
105
).attr({
zIndex: 10
}).add();
}
}
}
},
title: {
text: 'Browser market shares in January, 2018'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
innerSize: 100,
allowPointSelect: false,
cursor: 'pointer',
dataLabels: {
enabled: true
},
showInLegend: false
}
},
series: [{
name: 'Brands',
colorByPoint: true,
data: [{
name: 'Internet Explorer',
y: 11.84
}, {
name: 'Firefox',
y: 10.85
}, {
name: 'Edge',
y: 4.67
}, {
name: 'Safari',
y: 4.18
}, {
name: 'Other',
y: 7.05
}]
}]
});