Unable to cast object of type 'System.Decimal' to type 'System.Double'.

StockCharts can tagek decimal values but Chart can not.

candle data like open/close/... is decimal in the DataSource.

Is it possible to use decimal values in Chart?

<!-- does not work => Unable to cast object of type 'System.Decimal' to type 'System.Double'. -->
    <SfChart>
        <ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Category" />
        <ChartSeriesCollection>
            <ChartSeries DataSource="@AdvancedDataSource" 
                        XName=@nameof(CandleDataAdvanced.Time) 
                        High=@nameof(CandleDataAdvanced.High) 
                        Low=@nameof(CandleDataAdvanced.Low) 
                        Open=@nameof(CandleDataAdvanced.Open) 
                        Close=@nameof(CandleDataAdvanced.Close) 
                        Type="ChartSeriesType.Candle">
            </ChartSeries>
        </ChartSeriesCollection>
    </SfChart>

<!-- works -->
    <SfStockChart>
        <StockChartSeriesCollection>
            <StockChartSeries DataSource="@AdvancedDataSource" 
                            XName=@nameof(CandleDataAdvanced.Time) 
                            High=@nameof(CandleDataAdvanced.High) 
                            Low=@nameof(CandleDataAdvanced.Low) 
                            Open=@nameof(CandleDataAdvanced.Open) 
                            Close=@nameof(CandleDataAdvanced.Close)
                            Volume=@nameof(CandleDataAdvanced.Volume)
                            Type="ChartSeriesType.Candle"></StockChartSeries>
        </StockChartSeriesCollection>
    </SfStockChart>

7 Replies 1 reply marked as answer

DG Durga Gopalakrishnan Syncfusion Team March 15, 2021 11:25 AM UTC

Hi Andreas,

We have validated your reported scenario. We have considered this as a bug and logged a defect report. This fix will be available in our upcoming weekly patch release which is expected to be rolled out on 6th April 2021. We appreciate your patience until then. You can keep track of the bug from the feedback portal below.


The provided feedback link is private, and you need to login to view this feedback.

If you have any more specification/precise replication procedure or a scenario to be tested, you can add it as a comment in the portal. 

Regards,
Durga G



DG Durga Gopalakrishnan Syncfusion Team April 11, 2021 03:44 PM UTC

Hi Andreas, 

We are glad to announce that our v19.1.55 patch release is rolled out; we have added the fix for reported issue. You can use the latest Syncfusion.Blazor NuGet package version.  


We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 

Regards, 
Durga G 



AN Andreas May 5, 2021 10:08 AM UTC

hello, i have updated to the newest 19. version and now i have the same issue with StockCharts

blazor.server.js:21 [2021-05-05T10:06:46.576Z] Error: System.InvalidCastException: Unable to cast object of type 'System.Decimal' to type 'System.Double'.
   at Syncfusion.Blazor.Charts.StockEvents.FindClosePoint(ChartSeries series, StockChartStockEvent stockEvent)
   at Syncfusion.Blazor.Charts.StockEvents.CreatEventGroup(RenderTreeBuilder builder, ChartSeries series, StockChartStockEvent stockEvent, Int32 i, Size textSize)
   at Syncfusion.Blazor.Charts.StockEvents.RenderStockEvents(RenderTreeBuilder builder)
   at Syncfusion.Blazor.Charts.SfStockChart.CalculateStockEvents(RenderTreeBuilder builder)
   at Syncfusion.Blazor.Charts.SfChart.RenderAfterSeries(RenderTreeBuilder builder)
   at Syncfusion.Blazor.Charts.SfChart.RenderSeriesElements(RenderTreeBuilder builder)
   at Syncfusion.Blazor.Charts.SfChart.<RenderElements>b__843_0(RenderTreeBuilder builder)
   at Syncfusion.Blazor.Charts.SfChart.<BuildRenderTree>b__860_0(RenderTreeBuilder __builder2)
   at Microsoft.AspNetCore.Components.CascadingValue`1.Render(RenderTreeBuilder builder)
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()


DG Durga Gopalakrishnan Syncfusion Team May 7, 2021 05:22 AM UTC

Hi Andreas, 

We have ensured your reported scenario with decimal type for stock chart in latest Syncfusion. Blazor nugget package 19.1.59. Unfortunately, we are unable to replicate an issue from our end. We have attached tested sample for you reference.  

Screenshot : 

 


Please mention the scenario in which you are facing the reported console error. Kindly try to replicate an issue in above sample or share us issue reproduced sample, so that it will be helpful for us to proceed further.  

Regards, 
Durga G


AN Andreas May 7, 2021 08:59 AM UTC

as you can see in the error message the problem seem to be coming from STockChartEvents

blazor.server.js:21 [2021-05-05T10:06:46.576Z] Error: System.InvalidCastException: Unable to cast object of type 'System.Decimal' to type 'System.Double'.
   at
Syncfusion.Blazor.Charts.StockEvents.FindClosePoin
t
(ChartSeries series, StockChartStockEvent stockEvent)

in your example you had no events.


DG Durga Gopalakrishnan Syncfusion Team May 10, 2021 12:00 PM UTC

Hi Andreas, 

Sorry for the inconvenience caused. We have considered this as a bug and logged a defect report. This fix will be available in our upcoming weekly patch release which is scheduled to be rolled out on 25th May 2021. We appreciate your patience until then. You can keep track of the bug from the below feedback link. 
 
 
If you have any more specification/precise replication procedure or a scenario to be tested, you can add it as a comment in the portal.  

Regards, 
Durga G


DG Durga Gopalakrishnan Syncfusion Team May 25, 2021 02:22 PM UTC

Hi Andreas, 

We are glad to announce that our v19.1.65 patch release is rolled out; we have added the fix for reported issue. You can use the latest Syncfusion.Blazor NuGet package version.  
  
  
Screenshot : 
 
 
 
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 
  
Regards, 
Durga G 


Marked as answer
Loader.
Up arrow icon