|
@@ -9,12 +9,25 @@ export default {
|
|
|
});
|
|
|
}, 0); // NOTE: wait for window.path_prefix to be set in app.mounted()
|
|
|
},
|
|
|
+ beforeDestroy() {
|
|
|
+ this.destroyChart();
|
|
|
+ },
|
|
|
+ beforeUnmount() {
|
|
|
+ this.destroyChart();
|
|
|
+ },
|
|
|
methods: {
|
|
|
update_chart() {
|
|
|
- while (this.chart.series.length > this.options.series.length) this.chart.series[0].remove();
|
|
|
- while (this.chart.series.length < this.options.series.length) this.chart.addSeries({}, false);
|
|
|
- this.chart.update(this.options);
|
|
|
+ if (this.chart) {
|
|
|
+ while (this.chart.series.length > this.options.series.length) this.chart.series[0].remove();
|
|
|
+ while (this.chart.series.length < this.options.series.length) this.chart.addSeries({}, false);
|
|
|
+ this.chart.update(this.options);
|
|
|
+ }
|
|
|
},
|
|
|
+ destroyChart () {
|
|
|
+ if (this.chart) {
|
|
|
+ this.chart.destroy()
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
props: {
|
|
|
type: String,
|