jQuery - Highcharts pie chart
by pythondave
HTML
<script src="http://highcharts.com/js/testing-exporting.js"></script>
<div id="container"></div>
CSS
#container { width: 480px; height: 300px; }
JavaScript
var chart = new Highcharts.Chart({
chart: { renderTo: "container" },
exporting: { enableImages:true },
title: { text: 'House Competition' },
subtitle: { text: 'Pie chart for T3W1' },
credits: { enabled: false },
colors: ['#' + 'FFA500', 'purple', 'red'],
series: [
{
name: "Values",
type: "pie",
sliced: true,
data: [
["Orange", 763],
["Purple", 837],
["Red", 1134]],
pointWidth: 15,
color: "#C6D9E7",
borderColor: "#8BB6D9",
shadow: true}
],
tooltip: {
formatter: function() {
return '<b>' + this.point.name + '</b>: ' + this.point.y + ' house points';
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
formatter: function() {
return '<b>' + this.point.name + '</b>: ' + Math.round(this.percentage) + '%';
}
}
}
}
});