Home forums Using CanvasJS interesting issue using jquery getJSON Reply To: interesting issue using jquery getJSON

#8247

Sunil Urs
Keymaster

Hi,

Looks like you are calling chart.render() even before the data is pushed into dataPoints – ajax requests take time to return before which the onload event handler is called.

Instead you can do something like

function(thedata) {
    $.each(thedata, function(i, v) {
        dataPoints.push({ x: new Date(v.Datetime), y: parseFloat(v.Value) });
    });
    chart.render();
}


Sunil Urs