You must be logged in to post your query.
Home › Forums › Chart Support › Push data to chart
Hi, I’m trying to use CanvasJS to create a chart, and want to inject the data into it from a piece of Java code. I want to be able to push the data from a POJO set as an attribute of the HttpRequest, or something similar. What’s the best way to do that?
I’ve seen that I can use
var dps = []; dps.push(x:0, y:other[0]});
but that only adds one point at a time, I want to set the entire series in a single assignment.
You can an assign an entire array as below – like any other JavaScript array.
var dps = [{x:0, y:3}, {x:1, y:5}, {x:2, y:4}]
The required array can be created within a for loop on the client side or on the server side by directly outputting the values into the HTML page.
You must be logged in to reply to this topic. Login/Register