apexcharts / Blazor-ApexCharts

A blazor wrapper for ApexCharts.js

Home Page:https://apexcharts.github.io/Blazor-ApexCharts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chart not updating after asynchronous call

Domivan opened this issue · comments

First call UpdateSeriesDelay method not cause to update chart

private int GetRandom => new Random().Next(1, 12);

private async Task UpdateSeriesDelay()
{
await Task.Delay(10); // this blocks first chart update

 ShowData = Data.Take(GetRandom).ToList();
 await chart.UpdateSeriesAsync(true);

}

private async Task UpdateSeries()
{
ShowData = Data.Take(GetRandom).ToList();
await chart.UpdateSeriesAsync(true);
}

Test project:
https://github.com/Domivan/MudTests

Hi,

Please try to add a StateHasChanged().

private async Task UpdateSeriesDelay()
{
    await Task.Delay(10); // this blocks first chart update
    ShowData = Data.Take(GetRandom).ToList();
    StateHasChanged();
    await chart.UpdateSeriesAsync(true);
}

Great! Thank you!