https://codesandbox.io/embed/react-basic-example-sbosu
updateSeries forcefully makes all series visible intentionally as leaving them hidden causes a lot of bugs.
I suggest you keep track of which series you toggled in a separate state. Then, after calling updateSeries, you again toggle those series manually.
ApexCharts.exec("basic-bar", "updateSeries", [
{
data: [30, 40, 45, 50, 49, 60, 70, 91]
},
{
data: [33, 43, 43, 53, 43, 63, 73, 93]
}
]).then((chart) => {
ApexCharts.exec("basic-bar", "toggleSeries", "series-1");
// or you can also do this as you have got chart's context in this function param
chart.toggleSeries('series-1')
});
Most helpful comment
updateSeriesforcefully makes all series visible intentionally as leaving them hidden causes a lot of bugs.I suggest you keep track of which series you toggled in a separate state. Then, after calling
updateSeries, you again toggle those series manually.