Falko Schindler 1 год назад
Родитель
Сommit
1bd2909daf
2 измененных файлов с 5 добавлено и 1 удалено
  1. 1 1
      nicegui/elements/echart.js
  2. 4 0
      nicegui/elements/echart.py

+ 1 - 1
nicegui/elements/echart.js

@@ -3,7 +3,7 @@ export default {
   mounted() {
     this.chart = echarts.init(this.$el);
     this.chart.setOption(this.options);
-    new ResizeObserver(() => this.resize_chart()).observe(this.$el);
+    new ResizeObserver(this.resize_chart).observe(this.$el);
   },
   beforeDestroy() {
     this.destroyChart();

+ 4 - 0
nicegui/elements/echart.py

@@ -27,4 +27,8 @@ class EChart(Element, component='echart.js', libraries=['lib/echarts/echarts.min
         self.run_method('update_chart')
 
     def resize(self) -> None:
+        """Resize the chart to fit the container.
+
+        Usually, this does not need to be called manually, as the chart is resized automatically when the window is resized.
+        """
         self.run_method('resize_chart')