Skip to content

Commit

Permalink
Merge pull request #1570 from dabenny/patch-1
Browse files Browse the repository at this point in the history
Resize method for ui.echart
  • Loading branch information
falkoschindler authored Sep 18, 2023
2 parents 5662357 + 58cbedd commit 035f059
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions nicegui/elements/echart.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,17 @@ export default {
mounted() {
this.chart = echarts.init(this.$el);
this.chart.setOption(this.options);
this.chart.resize();
new ResizeObserver(this.chart.resize).observe(this.$el);
},
beforeDestroy() {
this.destroyChart();
this.chart.dispose();
},
beforeUnmount() {
this.destroyChart();
this.chart.dispose();
},
methods: {
update_chart() {
if (this.chart) {
this.chart.setOption(this.options);
}
},
destroyChart() {
if (this.chart) {
this.chart.dispose();
}
this.chart.setOption(this.options);
},
},
props: {
Expand Down

0 comments on commit 035f059

Please sign in to comment.