apexcharts / Blazor-ApexCharts

A blazor wrapper for ApexCharts.js
https://apexcharts.github.io/Blazor-ApexCharts
MIT License
784 stars 91 forks source link

UpdateSeriesAsync resets series visibility #403

Closed technyon closed 6 months ago

technyon commented 6 months ago

Hi,

I've created a chart to display realtime data, so far it works fine. I've roughly followed the realtime data example:

https://apexcharts.github.io/Blazor-ApexCharts/methods/update-series

My chart has multiple lines though, and defaults to having a legend to select / unselect series for display. When I unselect a series, it disappears but is automatically re-added when calling "await chart.UpdateSeriesAsync(true);". Looking into the code, my guess is this happens because internally SetSeries() is called which clears all series options ("Options.Series = new List<Series>();") and then repopulates it.

I think the selected / unselected state should be either kept or restored automatically after UpdateSeriesAsync is finished.

joadan commented 6 months ago

Hi,

I'm afraid that there is no setting in apexcharts.js to set a series to initially hidden. more info here, https://github.com/apexcharts/apexcharts.js/issues/1217

technyon commented 6 months ago

Hi,

Since this issue is addressed, in my PR and can be fixed by using UpdateSeriesByNameAsync, I'm closing this issue.