no data

Hi 

I have a dashboard which shows up with some sparkline components but initially on deploying the application there is not enough data i.e. there is only 1 data point for instance and in this case I would like the sparkline not to show up as it would be meaningless but instead the system throws an exception

See exception trace below, how do I handle this?


2024-05-11 06:34:08.8482|DEBUG|MudBlazor.BrowserViewportService|Adding entry for MudBlazor.BrowserViewportSubscription/MudBlazor.MudDrawer. 1 total observers after add.

2024-05-11 06:34:10.4698|WARN|Microsoft.AspNetCore.Components.Web.ErrorBoundary|Unhandled exception rendering component: Sequence contains no elements

2024-05-11 06:34:10.5087|INFO|kALMNext.Shared.KALMLayout|Error Occured

2024-05-11 06:34:10.7333|INFO|kALMNext.Shared.KALMLayout|Message : Sequence contains no elements

2024-05-11 06:34:10.7365|INFO|kALMNext.Shared.KALMLayout|Trace : at System.Linq.ThrowHelper.ThrowNoElementsException()

   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)

   at Syncfusion.Blazor.Charts.SfSparkline`1.DataProcessing(IEnumerable dataSource)

   at Syncfusion.Blazor.Charts.SfSparkline`1.ProcessData()

   at Syncfusion.Blazor.Charts.SfSparkline`1.ComponentRender(Boolean isCDNScript)

   at Syncfusion.Blazor.Charts.SfSparkline`1.OnAfterScriptRendered()

   at Syncfusion.Blazor.SfBaseComponent.OnAfterRenderAsync(Boolean firstRender)

   at Syncfusion.Blazor.SfDataBoundComponent.OnAfterRenderAsync(Boolean firstRender)

   at Syncfusion.Blazor.Charts.SfSparkline`1.OnAfterRenderAsync(Boolean firstRender)


1 Reply

DG Durga Gopalakrishnan Syncfusion Team May 13, 2024 11:54 AM UTC

Hi Mahesh,


Greetings from Syncfusion.


By default, sparkline control will be rendered when more than 1 data point is specified for datasource. If one data or no data is provided, then control won’t be rendered. We have ensured your reported scenario with single data; the reported console exception is not thrown. We have attached the tested sample for your reference.


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


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

  • Try to replicate the reported problem in above sample.
  • Please share your sample or code snippet with full configurations.
  • .NET version and NuGet package version.
  • Blazor Server or WASM or Web App.


Kindly revert us if you have any concerns.


Regards,

Durga Gopalakrishnan.


Loader.
Up arrow icon