echarts [Bug] 两张相似的echart表connect相连,且每个echart都设置了toolbox.feature.magicType.type为['line', 'bar'],切换其中一个echart后,另一个echart的数据渲染错误。

qhhrdooz  于 3个月前  发布在  Echarts
关注(0)|答案(2)|浏览(65)

Version

5.2.4

http://1.andrewblack.sinaapp.com/chart/index.html

Steps to Reproduce

1、创建两个echart图表,且设置两张图表的toolbox.feature.magicType.type为['line', 'bar']
2、令两个echart图表connect相连,echarts.connect([echart1, echart2])
3、切换其中一个echart的渲染模式,另一个echart的数据就会合并所有相连的echart的数据

Current Behavior

connect的echart图表渲染了所有echart的数据

Expected Behavior

仅渲染自己的数据

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

dm7nw8vv

dm7nw8vv1#

@MrSulm It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗
TRANSLATED

TITLE

[Bug] Two similar echart tables are connected by connect, and each echart has toolbox.feature.magicType.type set to ['line', 'bar']. After switching one of the echarts, the data rendering error of the other echart .

BODY

Version

5.2.4

http://1.andrewblack.sinaapp.com/chart/index.html

Steps to Reproduce

  1. Create two echart charts, and set the toolbox.feature.magicType.type of the two charts to ['line', 'bar']
  2. Connect two echart charts, echarts.connect([echart1, echart2])
  3. Switch the rendering mode of one of the echarts, and the data of the other echart will merge the data of all connected echarts

Current Behavior

connect's echart chart renders all echart data

Expected Behavior

Only render own data

Environment

- OS:
-Browser:
- Framework:

Any additional comments?

No response

hc2pp10m

hc2pp10m2#

echarts.connect broadcast chart's action in other charts, and make some action (like tooltip) behavior synced.

But for the magicType action(this action makes bar to line , or reverse), this action creates a new series option based on current series data and put them in action payload.

So for these charts which connected, they just get a new series option, but they do not have that series in payload before, so they render the new series data in these connected charts.

@Ovilia Hi, maybe the logic for generating a new series in magicType needs to be moved to the front of mergeOptions , rather than in onClick ?
This way, when the action is triggered by another connected chart, the corresponding synchronized action can happen without errors.

相关问题