0👍
✅
You can Update the options of a chart directly with its options
key, not with config.options
also unit
is not array to push, its a key so assign value to it
in your code
function setXAxis()
{
chart.options.scales.xAxes[0].time.unit='week';
chart.update();
};
Source:stackexchange.com