Update values in realtime

Hello,
I'm displaying a candlestick chart and I want to be able to update it real time.
Actually I've bound the StockChartSeries DataSource to a property of my code behind class

DataSource="@klineSet.Klines"

now I've processes in place that update the Klines property updating the last Kline (so basically the last candlestick) or appending a new one when the interval passes
Calling StateHasChanged nothing happens.

How can I have a chart, updating data in real time, preserving current view settings (current zoom, range, etc..)?
thanks

4 Replies 1 reply marked as answer

FA Fabio Angela November 8, 2020 03:36 AM UTC

A little update
I succeeded at implementing an ObservableCollection and bind it, the problem is that's awful because the chart keeps flickering and my view gets resetted (if I zoom in a custom range, as soon as a value arrives chart gets restored to the starting view)

On top of that, from time to time I get this exception (Updates can happens even multiple times per seconds and this is when the exception happens)



System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
   at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
   at Newtonsoft.Json.JsonConvert.SerializeObjectInternal(Object value, Type type, JsonSerializer jsonSerializer)
   at Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.SerializeObject(Object value)
   at Syncfusion.Blazor.BaseComponent.CompareValues[T](T oldValue, T newValue)
   at Syncfusion.Blazor.BaseComponent.updateProperty[T](String key, T publicValue, T privateValue, Object eventCallback, Expression`1 expression, Boolean isDataSource, Boolean isObservable)
   at Syncfusion.Blazor.Charts.SfStockChart.OnParametersSetAsync()
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit 'b6yPZfI39piYPP_qnrdn0uvicqCV3h0XgwJIhBYD0Rw'.


SM Srihari Muthukaruppan Syncfusion Team November 9, 2020 12:54 PM UTC

Hi Fabio,  
   
We have analysed your query. From that, we have already considered this scenario as a bug and logged a bug request on this and you can keep track of it from the below feedback portal link.  
     
     
This fix will be available in any of our volume 4 release which is scheduled to be rolled out by the mid of December 2020. We appreciate your patience until then.  
   
Regards,  
Srihari M  



DG Durga Gopalakrishnan Syncfusion Team December 21, 2020 01:03 PM UTC

Hi Fabio,

We are working on reported issue. We will include the fix in our upcoming Volume 1 Main Release which is expected to be rolled out end of March 2021. We appreciate your patience until then.

Regards,
Durga G



DG Durga Gopalakrishnan Syncfusion Team April 4, 2021 04:34 PM UTC

Hi Fabio, 

We are glad to announce that our Essential Studio 2021 Volume 1 Main release v19.1.0.54 is rolled out and is available for download under the following link. 


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