Home › forums › Using CanvasJS › Exploded property on Pie Chart
This topic contains 2 replies, has 2 voices, and was last updated by Jason1028 2 weeks ago.
I am using MSSQL and ASP.NET with MVC for my project. How can I set only once slice of my pie chart with the exploded property (I only want the visa slice explode out when the chart is rendered). I have created a sample project and sample database in this link. https://1drv.ms/u/s!ArY1OZOnknm5nxzpvj-0deDl31ED?e=bshIXI
Setting exploded property to true will explode a slice of pie/doughnut on chart-render.
As you are reading data from database, you can add exploded property by checking the label. Please refer the code-snippet below. Adding the below snippet just before calling chart.render() should work fine in this case.
for(var i = 0; i < chart.options.data.dataPoints.length; i++)
if(chart.options.data.dataPoints[i].label === "Visa")
chart.options.data.dataPoints[i].exploded = true;
It works perfectly. Thank you so much!
You must be logged in to reply to this topic.