apexcharts / Blazor-ApexCharts

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

The X values are not being updated correctly when calling UpdateSeries #244

Closed mrakgr closed 1 year ago

mrakgr commented 1 year ago

https://github.com/apexcharts/Blazor-ApexCharts/assets/6266635/9e4a6f8e-e7c3-4380-9a5e-dc2379089a63

I am doing some RL training here, and combining all the rewards by their iteration count. As the chart grinds the UI to a halt, I have a timer set to refresh it every 2 seconds.

Anyway, as you've seen when I switched the tabs back and forth to reset the chart, the iteration count should end up being between 50 and 199, but the component as it is not does not detect that. In addition to that, many times it happens that the values after the first 10 have undefined as their iteration count.

https://github.com/apexcharts/Blazor-ApexCharts/assets/6266635/e8f5910c-a75e-4914-bc13-f33c807881a0

I can't figure out how to do the dynamic updates without the timer, as well as having the X value show up correctly.

If you want to give running it a try: https://github.com/mrakgr/CFR-In-Fable/tree/apexcharts_bug

joadan commented 1 year ago

Hello, sorry for a late reply.

Do you think it's possible to try to make a simple repo just showing the issue you are experiencing?

mrakgr commented 1 year ago

I am not sure I feel like going back to this right now, but the issue does occur in this particular file:

https://github.com/mrakgr/CFR-In-Fable/blob/apexcharts_bug/src/Lproj.UI.BlazorServer/Components/TrainUI_Base.razor

In this file I made a timer that calls the update series every 0.5 seconds, because doing on every change would kill the performance.

https://github.com/mrakgr/CFR-In-Fable/blob/apexcharts_bug/src/Lproj.UI.BlazorServer/Components/TrainUI.razor#L32

And this is the data field that gets passed into the chart. It is not more complicated than this, you ignore all the other functionality in the program as far as the bug is concerned.

Also, I think you could make the example easily enough yourself by passing a bunch of random data, along with the iteration count into a chart, and then repeat that a few times.

Sorry about not accepting your request.