echarts-for-react icon indicating copy to clipboard operation
echarts-for-react copied to clipboard

Add support for replaceMerge option like official Echarts `setOptions`

Open NattapongSiri opened this issue 2 years ago • 7 comments

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 https://github.com/hustcc/echarts-for-react/blob/0ab38618567b558413edde015bcb40931eb739ed/src/core.tsx#L69-L71 will automatically set this option to underlying Echart instance.

NattapongSiri avatar Mar 16 '22 04:03 NattapongSiri

Are there any bugs with current code?

echarts support 2 way to config notMerge.

hustcc avatar Sep 28 '22 01:09 hustcc

how can I set replaceMerge with react-echarts

RogerWenXin avatar Nov 11 '22 08:11 RogerWenXin

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 ?

toeyps avatar Nov 11 '22 09:11 toeyps

will this be fixed anytime soon?

omuelle avatar Jan 07 '23 07:01 omuelle

This option is really helpful to solve https://github.com/apache/echarts/issues/6202 See: https://github.com/apache/echarts/issues/6202#issuecomment-974761211

fedotenko-qs avatar Feb 09 '23 05:02 fedotenko-qs

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

ayden-canvass avatar Apr 03 '23 21:04 ayden-canvass

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.

lebaudantoine avatar Jul 20 '23 16:07 lebaudantoine