Home Forums Chart Support Pie Chart Issue

Pie Chart Issue

Viewing 5 posts - 1 through 5 (of 5 total)
  • #14570

    Dear Support,
    I am trying to generate the pie chart. But I am facing the problem while passing the array values.
    Please check the http://jsfiddle.net/f0xetdmh/7/

    Thanking you.

    Regards,
    Ashish Potdar.

    #14571

    @ashish-potdar,

    dataPoints should be an array, but we observe that you are passing string instead of array. Please check this updated jsfiddle.


    Vishwas R
    Team CanvasJS

    #14575

    Thank Vishwas, for your quick reply. But I am passing the values dynamically to js function. Then array is not getting created. Please look into given below example.

    http://jsfiddle.net/f0xetdmh/10/

    Waiting for your reply.

    Thanks.

    #14578

    The dataPoints you pass to the chart must be an array of objects and not a string.

    var ChartVal = document.getElementById("txtMyVal").value; // String

    First you need to parse the string you get from your input field to a valid JSON and then parse the JSON to get the object which you can pass to the chart. For converting the string to valid JSON, you can enclose the values y, label, legendText in quotes in the input field. Please check this jsfiddle.

    —–
    Suyash Singh
    Team CanvasJS

    #14581

    Thanks Suyash. Your solution is working very well.

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

You must be logged in to reply to this topic.