echarts icon indicating copy to clipboard operation
echarts copied to clipboard

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

Open zpinocchio opened this issue 4 years ago • 11 comments

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

zpinocchio avatar Jul 02 '21 08:07 zpinocchio

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 [email protected]. 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] avatar Jul 02 '21 08:07 echarts-bot[bot]

@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.

echarts-bot[bot] avatar Jul 02 '21 11:07 echarts-bot[bot]

Are you using HMR?

pissang avatar Jul 06 '21 05:07 pissang

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

yuhongcheng2003 avatar Jul 22 '21 15:07 yuhongcheng2003

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

sususususususs avatar Jul 23 '21 03:07 sususususususs

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.

KaygNas avatar Sep 28 '21 08:09 KaygNas

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', }, }, ], }, ], })

Quang-Dong avatar Sep 29 '21 10:09 Quang-Dong

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

chengkai2022 avatar Oct 09 '21 01:10 chengkai2022

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

dean714714 avatar Jan 19 '22 16:01 dean714714

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.

pierresh avatar Sep 08 '23 03:09 pierresh

I got the same error, but In my case is the slider component not be loaded. if any line of below throws any except will cause the this[IN_MAIN_PROCESS_KEY] remain true which is probably in an error state. So the error setOption should not be called during main process may not be the real error. https://github.com/apache/echarts/blob/104df1bce95183ef89e604b5173fc48b8fef367e/src/core/echarts.ts#L639-L648

JunYang-tes avatar Dec 24 '24 06:12 JunYang-tes

i get this error when i use: { "tooltip": { "trigger": "axis" } }

I don't have this error if i use: { "tooltip": { "trigger": "item" } }

I use it via ngx-echarts

roma2341 avatar Nov 26 '25 12:11 roma2341