IChartSeriesModel.Changed event fires off very slowly

Hi

I implemented IChartSeriesModel in a candlestick chart.

My data source in my model is List where Bar is a poco object containing a datetime, and doubles for HLOC.

I subscribe to the IChartSeriesModel.Changed event from the calling class. Then handler is an empty function, because I just want the chart to update.

When I update my model and fire off Changed, the chart updates accordingly, However, the chart updates very slowly.

My app is trying to update the chart with each tick about 500 times per second.

But when I run diagnostics on Change.Invoke, it takes about 100 ms each time. I ran diagnostics on the code leading up to this line and everything else was fast except this.


What can I look at to make it fire and update faster?


Please let me know if you need other info.



7 Replies 1 reply marked as answer

GM Gayathri Manickam Syncfusion Team January 27, 2022 04:04 PM UTC

Hi Lorenzo, 
 
Currently we are validating the reported query and we will update the complete details by tomorrow (28th January 2022). 
 
Regards,  
Gayathri M 



GM Gayathri Manickam Syncfusion Team January 29, 2022 12:16 PM UTC

Hi Lorenzo, 
 
We analyzed your query and tested the reported issue ChartSeriesModel event fires very slowly based on the provided details and it was working fine at our end. We cannot know your exact use case scenario since couldn’t replicate the reported issue at our end. For improving performance of the chart, please refer the below UG link. 
 
 
If possible, could you please revert us by modifying the provided sample based on your exact use case scenario or share us the chart code snippet details which will be helpful to provide better solution at the earliest.  
 
 
Regards,  
Gayathri M 



LO Lorenzo February 1, 2022 02:14 AM UTC

Hi Gayathri,


I experimented with the sample and found some hints.

I tried to zip the entire solution but it was too big (maybe because vs 2022 forced me to upgrade the solution to .net framwork 4.8), so I just uploaded a zip with the Form1.Designer.cs file.


I made some significant changes including adding an async call to update hourly bars with 'ticks' and then add a new bar after each hour is complete.


But the behavior really starts to show itself when:


1) I set Indexed to true. (I still need this behavior because I cannot have weekend gaps).

2) I add 3000-4000 starting bars to the chart (experiment with the startingBars variable on line 73, see how fast it updates when you set it to 40 vs 4000 or more)


I know that setting Indexed = false will improve performance, but 1 - I can't have weekend gaps, 2) you will see that if you set Indexed = false and run it, the behavior will be really weird where the active bar kind of 'walks from left to right'.

I feel like a few thousand bars is a really small number to be diminishing the performance of the chart. Shouldn't the chart be able to handle much more than that?



Attachment: Form1.Designer_7ed5b13b.zip


DD Devakumar Dhanapoosanam Syncfusion Team February 2, 2022 01:25 PM UTC

Hi Lorenzo, 
 
Currently we are validating the reported query with the provided details at our end, and we will update the complete details by February 4, 2022. 
 
Regards, 
Devakumar D 



YP Yuvaraj Palanisamy Syncfusion Team February 4, 2022 12:32 PM UTC

 
Thanks for your patience. 
 
The DateTime type axis is a value based axis. Since, candle segments are rendered to the corresponding datapoint(datetime) value with gaps for weekends and holidays . We can set the Indexed property value as true for drawing the segments without any gaps but it affects the performance.  
 
To resolve this, we would like to suggest that to use the IChartSeriesIndexedModel instead of IChartSeriesModel to improve the performance with large number of datapoints. Also need to update the axis label, with the help of ChartFormatAxisLabel event of ChartControl. We have attached the complete sample for your reference. Please find the sample from the below link. 
 
 
Please let us know if you have any further assistance. 
 
Regards, 
Yuvaraj 



LO Lorenzo February 6, 2022 11:45 AM UTC

Thanks All,


I did some deeper research, and the true solution is that winforms is the wrong approach when one wants very fast constant updates to controls, because it runs on the Windows message loop, which will always run into issues for fast updates. The better solution is WPF because it uses DirectX.


I got the hint from this 

c# - How do you update a datagrid (or any other UI control) continuously without freezing the UI? - Stack Overflow


Thanks again everyone.


Marked as answer

DD Devakumar Dhanapoosanam Syncfusion Team February 7, 2022 07:34 AM UTC

Hi Lornezo, 
 
Thanks for the update and we are glad to know that you have found solution. 
 
Please let us know if you need any further assistance on this. 
 
Regards, 
Devakumar D 


Loader.
Up arrow icon