apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.25k stars 19.61k forks source link

Error: `setOption` should not be called during main process. #15280

Open zpinocchio opened 3 years ago

zpinocchio commented 3 years ago

Version

5.1.2

Steps to reproduce

setOption(option with some error), Error: setOption should not be called during main process.

when I fixed option , try setOption again, it still report above error only then i dispose this chart instance and redraw it become normal

but I have same element(create by zrender ) that not include in option,dispose and redraw will miss these element so how can I fixed above error and keep these element

What is expected?

I fixed above error and keep these element

What is actually happening?

miss these element

echarts-bot[bot] commented 3 years ago

Hi! We've received your issue and please be patient to get responded. 🎉 The average response time is expected to be within one day for weekdays.

In the meanwhile, please make sure that it contains a minimum reproducible demo and necessary images to illustrate. Otherwise, our committers will ask you to do so.

A minimum reproducible demo should contain as little data and components as possible but can still illustrate your problem. This is the best way for us to reproduce it and solve the problem faster.

You may also check out the API and chart option to get the answer.

If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to dev@echarts.apache.org. Please attach the issue link if it's a technical question.

If you are interested in the project, you may also subscribe our mailing list.

Have a nice day! 🍵

echarts-bot[bot] commented 3 years ago

@zpinocchio Please provide a minimum reproducible demo for the issue either with https://codepen.io/Ovilia/pen/dyYWXWM , https://www.makeapie.com/editor.html or https://codesandbox.io/s/mystifying-bash-2uthz.

A minimum reproducible demo should contain as little data and components as possible but can still illustrate your problem. This is the best way for us to reproduce it and solve the problem faster.

pissang commented 3 years ago

Are you using HMR?

yuhongcheng2003 commented 3 years ago

I'm also seeing this error which seems to be some kind timing issue. I have setTimeout wrapped around it, but occasionally I still see that error. I have not dived into echart code base, but I assume the "main process" is not single threaded? Or if there is some kind error preventing the main process from complete? Is there an api to reset the "flag" if an error occurred?

I have created a sample of if the original setOption failed, then following setOption won't work either.

Example: https://codepen.io/yuhongcheng2003/pen/XWReyda

sususususususs commented 3 years ago

我最近也出现了这个错误,v5.0.2 setTimeout,reset方法等都试过了,没用,在radar图中出现的错误,其他类型的图都都没出现,有什么解决方法么

KaygNas commented 3 years ago

I have the simliar problem and found there was the error in the formatter that cause it, i was tring to read property of undefined which might throw error in echart and casuse this problem.

Quang-Dong commented 2 years ago

I got this error, and here's the reason I found out:

The point is that you have to access the correct path of the series' child objects

Option

option: { series: [ data: [ { value: 0, detail: { color: 'white', }, }, ], ] }

setOption

myChart.setOption({ series: [ { data: [ { value: your_data, detail: { color: 'white', }, }, ], }, ], })

chengkai2022 commented 2 years ago

从4.0升级到5.0后我在雷达图,3d坐标系中遇到同样的问题

dean714714 commented 2 years ago

vue组件上加个v-once,一个实例就可以了

pierresh commented 1 year ago

Are you using HMR?

Indeed it happens when I am developing (with ngx-echarts and Angular, using Typescript), but not when I use a build of my app.