We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

incremental update of the SFChart ItemsSource

Hello,

I am currently implementing a monitor, which displays waveforms  like in an oscilloscope. For this purpose I used the SFChart and created an ObservableCollection, which holds the data. I use the ObservableCollection like a ring buffer. This means its items don't change (because I don't remove or add items). Only the data inside of the list items changes over time. Because of that having an ObservableCollection is almost useless, since the PropertyChanged event only fires when items are added or removed. To update my SfChart nevertheless, I currently set the ItemSource = null and then again to the changed ObservableCollection. This forces a complete redraw of the chart. While this solution works, I have a few problems with that:
  • The garbage collection works almost the whole time, because of the huge amount of data I discard and reassign.
  • The redraw process takes more CPU load than necessary.

Is there a way to only update parts of the ItemSource in a SfChart? If yes, would it be possible to animate this?

Thanks,

Janosch


3 Replies

SJ Sumathi Jayaraj Syncfusion Team January 27, 2016 10:49 AM UTC

Hi Janosch,

Thanks for contacting Syncfusion support.

We are able to achieve your requirements by using "ListenPropertyChange" property in the ChartSeries and INotifyPropertyChanged in the Model class. Please find the sample code of this property.

Code example[XAML]:



<!--Listen property change is used to call OnPropertyChanged of property when that property value is changed-->

<chart:FastLineSeries StrokeThickness="2" ListenPropertyChange="True" XBindingPath="Period"
                    YBindingPath="Value" x:Name="series"/>


We have prepared a sample for your requirements and please find the sample in the following location.

SampleOscilloscope


Please find the following link for more information.

Link: http://help.syncfusion.com/wpf/sfchart/performance


Regards,
Sumathi J



JK Janosch Kunczik January 27, 2016 01:20 PM UTC

Sumathi,

Thank you for the excellent help!

Regards,

Janosch


SJ Sumathi Jayaraj Syncfusion Team January 28, 2016 04:09 AM UTC

Hi Janosch,

Thanks for the update. Please let us know if you have any queries.

Regards,
Sumathi J

Loader.
Up arrow icon