'The content overflows after the echarts line chart refreshes the page

The content overflows after the echarts line chart refreshes the page...

It is normal to load the chart for the first time。but after refreshing the page, the content overflow...

had tried '''this.echarts resize''' before '''setOption(option)''' it doesn't work....



Solution 1:[1]

//htmlPart  yourEchartUsingElement 
<div ref="myEchart"></div>


//JS Part this.optionCompleted is your echartData
var myChartCompleted = this.$echarts.init(this.$refs.myEchart);
myChartCompleted.setOption(this.optionCompleted)
myChartCompleted._dom.childNodes[0].childNodes[0].style.height="29rem"
myChartCompleted._dom.childNodes[0].childNodes[0].style.width="166.4rem"

You can use this method to get the DOM node of the canvas used by echarts and assign values to its properties. Every time the window changes, you execute these lines of code to re-render echarts (Google Translate)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ConstFiv