79702239

Date: 2025-07-15 14:41:08
Score: 2.5
Natty:
Report link

I had a similar problem in one of my projects where I was updating a bar chart.

What I did was make a variable exampleChart referencing the ApexChart component and then call exampleChart.UpdateSeriesAsync() method to update the chart whenever and wherever I want.

With your code, it would be like so:

@code :

private ApexChart<ChartData>? exampleChart { get; set; }

private async Task ReloadChartSeries()
{
    if (exampleChart is not null)
        await exampleChart.UpdateSeriesAsync();
}

view :

<ApexChart @ref="exampleChart" TItem="spGetGraphPloegen" Options="chartOptionsVroege" Height="300">
    <ApexPointSeries TItem="spGetGraphPloegen"
                     Items="GraphVroege"
                     Name="Vroege"
                     SeriesType="SeriesType.Line"
                     XValue="e => e.Ts"
                     YValue="e => (decimal)e.Cap_Act" />
</ApexChart>

After that, you just have to call ReloadChartSeries() when you are selecting the new day.

Someone posted a similar question with the tag:

https://stackoverflow.com/questions/74314021/how-do-i-refresh-new-data-in-apexcharts

Reasons:
  • Blacklisted phrase (1): stackoverflow
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-1):
  • Has code block (-0.5):
  • User mentioned (1): @code
  • Low reputation (1):
Posted by: Matoshiro