Home › forums › Chart Support › Pie Chart Issue
Tagged: pie chart
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/
dataPoints should be an array, but we observe that you are passing string instead of array. Please check this updated jsfiddle.
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.
Waiting for your reply.
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.
Thanks Suyash. Your solution is working very well.
You must be logged in to reply to this topic.