0

I am trying to avoid the default click behavior on the legend of React ECharts.

When the user click on any legend item, the corresponding plotted data disappear from the graph until the user click on the legend again to show up.

How can I avoid this default behavior so that when clicking on any legend item, nothing happens?

I already tried what is described here but didn't work:

ECharts: Disable default click action on legends

Here is part of the code:

legend: {
  itemGap: 15,
  left: '0',
  selectedMode: 'none', // or 'onlyHover'
  ...
}

None of the options for selectedMode above worked.

EChart versions on the project:

"echarts": "^5.4.1",
"echarts-for-react": "^3.0.2",

Could anyone help ?

TIA

1 Answers1

0

I got it.

the selectedMode property should take a boolean as the value for the version I am using.

legend: {
  selectedMode: false, // default is true
  ...
}

It is also here in the documentation:

https://echarts.apache.org/en/option.html#legend.selectedMode