apache / echarts

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

[Bug] Chart affected by other chart options #19880

Open brandonstubbs opened 4 months ago

brandonstubbs commented 4 months ago

Version

5.5.0

Link to Minimal Reproduction

https://gist.github.com/brandonstubbs/d1fe4a7d55495a59c3b7d86929f2085b

Steps to Reproduce

The gist is a full reproduction of the issue.

Current Behavior

The decal on the area chart is not on the correct series: image

Expected Behavior

If you comment out the decal or you change the order that you set the options on the charts the decal will be correct: image

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

helgasoft commented 4 months ago

Even if the observation is correct, scatter.itemStyle API has no decal, so setting it up does not make sense, no?

brandonstubbs commented 4 months ago

@helgasoft correct it doesn't make much sense having the decal there, however, I've noticed other strange behaviour with multiple charts and this was a mistake that took a long time to isolate, find and reproduce (Especially as it only happens if the scatter chart is rendered first)

Do you think a misconfigured option (or any option for that matter) should change the behaviour of another chart?

What do you think about the behaviour of this example?

helgasoft commented 4 months ago

Do you think a misconfigured option (or any option for that matter) should change the behaviour of another chart?

Of course not. And you are right, it is a bug 😓 In second example chart#1 sets only one general decal for all series, and chart#2 sets specific decals for each series (see Object vs array in docs). Problem is that the 'general' takes precedence over the specific for the entire webpage - erroneously. Fixed when chart#1 decals are defined specifically for each series:

           decals: [
             { symbol: "circle" },  // won't do much for scatter, but would show for bar
             { symbol: "none"   },
             { symbol: "none"   },
             { symbol: "square" },
           ],

And yes, scatter series is counted despite not being able to use decals.

brandonstubbs commented 4 months ago

In the second example it sets one decal for the series that should be repeated, as it's within the array as mentioned in the docs you linked.

See example of same decal repeated for each series. See example of toggling between two decals for all the series.

So I think the example I had in the gist or even a toggle pattern example is a correct example. I want decals to toggle for all series. The above fix is not a repeating pattern of decals.

But I think we are starting to move away from the main issue: A charts options (and perhaps rendering order) is affecting another chart