Pie Chart with Zero values- CanvasJS
Pie Chart with Zero values- CanvasJS
by canvasjs
HTML
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<br/><!-- Just so that JSFiddle's Result label doesn't overlap the Chart -->
<div id="chartContainer" style="height: 360px; width: 100%;"></div>
JavaScript
var chart = new CanvasJS.Chart("chartContainer",
{
title:{
text: "Gaming Consoles Sold in 2012"
},
legend: {
maxWidth: 350,
itemWidth: 120
},
data: [
{
type: "pie",
showInLegend: true,
legendText: "{indexLabel}",
toolTipContent:"{legendText} {y}",
dataPoints: [
{ y: 100, legendText:"Excellent", indexLabel: "Excellent" },
{ y: 0, legendText:"Good", indexLabel: "Good" },
{ y: 0, legendText:"Mid", indexLabel: "Mid" },
{ y: 0, legendText:"Bad", indexLabel: "Bad" }
]
}
]
});
chart.render();