Home forums Using CanvasJS Exploded property on Pie Chart

This topic contains 2 replies, has 2 voices, and was last updated by  Jason1028 2 months, 2 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #25713

    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

    #25723

    @jason1028,

    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[0].dataPoints.length; i++)
        if(chart.options.data[0].dataPoints[i].label === "Visa")
            chart.options.data[0].dataPoints[i].exploded = true;

    —-
    Manoj Mohan
    Team CanvasJS

    #25744

    It works perfectly. Thank you so much!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.