apache / echarts

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

[Bug] Single chart multiple graphs legend for each graph is not what is expected #19687

Open msmcgillis opened 4 months ago

msmcgillis commented 4 months ago

Version

5.5.0

Link to Minimal Reproduction

https://echarts.apache.org/examples/en/editor.html?code=PYBwLglsB2AEC8sDeAoW6OwOYCcIBMAuWAbTUw1QooCNgwxgBbQgcgHYAGAUlfOoC-AGn4Uq1DIxBsALD1YiJGOg2az5ozMM2UdmKWy69FEgToC6JzABsApllvQipPcleTQxVhqXal4pVgDWFYAZgBWXlc_CQCJYNYANki-XwsrD2BrSGlkGMx8AEMwQoBnWzBiOOp8CCZHUqhoUuISViKwWwVWAEFugCFugGFugBFugFFWS3dYUuAAVxwAY1tW8hIAIgAmTm2ZAFpOAEYj482hY8vOS6uATiEZGfQt3f2zo-2L7evboQAOR7PUg7PaHE5HUIXUK_Y5XdhAkyvMEfTgyC4yWFXRKIjag94QzjhC7hLFCUlPJH48GnTiJC44443OGPXEvamo9gXBFMv4wyl4t40o7_C6A3ksn4C9lC1F3C4PCVXK7SkGyiFMi4S5lXG6q5EE05wrXKnVCPXmFCWwQZdAADx6dogLRc_iCAE8QGsQpB6gpsHh8ABJJy2O3ETiwfJiD1ery-rpCAMEEP4MPEY5R22UWPe1gJ_24FOh8OwbZR9I6d2O53rN1gT15gBuhWsC0TyeDJYjWdcSFzXhbbY7Ra7adLmejmH7DbjISH7cLgdT6bLFeowMwhWgdWKTWIADNW-Vs-U8LZSrA67FZtBCvUvH1s_pG15rBBoInZssssAcF4aGHBRZkcH80yqWZ7S8Dov0CDB3UfVJAjMXxnzcOC7wfEJBjQ9BZzzd9P2AuCf2sP8vFwWxHGIwIHSdUoVwnXDYGrejGIzZjQOAcD0Lg2BS3aYpYL4hDsKQtJUL7W97zzEZmPwt8P2EpRSPIkI_23BwaKUOjnXY2ArlmVi9O7AzOOgMDvWqCQBJg7TAlE1gRlmFDTDQ6zMEwvNxnk18QkI5SJFU_8QndWxrDIgB3ezqF0hjTMMuDjPi8cOJAizuKsyD-OgoSYokRzxhc6J3OkrDWCmXy51YAL8swYKvBwWx8DqjA4v0n4jJrFLV06uCuJ4jyKFsvLmPQRypmKiSKHMAQAG4gA

Steps to Reproduce

View Reproduction.

Look at legend for each chart.

Current Behavior

Legend for each chart includes lines from all three grids.

Expected Behavior

Each charts legend should only include the items actually in that sections chart.

So the first legend should only have A the second legend should have B, C and D, the third legend should have E.

Environment

- OS:MacOS
- Browser:Chrome
- Framework: NA

Any additional comments?

Attempting to combine multiple charts into single chart with single dataset. Attached is an html file that can be used to view the desired charts vs the currently generated chart when combined into a single chart. t.txt

MatthiasMert commented 4 months ago

If you want your legends to contain specific items you have to configure them in data. Otherwise, how would echarts be supposed to know which legend is for which grid?

Example

msmcgillis commented 4 months ago

Thanks the documentation is missing details for the legend and I thought I tried using data. In any case your example works for me so that is great.

The same way the code knows which series belongs to which grid. To my thinking would also apply to the legend. Each grid has its on legend those series assigned to each grid gets assigned to the corresponding legend.