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();
}
Or better, create/show the chart only when you click generate.
Source:stackexchange.com