7👍
Check out this answer – using nextTick()
worked for me in a similar situation. In a nutshell:
new Vue({
...
data: {
myCondition: false
},
watch: {
myCondition: function () {
if (this.myCondition) {
this.$nextTick(function() {
// show chart
});
} else {
// hide chart
}
}
},
...
})
- [Chartjs]-How do I prevent the scale labels from being cut off in chartjs?
- [Chartjs]-Chart.js line chart is cut off at the top?
4👍
There is no event
that you describe.
However, you could use a computed
property like this:
new Vue({
...
data: {
myCondition: false
},
computed: {
showChart: function () {
if (this.myCondition) {
// show chart
} else {
// hide chart
}
return this.myCondition
}
},
...
})
<div v-show="showChart"></div>
0👍
custom-directive
may archive this goals this goal
for example:
https://stackoverflow.com/a/49737720/4896468
- [Chartjs]-Chartjs change grid line color
- [Chartjs]-Is it possible in chartjs to hide certain dataset legends?
Source:stackexchange.com