echarts-for-react
echarts-for-react copied to clipboard
Add support for replaceMerge option like official Echarts `setOptions`
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.
Are there any bugs with current code?
echarts support 2 way to config notMerge
.
how can I set replaceMerge with react-echarts
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
?
will this be fixed anytime soon?
This option is really helpful to solve https://github.com/apache/echarts/issues/6202 See: https://github.com/apache/echarts/issues/6202#issuecomment-974761211
would love to see this added, it's a huge issue for my project
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.