You must be logged in to post your query.
Home › Forums › Chart Support › Pie chart empty if value 0
If the pie chart is having all the values as 0 then it shows nothing (empty white space)
JSFiddle Live Example: https://jsfiddle.net/zc84thqg/
Below JSFiddle example show how 0 value is shown in HighCharts https://jsfiddle.net/2gv5t4x8/
@kpandey017,
It is not possible to show pie slices when all the dataPoints has 0 value as of now. However, you can achieve similar functionality by changing chart type to doughnut, pushing one extra dataPoint with non-zero y-value and setting innerRadius to 99% as shown in the code snippet below
function checkForZeroDps(chart) { var isDpsZero = false; for(var i = 0; i < chart.options.data[0].dataPoints.length; i++) { if(chart.options.data[0].dataPoints[i].y === 0) { isDpsZero = true; } } if(isDpsZero) { chart.options.data[0].type = "doughnut"; chart.options.data[0].innerRadius = "99%"; chart.options.data[0].dataPoints.push({ y: 0.000001, indexLabel: " ", indexLabelLineThickness: 0, toolTipContent: null }); } }
Please take a look at this JSFiddle for complete code.
—- Manoj Mohan Team CanvasJS
You must be logged in to reply to this topic. Login/Register