Don't show graph if there is no data

This commit is contained in:
D. Berge
2023-11-02 15:25:45 +01:00
parent e605320503
commit 114e41557f
2 changed files with 14 additions and 4 deletions

View File

@@ -258,8 +258,13 @@ export default {
methods: {
plot () {
Plotly.newPlot(this.$refs.graph, this.data, this.layout, this.config);
this.plotted = true;
if (this.items?.length) {
Plotly.newPlot(this.$refs.graph, this.data, this.layout, this.config);
this.plotted = true;
} else {
Plotly.purge(this.$refs.graph);
this.plotted = false;
}
},
replot () {

View File

@@ -141,8 +141,13 @@ export default {
methods: {
plot () {
Plotly.newPlot(this.$refs.graph, this.data, this.layout, this.config);
this.plotted = true;
if (this.items?.length) {
Plotly.newPlot(this.$refs.graph, this.data, this.layout, this.config);
this.plotted = true;
} else {
Plotly.purge(this.$refs.graph);
this.plotted = false;
}
},
replot () {