[Chartjs]-Uncaught type error: mychart.update is not a function

2👍

Your issue is that you’re trying to call the .update() method on your graph’s config object, not your actual graph instance. As you can see, myRadarChart is just an object, it doesn’t have a method called update() on it. However, the graph you create when doing new Chart(ctx, myRadarChart); does give you the .update() method.

To fix your issue, you’ll need to first store the instance of your graph somewhere:

var radarGraph = new Chart(ctx, myRadarChart);

Then update the graph’s data (rather than your config object directly):

radarGraph.data.datasets[0].hidden = false;
...

Then call the update method on your radarGraph object:

radarGraph.update();

Leave a comment