ECharts Error: Uncaught Error: `setOption` should not be called during main process

Ecarts data graphics rendering, the amount of graphics data is relatively large. After rendering, click query graphics to render again. There may be a large amount of data. When re rendering, an uncaught error appears: ` setoption ` should not be called during main process

There must be no problem with this error code, because it is displayed normally when loading by default for the first time, but there is a problem when re rendering.

This error is to limit the timing of setoption call, which means that if the setoption or dispatchaction process is not completed, calling setoption again halfway will be limited.

Looking at the relevant information, there is a method of setting setoption delay. It should be feasible, but the time given to me is too long to succeed. We can only find another way out. This reason must be repeated when echarts draws the picture, because the first picture is rendered normally at the beginning of initialization. If it fails to draw another picture after query?Is it possible to erase the previous ecarts diagram and redraw it?

It’s possible theoretically, but it’s also possible in practice. We found a clearing method in echarts. As long as we do a clear before setoption and execute setoption, the code is as follows:

through time delay:

setTimeout(myCHart1.setOption(option), 500);

Similar Posts: