HighCharts - Pie Chart
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 () {
$('#container').highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie'
},
title: {
text: 'Test all the things'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
borderWidth: 0,
//innerSize: 80,
innerSize: 0,
dataLabels: {
enabled: false
},
showInLegend: true,
slicedOffset: 20,
//depth: 45
point: {
events: {
legendItemClick: function () {
this.slice();
return false;
}
}
},
},
},
legend: {
userHTML: true
},
series: [{
name: ' ',
point: {
events: {
click: function () {
console.log('Category: ' + this.category + ', value: ' + this.y);
}
}
},
data: [{
y: 5,
name: 'test1'
}, {
y: 15,
name: 'test2'
}, {
y: 15,
name: 'test3'
}, {
y: 20,
name: 'test4'
}],
innerSize: '50%',
sliced: true
}],
});
});