Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for replaceMerge option like official Echarts setOptions #478

Open
NattapongSiri opened this issue Mar 16, 2022 · 7 comments
Open

Comments

@NattapongSiri
Copy link

See: https://echarts.apache.org/en/api.html#echartsInstance.setOption
There's an option replaceMerge which work in combination with notMerge option.

It seem like the only place to be modified is https://github.com/hustcc/echarts-for-react/blob/master/src/types.ts
because

if (!isEqual(pick(this.props, pickKeys), pick(prevProps, pickKeys))) {
this.updateEChartsOption();
}
will automatically set this option to underlying Echart instance.

@hustcc
Copy link
Owner

hustcc commented Sep 28, 2022

Are there any bugs with current code?

echarts support 2 way to config notMerge.

@RogerWenXin
Copy link

how can I set replaceMerge with react-echarts

@toeyps
Copy link

toeyps commented Nov 11, 2022

The problem with it is the lack of support for functionality like replaceMerge.
I'm not sure about meaning behind "2 way to config notMerge.
Do you mean that it is currently possible to simulate replaceMerge by using notMerge ?

@omuelle
Copy link

omuelle commented Jan 7, 2023

will this be fixed anytime soon?

@fedotenko-qs
Copy link

This option is really helpful to solve apache/echarts#6202
See: apache/echarts#6202 (comment)

@ayden-canvass
Copy link

would love to see this added, it's a huge issue for my project

@lebaudantoine
Copy link

Partial echartInstances.setOption method's parameters are supported in react-echart mapping. Refer to the method documentation for more details.

echartInstances.setOption accepts either :
parameters

(option: Object, notMerge?: boolean, lazyUpdate?: boolean)

or

(option: Object, opts?: {
    notMerge?: boolean;
    replaceMerge?: string | string[];
    lazyUpdate?: boolean;
})

As the official documentation explains :

There are two ways to remove components:
Totally removal: use notMerge: true, all of the components will be removed.
Partially removal: use replaceMerge: [...], the specified types of components will be removed if no id matched. This mode is useful to keep the state (e.g., highlight / animation / selected area) of the other components while make removal.

Unfortunately, the react-echart library currently lacks support for the replaceMerge parameter. You can check the component internal logic and component props for further details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants