Home Forums Chart Support Chart always rendering, unable to change data. Reply To: Chart always rendering, unable to change data.

#19234

@wtf,

Despite the fact that I am not calling the render function

The chart is getting rendered as change method is called which in turn calls chart.render().

function change() {   
    newTitle = "is going on";
    chart.render(); // chart.render() gets called inside change
}
change(); // Call to the change method

Please take a look at this MDN Page on Javascript Functions.

cannot be changed by changing the data and re-rendering.

The title is not being updated as chart options are not updated within change method instead, you are updating newTitle. You can use set method to update the chart title. Please add the following line after chart.render() method in change();
chart.title.set("text", newTitle);

You can take a look at this Documentation Link on set() for more info.

Also, we noticed that you haven’t set the dataPoints properly. dataPoints should be an array which is number in your case.
dataPoints: 0 // incorrect, should be an []

The chart should work fine after making all these changes.
___
Suyash Singh
Team CanvasJS