A customised SVG Pie chart
This goes in the documents header:
<script src="RGraph.svg.common.core.js"></script>
<script src="RGraph.svg.common.tooltips.js"></script>
<script src="RGraph.svg.pie.js"></script>
Put this where you want the chart to show up:
<div style="width: 850px; height: 350px" id="chart-container"></div>
This is the code that generates the chart:
<script>
var data = [20,13.43,2.83,4.24,7.42,13.43,38.65];
var labels = ['Miscellaneous','Cooking','Office equipment','Refridgeration','Cooling','Ventilation','Lighting'];
for (var i=0; i<data.length; ++i) {
labels[i] = labels[i] + ', ' + data[i] + '%';
}
new RGraph.SVG.Pie({
id: 'chart-container',
data: data,
options: {
labels: labels,
tooltips: labels,
colors: ['#EC0033','#A0D300','#FFCD00','#00B869','#999999','#FF7300','#004CB0'],
strokestyle: 'white',
linewidth: 2,
shadow: true,
shadowOffsetx: 2,
shadowOffsety: 2,
shadowBlur: 3,
exploded: 7
}
}).draw();
</script>
« Back