Summary of graphic redrawing methods implemented by echarts

Ren Lei ABC 2022-02-13 06:47:33 阅读数:47

summary graphic redrawing methods implemented

1. Business needs :
vue Project use Echarts Draw data Kanban , When data changes , Need to redraw the graphics .

2. Solution :
At present, the methods circulating on the Internet :myChart.setOption(option,true) It's not valid to test yourself , So I looked for the information again and found the solution (Echarts When drawing, it will be created in the container Echarts Instance and create ’echarts_instance’ attribute , This property is an instance ID, When Echarts This attribute will be matched first when drawing , If not, it will be re instantiated ):

// myChart: Graphic drawing container

var chart = echarts.init(document.getElementById(dom));

3、 Another is to use clear() Method ;

 let chart = echarts.init(document.getElementById(dom));



copyright:author[Ren Lei ABC],Please bring the original link to reprint, thank you.