Blazor-ApexCharts
Blazor-ApexCharts copied to clipboard
add wrapper code for appendSeries
Expose apex charts appendSeries method in C# code
Hi,
Thank you
Do you have a description of this pull request? No sure how the changes to the realtime sample connects to the append series.
I've added a description.
RealTime.razor was just VS formatting things it shoudn't.
Sorry if I'm missing something here but adding series dynamically should be preformed using the razor syntax, like example https://apexcharts.github.io/Blazor-ApexCharts/features/dynamic-series
By adding it in code there is a mismatch between the two.
I believe in that example it works because after adding the series you call
await chart?.UpdateSeriesAsync(true);
In this chart it's ok because it's static data. In a realtime line chart, calling UpdateSeriesAsync will cause animations to trigger and the data to be reset. I'm honestly just trying to figure out how things are supposed to be done, because they are documented for specific cases only.
I need:
- a realtime chart
- with zoom, panning and so on
- and the ability to add series dynamically
So far it works, but I have a feeling apex charts isn't made for realtime data. Still many quirk when it comes to dynamic data, unfortunately I didn't find a better alternative so far.
Yeah one thing that found in realtime charts is that you can not use the toolbar, which means you can no do interactive zooming and panning. I don't know if there is any plan around this thing because that will be super useful.
You can actually, but it's tricky. Instead of setting the range, every time after appending data to the chart you call c. Then detect via OnZoomed and OnScrolled events if the user is zooming or panning, and suppress calls to ZoomXAsync during this time.
I have actually opened an issue about this at apex charts, all of this should be handled internally by the chart:
https://github.com/apexcharts/apexcharts.js/issues/4423
I'm not too optimistic anything will happen there soon though.
@technyon, Thank you I now understand the issue. I'll merge this.