0👍
You need to set a ref in your chart to access it, and then call resetZoom()
on that ref when data changes:
<Line :data="chartData" :options="chartOptions" ref="myLineChart"/>
setup() {
const myLineChart = ref(null);
watch(
() => props.chartData,
() => {
myLineChart.resetZoom();
},
{ deep: true }
);
return { myLineChart };
}
See the Vue docs for more info on template refs.
- [Vuejs]-Uncaught (in promise) TypeError: this.resolveComponent is not a function | Inertia, Django & Vue
- [Vuejs]-How do I get the return observer object value from Vuex getters?
Source:stackexchange.com