Home forums Using CanvasJS Dynamic data issue Reply To: Dynamic data issue

#14277

Suyash Singh
Moderator

@ashish-potdar,

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

var MyVal = (document.getElementById('txtGrpValue').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 either enclose the values x and y in quotes in the input field and remove the semicolon like this example. Or you could use regular expression as shown in this example.


Suyash
Team CanvasJS