echarts dispatchAction does not support component IDs

ep6jt1vc  于 2022-11-05  发布在  Echarts
关注(0)|答案(3)|浏览(118)

What problem does this feature solve?

dispatchAction supports addressing series and data by name but not by id.

In the following excerpt from the documentation we can see it indexes and names of series and data, but not the id of any of series.

This seems to be the case for all dispatchAction targets, including the legendToggleSelect API which I want to use, that supports name but not id .

This is despite the fact that the documentation explicitly states the ID can be used to address the component via the API.

I deliberately do not want to give a name to my series because I do not want it visible in the legend. I want to control it separately via the API. Yet, I cannot address it via its ID, only by its name, even though giving it a name has side-effects.

What does the proposed API look like?

dispatchAction({
    type: 'legendToggleSelect',
    id: 'seriesId',
})
ee7vknir

ee7vknir1#

Hi! We've received your issue and please be patient to get responded. 🎉
The average response time is expected to be within one day for weekdays.

In the meanwhile, please make sure that it containsa minimum reproducible demoand necessaryimagesto illustrate. Otherwise, our committers will ask you to do so.

  • A minimum reproducible demo* should contain as little data and components as possible but can still illustrate your problem. This is the best way for us to reproduce it and solve the problem faster.

You may also check out the API and chart option to get the answer.

If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to dev@echarts.apache.org . Please attach the issue link if it's a technical question.

If you are interested in the project, you may also subscribe our mailing list .

Have a nice day! 🍵

yvgpqqbh

yvgpqqbh2#

First, you may define the name of the series and it does not have to be in the legend if you don't want to. Just don't put it inside legend.data will do.

If you wish to use id, most likely you have to specify the id in the series otherwise you may not know the default logic of series id (in fact, it looks like "\u0000Series Name\u00000" ). So that won't be much difference if you specify id or seriesName .

I tried with seriedId and it does not work. I don't know why it is not supported by now. But if you still have this requirement, we can discuss it more.

dgiusagp

dgiusagp3#

Actually legendToggleSelect action is dispatched to legend component, not series. So the name property should match legend.data . And default legend.data comes from series.name not series.id

相关问题