echarts icon indicating copy to clipboard operation
echarts copied to clipboard

[Bug] In some cases, custom legends do not work

Open spiral2k opened this issue 3 years ago • 0 comments

Version

5.3.3

Link to Minimal Reproduction

https://codesandbox.io/s/hopeful-payne-3kyvgp

Steps to Reproduce

select the line or mixed chart -> the legends functional correctly, but in the area doesn't have any effect.

I didn't understand from the docs if I have access to the legends inner state, I want to be able to get an object that represents the inner state of the legends, after I set the chart configuration, something like:

{ Alpha: true, Beta: false } is it possible?

Current Behavior

I set the name property of each series, when the user clicks on one of the custom legends, I fire the event with the name of that legend, it works in some charts.

Expected Behavior

I expect to be able to toggle legends by name on all charts

Environment

OS: macOS Monterey
Browser: Chrome 104.0.5112.79
Framework React@18

Any additional comments?

thank you you're awesome

spiral2k avatar Aug 10 '22 16:08 spiral2k

emmm.... review your code.

I found these differences.

three charts default config
image image

Area did't configure legend: {show: false}

so, are you clear now?

fuchunhui avatar Aug 17 '22 12:08 fuchunhui

emmm.... review your code.

I found these differences.

three charts default config image image Area did't configure legend: {show: false}

so, are you clear now?

sorry, I don't understand how your answer is related to my issue, can you please explain yourself?

I'm using legend: {show: false} as the default configuration since I want to be able to render custom legends. i don't want Echarts to render the legends

so how i can get the legends list and their state?

thanks

spiral2k avatar Aug 21 '22 09:08 spiral2k

If you customize legend, you also need to add legend and set it to not display, same with line chart.

legend: {show: false}

fuchunhui avatar Aug 22 '22 11:08 fuchunhui