0👍
You can use the Vue function mounted to initially load up your chart with any data you have. Then using a method you can reference the chart and make your updates. Example:
this.chart.data.labels.push(this.count);
this.chart.data.datasets.forEach((dataset) => {
dataset.data.push(Math.floor(Math.random() * (75 - 5 + 1)) + 5);
});
this.count = this.count + 1;
this.chart.update();
Example fiddle: https://jsfiddle.net/rogerwes/95ovr71u/39/
Otherwise I would suggest looking into https://vue-chartjs.org/ and the examples they provide should give you a good way to update the chart.
0👍
My solution to updating the chart was to hold the data in a temporary variable and clear my data variable then set it equal to my temporary variable.
- [Vuejs]-Generating static files with relative paths with Nuxt
- [Vuejs]-How to force VueJS not to produce a "*, ::after, ::before" element in css
Source:stackexchange.com