Chartjs-Can't update chart

2👍

Remember that you assigned the newly created chart to the variable barChart. Therefore, try to change your updateConfigByMutating from…

function updateConfigByMutating() {
  chart.options.plugins.title.text = 'new title';
  chart.update();
}

…to

function updateConfigByMutating() {
  barChart.options.plugins.title.text = 'new title';
  barChart.update();
}

Leave a comment