WPF charts with real time updates are too slow to be usable

I am working on an application to show EEG measurements in real time.  I need to have a window with 8 or 16 different charts, one for each channel.

I followed the example code for real time charts, including the suspend and resume updates handling.  It works well enough for up to two channels of data; the two charts draw quick enough that you get about 5Hz update rate.  However, once you have eight charts drawing, the update rate slows down to less than 1Hz. I have not even bothered trying it with the max load of 16 channels.

I thought it was something in my code, so I went back to the sync fusion sample for real time charts and modified the sample to have 8 charts with one series (instead of one chart with 3 series), and also modified the sample to extend the amount of data plotting to be similar to my situation (I am trying to show 8 charts with 10 seconds of EEG data at 250 samples/second, therefore I am trying to plot 2500 points on 8 charts with each cycle).

The sync fusion example code runs almost as slow as my code when trying to plot 8 charts.  It runs at over 20% CPU on my machine and struggles to update at 2 Hz or better.

I suspect that one of the big performance problems is the binding to the data source.  Is there a way to use SYncFusion charts for real time updates without binding.  Can I set the data series directly in code to get it to work faster?

FWIW, I have the same code running in a Xamarin Forms mobile app on Android and the chart drawing time is much faster (although on Android you can only 'see' four charts at at time on the screen, so maybe this is a factor).

Any insight or help is appreciated



Attachment: GBsSample_HowtocreatearealtimeChartwithWPFmaster_ef4075d6.zip

7 Replies

YP Yuvaraj Palanisamy Syncfusion Team January 4, 2021 04:41 PM UTC

Hi Graham,  
   
Greetings from Syncfusion.  
   
We have analyzed your query and we have checked with your sample; it was working fine at our end. Also, we have checked the CPU usage and memory in your sample and there is no performance problem while rendering the EEG sample. Also, please refer to the below steps to optimize the chart performance for live data for your reference,
 
 
 
·       Set the StrokeWidth of FastLineBitmapSeries to “1” by default value of it “2”.      
·       Set the EnableAntiAliasing property as false for FastLineBitmapSeries  
   
Configuration Detail: Visual Studio 2019 version 16.5.0 with .NET Framework Version 4.8.0.03752  
   
Could you please share with us the video clip about this and tested VS environment configuration, which is helpful in providing you a better solution at the earliest.  
 
Regards, 
Yuvaraj. 



GR Graham January 7, 2021 02:24 AM UTC

Yuvaraj

Thank you for your prompt reply.

Please see this video for a more detailed look at what I am seeing.


In the video, you will see the performance on my machine of the Syncfusion charts, and then a different component I tried to draw graphs with more or less the same code. You will notice that Syncfusion charts update slower than 5Hz with one chart window open, and at less than one Hz with three chart windows open.  Using the other component, you will see five Hz update with three windows open.  Also, at the end of the video you will see the other component doing 10Hz updates with two graph windows open (something I did not try with the Syncfusion chart).

I am using Visual Studio 16.8.2 with .NET framework 4.8.04084.  I am running this on a windows virtual machine on a Mac mini using Parallels (configured with 6 processors from 3.2 GHz 6-Core Intel Core i7  and 32 GB of Ram ) 

I have updloaed the SyncfusionGraphWindow.xaml and .cs file and also the GraphWindow.xaml and cs file where the other component is used.  If you can recommend any changes to the code to optimize it this would be appreciated. I would like to use the Syncfusion component because I am using it on Android (where it works well enough - you may see the last minute of this video for a look). However, I need it to be able to draw four graph windows at 5Hz or better without totally consuming all the CPU for it to be viable for the WPF application.

I thank you for your time and attention.

GB

Attachment: GraphWindows_860efbc2.zip


GR Graham January 7, 2021 02:39 AM UTC

Additional comment.  In the video you see the FastLineSeries.  I had previously tried the FastLineBitmapSeries.  It draws just a bit faster but it does not look as good as the line series.  Please see the attached screen shots.

I went back and tried the FastLineBItmap series with the settings you recommend below.  This improved the drawing speed somewhat, but CPU usage is even higher (70% with three graphs open, and getting about 2Hz redraw rate).

Thank you

GB


Attachment: FastBitmapVsFastLine_bb6a6d86.zip


YP Yuvaraj Palanisamy Syncfusion Team January 7, 2021 01:48 PM UTC

Hi Graham, 
 
Thank you for sharing the video clip for chart CPU usage. 
 
Currently we are validating this reported problem “CPU usage for WPF Chart” and we will update you with complete details on or before 8th January 2021. 
 
Regards, 
Yuvaraj. 



YP Yuvaraj Palanisamy Syncfusion Team January 8, 2021 12:40 PM UTC

Hi Graham, 
  
On further analysis we have already considered this “CPU usage for WPF Chart” as feature request and this feature will be available in any of our upcoming releases.   
  
Please track this feedback link to know the status of this feature  
 
We will prioritize the features every release based on the demands and we do not have an immediate plan to implement this since we committed with already planned work. So, this feature will be available for any of our upcoming releases. 
  
Please cast your vote to make it count and If you have any more specifications/suggestions to the feature request, you can add it as a comment in the portal.        
  
Regards, 
Yuvaraj. 



GR Graham January 9, 2021 01:10 AM UTC

Yuvaraj

Thank you for the follow up.  I want to praise you and your team for top notch customer support.  The quality of discussion on this forum and the samples you promptly provide for customers is really excellent.

I will watch for updates and check back if drawing speed improves in a future version.  I will also continue to fiddle with my code to see if there is something I can do to optimize the filling of the observable collection with updated data to draw.

Best Regards

GB


YP Yuvaraj Palanisamy Syncfusion Team January 11, 2021 10:09 AM UTC

Hi Graham, 
 
Thanks for your update. 
 
As we informed you earlier for Optimize the CPU usage for WPF Chart, please track this feedback link to know the status of this feature and this feature will be available in any of our upcoming release. 
 
 
Regards, 
Yuvaraj 


Loader.
Up arrow icon