BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
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 IListDatasource { 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!
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.
Kindly revert us if you have any concerns.
Regards,
Durga Gopalakrishnan.