2👍
chartfour
is the name of the chart configuration you’re using for creating your chart. myChart2.chartfour
however does not exist.
When creating the chart, make sur to to assign it to a global constant…
const myChart2 = new Chart('myChart2', chartfour);
…then, you can directly access its options
and data
as follows:
myChart2.options.scales.x.time.unit = period.value;
myChart2.data.datasets[0].data = months;
...
- [Chartjs]-Angular 5 chart.js onclick returning empty array
- [Chartjs]-Overlapping Bar Chart using Chart.js
Source:stackexchange.com