Change dymamically the datasource of the charts

Hello,

im currently using syncfusion blazor 23.2.4.

I'm trying to change the datasource of my chart using a dropdownList but when im doing it i have this error that is being trigger : 

Collection was modified; enumeration operation may not execute.


How is this possible to do it ?

<SfAccumulationChart @ref="sfChart" Title="@title" Height="95%" Width="95%" EnableSmartLabels="true" >

    <AccumulationChartEvents Loaded="@LoadHandler" ></AccumulationChartEvents>

    <AccumulationChartSeriesCollection>

        <AccumulationChartSeries DataSource="@objectifForSiteProducts" XName="ProductName" YName="WeightQuantity"

                                 Name="Product" InnerRadius="80%">

            <AccumulationDataLabelSettings Visible="true" Name="ProductName" Position="AccumulationLabelPosition.Outside">

                <Template>

                    @{

                        var data = context as AccumulationChartDataPointInfo;

                    }

                    <table>

                        <tr>

                            <td align="center" style="font-weight: bold;font-size: 14px;"> @Math.Round((double)data.Y, 2) </td>

                        </tr>

                        <tr>

                            <td align="center" style="font-size: 14px; font-weight: bold;"> @Math.Round(data.Percentage, 0) %</td>

                        </tr>

                    </table>

                </Template>

            </AccumulationDataLabelSettings>

        </AccumulationChartSeries>

    </AccumulationChartSeriesCollection>

    <AccumulationChartLegendSettings Visible="true" Position="Syncfusion.Blazor.Charts.LegendPosition.Bottom"></AccumulationChartLegendSettings>

</SfAccumulationChart>

this is my current accumulationChart


Thanks
Anthony


1 Reply

DG Durga Gopalakrishnan Syncfusion Team June 24, 2024 11:38 AM UTC

Hi Anthony,


Greetings from Syncfusion.


We have ensured your reported scenario with attached code snippet in your specified version(23.2.4) and also in latest version(26.1.38); unfortunately, we are unable to replicate the reported problem from our end. We have attached the tested sample and video for your reference.


Sample : https://www.syncfusion.com/downloads/support/directtrac/general/ze/PieUpdate-857038970.zip


Video : https://www.syncfusion.com/downloads/support/directtrac/general/ze/DataUpd-1548500469.zip


We request you to share the below information which will be helpful for further analysis and provide you the solution sooner.

  • Try to replicate an issue in above sample.
  • Please share your sample or code snippet with full configuration.
  • Share an issue replication video.
  • Blazor Server or WASM or Web App.
  • .NET version used.
  • Default system configuration.


Regards,

Durga Gopalakrishnan.


Loader.
Up arrow icon