score:0

your mistake is the following

to update the options, mutating the options property in place or passing in a new options object are supported.

from chart.js

for the update to work, you need to mutate the original object, which you are not doing.

just fix it by doing this

function generatechart() {
  generatelabels();
  chart.data.labels = generatelabels();
  chart.update();
}

demo

or better, create/show the chart only when you click generate.


Related Query

More Query from same tag