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

Exception thrown on version 2.4.0.38 at the initialization of the Chart's datasource

Hello,


I am using the SfChart component at my Blazor project and I update the chart's datasource dynamically.

So what I am doing specifically is that every time an event is triggered I update this datasource.

My problem is that a lot of times at the initialization of the page this exception is thrown

blazor.server.js:1 [2023-01-25T09:46:50.753Z] Error: System.InvalidOperationException: Sequence contains no elements

at System.Linq.ThrowHelper.ThrowNoElementsException()

at Syncfusion.Blazor.Charts.Internal.ParetoSeriesRenderer.ProcessData()

at Syncfusion.Blazor.Charts.Internal.ChartSeriesRendererContainer.ProcessData()

at Syncfusion.Blazor.Charts.SfChart.ProcessData()

at Syncfusion.Blazor.Charts.SfChart.PerformLayout()

at Syncfusion.Blazor.Charts.SfChart.OnAfterRenderAsync(Boolean firstRender)

at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

at Microsoft.AspNetCore.Components.ErrorBoundaryBase.Microsoft.AspNetCore.Components.IErrorBoundary.HandleException(Exception exception)

 at Microsoft.AspNetCore.Components.RenderTree.Renderer.HandleExceptionViaErrorBoundary(Exception error, ComponentState errorSourceOrNull)



These are some parts of my code:

//Datasource
public IList Datasource { get; set; } = new List();


//Class
public class SfParetoView
{
public double Time { get; set; }
public string Category { get; set; }
public string Color { get; set; } = "#FF48F9";
}

//Chart

<SfChart Height="97%" ID="firstPareto">
    <ChartPrimaryXAxis Title="X Axis" ValueType="Syncfusion.Blazor.Charts.ValueType.Category" Interval="1">
        <ChartAxisLineStyle Width="0"></ChartAxisLineStyle>
        <ChartAxisMajorTickLines Width="0"></ChartAxisMajorTickLines>
        <ChartAxisMajorGridLines Width="0"></ChartAxisMajorGridLines>
        <ChartAxisMinorTickLines Width="0"></ChartAxisMinorTickLines>
        <ChartAxisMinorGridLines Width="0"></ChartAxisMinorGridLines>
    </ChartPrimaryXAxis>
    <ChartPrimaryYAxis Title="YAxis" Minimum="0">
        <ChartAxisLineStyle Width="0"></ChartAxisLineStyle>
        <ChartAxisMajorTickLines Width="0"></ChartAxisMajorTickLines>
        <ChartAxisMajorGridLines Width="1"></ChartAxisMajorGridLines>
        <ChartAxisMinorTickLines Width="0"></ChartAxisMinorTickLines>
        <ChartAxisMinorGridLines Width="1"></ChartAxisMinorGridLines>
    </ChartPrimaryYAxis>
    <ChartTooltipSettings Enable="true" Shared="true"></ChartTooltipSettings>
    <ChartSeriesCollection>
        <ChartSeries DataSource="@Datasource"
                        XName="Category"
                        YName="Time"
                        Type="ChartSeriesType.Pareto"
                     Name="Value"
                        ColumnWidth="0.3"
                        PointColorMapping="Color">
            <ChartMarker Visible="true" Height="10" Width="10">
            </ChartMarker>
        </ChartSeries>
    </ChartSeriesCollection>
    <ChartLegendSettings Visible="false"></ChartLegendSettings>
</SfChart>

Do you have any idea why is this happening?I need your help as soon as possible Thanks in advance!


1 Reply

KA Karthick Arjunan Syncfusion Team January 27, 2023 12:51 PM UTC

Hi Amanda,


Greetings from Syncfusion.


We have ensured your reported scenario with attached code snippet; unfortunately, we are unable to replicate an issue from our end. We have attached the tested sample and screenshot for your reference.


Before Update



After Update



Sample : https://www.syncfusion.com/downloads/support/directtrac/general/ze/ParetoUpdate-670507869.zip


Since we are unaware of exact scenario which replicates an issue, we request you to share the following information which will be helpful for further analysis and provide you the solution sooner.

  • Try to reproduce the reported scenario in above sample.
  • Please share your sample (or) code snippet with full configurations.
  • Share the details if you have done any other customization in your sample.
  • Share your datasource file.


Kindly revert us if you have any concerns.


Regards,

Durga Gopalakrishnan.


Loader.
Live Chat Icon For mobile
Up arrow icon