Set ListenPropertyChange for individual datapoints?

Hi, I have a chart consisting of multiple fast type series which have a fixed number of datapoints of about 100,000. The last 400 datapoints will change during the time the application is running, no additional datapoints will be added.

In this scenario, especially with multiple charts, setting the series ListenPropertyChange to true will cause long loading times for the charts. Since most of the datapoints will not change, is it possible to set ListenPropertyChange to true only for the last 400 datapoints? This will speed up the loading time by about 99.5%.

Thanks.

7 Replies

SR Samuel Rajadurai Edwin Rajamanickam Syncfusion Team June 26, 2018 06:07 AM UTC

Hi Tom, 
  
We have analyzed your query and we suspect that are you are using FastStepLineBitmapSeries in your sample. If yes means you can improve the performance with the suspend notification feature and by setting the StrokeThickness as 1 for the series as per the below code snippet.  
  
Code Snippet 
  
XAML 
 
<chart:FastStepLineBitmapSeries StrokeThickness="1"/> 
 
 
  
C# 
 
    public partial class MainWindow : Window 
    { 
        public MainWindow() 
        { 
            InitializeComponent();             
        } 
     
        private void DataModifyButton_Click(object sender, RoutedEventArgs e) 
        { 
 
            foreach (var series in this.chart.Series) 
            { 
                this.chart.SuspendSeriesNotification(); 
 
                // Data point modifications. 
 
                this.chart.ResumeSeriesNotification(); 
            }         
        } 
    } 
 
 
Please let us know if you are still facing any issue in this. 
  
Thanks, 
Samuel 



TO Tom June 26, 2018 04:35 PM UTC

Hi Samuel, every time you perform a SuspendSeriesNotification or ResumeSeriesNotification the UI freezes for a moment. I've measured the time this takes, and found out that your method actually takes longer than simply keeping ListenPropertyChange set to true from the beginning.


MK Muneesh Kumar G Syncfusion Team June 27, 2018 06:57 AM UTC

Hi Tom,  
 
We have analyzed your query and we have checked this scenario with our sample, it has not freeze while updating data. We suspect that are not using our latest version (16.2.0.41) in your application. So please update us the SfChart version and series type which is used in your application 
 
Also, please check with the sample in the following location. If still you face the problem, please revert us by modifying the sample based on your application along with replication procedure. This would be helpful for us to serve you. 
 
 
Please let us know if you have any queries.  
 
Thanks, 
Muneesh Kumar G. 



TO Tom July 1, 2018 10:02 AM UTC

Hi Muneesh, I'm using the latest .41 version.

There are two issues here, the time it takes to create the series when ListenPropertyChange is set to true, which is the issue I raised in the opening post, and the time it takes to modify datapoints, which is a separate issue.

Please use the attached modified sample to verify (converted to VB). The sample contains a single series with 5,000,000,000 datapoints to make it easier to analyze. Only a single datapoint is modified at a time, for example once per minute for a total of 400 datapoints per day.

Issue 1: How ListenPropertyChange affects the time it takes to create a series. When ListenPropertyChange is set to false, it takes 1,100 ms to create the series, and 3,440 ms when set to true. Now, if there was a way to set ListenPropertyChange to true only for the datapoints that need it (the last 400), the series would be created in only 1,101 ms instead of 3,440 ms. Perhaps this capability could be implemented in a future release?

Issue 2: How SuspendNotification/ResumeNotification affects the time it takes to modify the datapoints of a series. ListenPropertyChange is set to true. When you run the sample, it takes 7,475 ms to modify a single datapoint. When you comment out the SuspendNotification and ResumeNotification lines, it takes only 49 ms. Therefore, SuspendNotification/ResumeNotification is the wrong choice when modifying a single datapoint, but might be the correct choice when you need to modify many datapoints at once.

Attachment: sfChartListen2_fa3cc252.rar


MK Muneesh Kumar G Syncfusion Team July 2, 2018 10:41 AM UTC

Hi Tom, 
 
Issue 1: We have analyzed your requirement and we would like to inform you that currently we don’t have direct support for enable INotifyPropertyChanged for particular model data. So, we have achieved your requirement by raising INotifyPropertyChanged for last model data only in sample level and updated the data calculation by calling SetIndividualPoint method in FastStepLineBitmapSeries extension class.  
 
Code snippet [XAML]: 
 
Dim data As ObservableCollection(Of Model) = Nothing 
        data = TryCast(series.ItemsSource, ObservableCollection(Of Model)) 
        Dim changed As INotifyPropertyChanged = TryCast(data.Last, INotifyPropertyChanged) 
 
        If changed IsNot Nothing Then 
            AddHandler changed.PropertyChanged, AddressOf OnItemPropertyChanged 
        End If 
 
        'series.SuspendNotification() 
 
        data.Last.YValue = 150 
 
        'series.ResumeNotification() 
 
        Console.WriteLine("time to modify data: " & sw.ElapsedMilliseconds) 
 
    End Sub 
 
    Private Sub OnItemPropertyChanged(sender As Object, e As PropertyChangedEventArgs) 
        series.SetIndividualPointData(viewModel.Data.Count-1, sender) 
    End Sub 
End Class 
 
Public Class FastStepLineBitmapSeriesExt : Inherits FastStepLineBitmapSeries 
 
    Public Function SetIndividualPointData(ByVal position As Double, ByRef sender As Object) 
 
        SetIndividualPoint(position, sender, True) 
        UpdateArea() 
 
    End Function 
End Class 
 
We have modified your sample based on this, please find the sample from the following location.  
 
 
Issue 2: Yes. SuspendNotification/ResumeNotification method used to avoid data update inside chart series synchronously for each update. For single data point update, you can use without these methods.  
 
Please let us know if you have any queries.  
 
Thanks, 
Muneesh Kumar G. 



TO Tom July 3, 2018 02:49 PM UTC

Muneesh, this is fantastic! With this solution, not only is the creation time for the series been reduced by 50%, but the time to modify a single datapoint has been reduced by a whopping 85%. I've slightly modified your solution by adding a ModifyIndex variable to the viewmodel to allow for the modification of any datapoint, not just the last one. This is really improves performance for real time updates of large data sets.


MK Muneesh Kumar G Syncfusion Team July 5, 2018 04:02 AM UTC

Hi Tom, 

Thanks for the update.

We are glad to know that the given solution works. Please let us know if you need any further assistance.

Thanks,
Muneesh Kumar G.

Loader.
Up arrow icon