Procházet zdrojové kódy

fixing dynamically adding/removing chart series

Rodja Trappe před 2 roky
rodič
revize
4a8661680b
1 změnil soubory, kde provedl 4 přidání a 1 odebrání
  1. 4 1
      nicegui/elements/chart.js

+ 4 - 1
nicegui/elements/chart.js

@@ -8,7 +8,10 @@ export default {
   },
   },
   methods: {
   methods: {
     update_chart() {
     update_chart() {
-      this.chart.update(this.options);
+      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, false);
+      this.chart.redraw();
     },
     },
   },
   },
   props: {
   props: {