score:-1
If you don't already, you should try using vue-chartjs . It will handle all the wiring for vue dynamic data.
score:0
I'd suggest putting the chart's init function in the same method, or make a watcher method, like the one responsible for showing/hiding the element.
Like:
<div v-if="visible">
<div ref="chartContainer"></div>
</div>
.....
methodThatChangesVisibility () {
this.visible = true
this.initChartMethod()
}
When saying that you could set up a watcher, it's pretty much the same thing but independent from the visible gets set to true.
watch: {
visible: function (visible) {
if (visible) this.initChartMethod()
}
}
score:0
<div v-if="showChart">
<div id="chartWrapper"></div>
</div>
When boolean showChart
is changed, entire outer div content is re-render or destroy. If destroyed div
is render again, you need to initChart also when the time of showChart
become true
.
score:2
I ran into this issue with vue-chartjs as well. What worked for me is to use v-show instead.
The block I had previously in v-else, I know put in a new v-if block
<div v-show="visualizationData">
<myChart :chartData="visualizationData" :height="350" />
</div>
<div v-if="visualizationData === null">
<div class="loadingIndicator">
Loading...
</div>
</div>
Source: stackoverflow.com
Related Query
- Chartjs (Non Vue) Not Rendering Graph Chart inside V-if/V-show
- show label in tooltip but not in x axis for chartjs line chart
- Chartjs not rendering chart and no error thrown
- ChartJS line chart x = y not rendering astraight line
- Chartjs backgroundColor for line chart does not appear in Vue app
- Vue chartjs is not rendering from API
- Chart not rendering on ChartJS
- Chartjs chart not rendering with pug template
- chartjs line graph destroy function is not clearing the old chart instances
- ReferenceError: Chart is not defined - chartjs
- chartjs datalabels change font and color of text displaying inside pie chart
- chartjs show dot point on hover over line chart
- ChartJS Line Graph - Multiple Lines, Show one Value on Tooltip
- Chart looks only grey, does not show the color - Chartjs,discordjs
- ChartJS won't draw graph inside bootstrap tab until window resize
- Show data dynamically in line chart - ChartJS
- Chartjs - show elements in all datasets on hover using bar chart
- Chartjs Graph is not showing in colorbox
- ChartJS / MomentJS - Unable to remove deprecation warning. Graph not showing in firefox/opera
- Pie chart is not getting rendered in ChartJS
- Chart JS not rendering on iOS devices
- ChartJS (React) Line Chart - How to show single tooltip with data and labels from 3 (multiple) dataset?
- Chart not rendering w/Chart.js on button click
- ChartJS "half donut" chart not displaying properly
- ChartJS - radar chart options not working
- Bubble Chart in Chartjs not working
- Chart.js chart does not display when inside an ngIf.
- Chart.js chart not rendering
- Chartjs - Donut Chart label for small values not visible
- chartjs plugin datalabels does not show value on charts
More Query from same tag
- Chartjs: Overwrite plot y-axis integer labels to some string value
- add editable textbox to specific datapoint in a chart
- Multiple add in multiple sql request?
- Chart.js canvas : can't center it
- How to line break a label object in ChartsJS (nested arrays won't work)
- How to hide zero data value from chartjs?
- Error trying to switch between different charts
- Multiple bubble chart datasets for chartjs
- Chart.js Start Y-Axis at a defined value
- How to render Chart.js 2.x tooltips on top of everything
- Chart.js: How can a line series (out of many) change line color and thickness upon mouse hover?
- Chart JS how to display an array of data objects as bar chart
- Manipulating data point in chart.js external tooltip
- Chartjs : Remove specific labels
- Accessing a slice of a react-chartjs Pie chart
- Passing Global Options to line Chart in 2.1.6/Chart.js
- Chart.js multiple series with same scale
- Show multiple charts at HTML page?
- No tooltips on Chart JS line graph
- How to edit my custom tooltips in my line chart using chart.js?
- Angular: How to change color of chartjs?
- How to get labels on ChartJS Pie chart segments
- Chart.JS - Polar area - Legend hover style and margin
- ChartJS horizontal chart display legend on each bar
- How to draw High-Precision-Numbers in chartjs
- ng2-charts: How to set Title of chart dynamically in typescript
- How do I recursively aggregate values inside of a loop of JavaScript objects?
- How to pass data in Laravel with Chart.js
- Chart.js align line graph to the left
- How can I draw a line to the highest datapoint in chart js?