We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currently, if my data is a ref, Vue throws an error when I try to push new data into the dataset.
<template> <Line :data="data" :options="options" /> </template> <script lang="ts" setup> import { ref } from 'vue'; import { Chart as ChartJS, CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip, Legend, TimeScale, } from 'chart.js'; import { Line } from 'vue-chartjs'; ChartJS.register( CategoryScale, LinearScale, TimeScale, PointElement, LineElement, Title, Tooltip, Legend ); const dataA = [{ x: 0, y: 0, }, ...]; const dataB = [{ x: 0, y: 0, }, ...]; const dataC = [{ x: 0, y: 0, }, ...]; const data = ref({ datasets: [ { backgroundColor: 'red', borderColor: 'red', showLine: true, fill: false, pointRadius: 2, label: 'A', data: [], lineTension: 0, interpolate: true, }, { backgroundColor: 'green', borderColor: 'green', showLine: true, fill: false, pointRadius: 2, label: 'B', data: [], lineTension: 0, interpolate: true, }, { backgroundColor: 'blue', borderColor: 'blue', showLine: true, fill: false, pointRadius: 2, label: 'C', data: [], lineTension: 0, interpolate: true, }, ], labels: [], }); const options = { scales: { x: { type: 'linear', }, y: { type: 'linear', }, }, }; let index = 0; setInterval(() => { data.value.datasets[0].data.push(dataA[index]); data.value.datasets[1].data.push(dataB[index]); data.value.datasets[2].data.push(dataC[index]); index++; }, 1000); </script>
https://stackblitz.com/edit/github-wctthjhg?file=src%2FApp.vue
4.4.7
5.3.2
Replace the whole object.
The text was updated successfully, but these errors were encountered:
I also tried:
const data = ref({ ... })
const data = shallowRef({ ... })
triggerRef(data)
Sorry, something went wrong.
Might be related to Vue 3.4 and Vue 3.5 new reactivity system ? Vue 3.4: https://blog.vuejs.org/posts/vue-3-4#more-efficient-reactivity-system Vue 3.5: https://blog.vuejs.org/posts/vue-3-5#reactivity-system-optimizations
No branches or pull requests
Would you like to work on a fix?
Current and expected behavior
Currently, if my data is a ref, Vue throws an error when I try to push new data into the dataset.
Reproduction
https://stackblitz.com/edit/github-wctthjhg?file=src%2FApp.vue
chart.js version
4.4.7
vue-chartjs version
5.3.2
Possible solution
Replace the whole object.
The text was updated successfully, but these errors were encountered: