We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

No Animation when Chart DataSource is Updated

When I load the ChartSeries datasource on the OnInitializedAsync() method, the Series appears on the Chart with an animation.
Then, When I make changes the datasource ( creating a new source ), the data appears well and correctly but without the animation.
How can I update the ChartSeries AND show the animation?

<EjsChart>
                <ChartPrimaryXAxis ValueType="Syncfusion.EJ2.Blazor.Charts.ValueType.Category"></ChartPrimaryXAxis>
                <ChartSeriesCollection>
                    <ChartSeries  DataSource="@lstItemsChart" XName="Hora" YName="Valor" Type="ChartSeriesType.Column">
                    </ChartSeries>
                </ChartSeriesCollection>
  </EjsChart>
<button @onclick="UpdateChart()">Update</button>

@code
{
public List<ItemChartDiaCanalHora> lstItemsChart { set; get; }
protected override async Task OnInitializedAsync()
{

       lstItemsChart = dal.GetChartData(1);
// The charts loads with animation OK.

 }

void UpdateChart()
{
      lstItemsChart = dal.GetChartData(1);
// The chart updates the data OK, but no animation.

}
}

3 Replies

SM Srihari Muthukaruppan Syncfusion Team October 21, 2019 03:19 AM UTC

Hi Ricardo, 
 
We have analyzed your query. From that, we would like to let know that by default, the animation occurs only at initial rendering and it does not work while changing the datasource. To achieve your requirement, we suggest you to remove the series from chart and then add the series using “RemoveSeries()” and “Addseries()” method respectively. Based on that we have a sample for reference. Please find the sample below. 

 
Let us know, if you have any concerns. 
 
Regards 
Srihari M 



PH Phil Holmes May 8, 2024 05:15 AM UTC

How does this work with current Blazor release, which doesn't use EjsChart, but rather SfChart, which doesn't seem to support adding or removing series???



DG Durga Gopalakrishnan Syncfusion Team May 9, 2024 12:23 PM UTC

Hi Phil,


From version 18.1.42, we have changed the NuGet, Namespace and Component Name. Please check with below release notes for more information about breaking changes.


Release Notes : https://blazor.syncfusion.com/documentation/release-notes/18.1.42?type=all#breaking-changes


We were able to add and remove series in latest version. We already have the documentation for adding or removing the chart series. Please check with the below sample and UG link.


Sample : https://blazorplayground.syncfusion.com/BNrpNStkzrjGsLiA


UG : https://blazor.syncfusion.com/documentation/chart/how-to/add-remove


Please let us know if you have any other concerns.


Regards,

Durga Gopalakrishnan.


Loader.
Live Chat Icon For mobile
Up arrow icon