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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Performance issue when we reload the bounded data structure

Thread ID:

Created:

Updated:

Platform:

Replies:

142781 Feb 19,2019 05:34 PM UTC Feb 20,2019 09:09 PM UTC WPF 1
loading
Tags: SfDateTimeRangeNavigator
Sascha
Asked On February 19, 2019 05:34 PM UTC

Hi Syncfusion Support!

We noticed a performance issue when we have to reload the data structure behind our SfDateTimeRangeNavigator.

The performance is very well with the SfCharts. Most of the time we usSuspendSeriesNotification() and Resume method.

Is there a similar supportive set of methods for the SfDateTimeRangeNavigator available? 

Thank you!

regards,
Sascha


Samuel Rajadurai Edwin Rajamanickam [Syncfusion]
Replied On February 20, 2019 09:09 PM UTC

Hi Sacha, 
  
Greetings from syncfusion, 
  
SfDateTimeRangeNavigator does not support suspend notification. We can still achieve this using a temporary collection to handle the dynamic data and a current collection to update the SfDateTimeRangeNavigator. The following code snippet demonstrates to achieve your requirement. We have also attached a sample based on this. 
  
Code Snippet 
 
XAML 
 
        <chart:SfDateTimeRangeNavigator Grid.Row="1" XBindingPath="XValue” ItemsSource="{Binding CurrentData}"/> 
 
 
  
C# 
ViewModel 

    public class ViewModel 
    { 
        public ViewModel() 
        { 
            var date = new DateTime(2019, 1, 1); 
            TempData = new ObservableCollection<Model>(); 
            CurrentData = new ObservableCollection<Model>(); 
 
            CurrentData.Add(new Model() { XValue = date.AddDays(0), YValue = 20 }); 
            CurrentData.Add(new Model() { XValue = date.AddDays(1), YValue = 10 }); 
            CurrentData.Add(new Model() { XValue = date.AddDays(2), YValue = 40 }); 
            CurrentData.Add(new Model() { XValue = date.AddDays(3), YValue = 30 }); 
        } 
 
        public ObservableCollection<Model> TempData { get; set; } 
        public ObservableCollection<Model> CurrentData { get; set; } 
    } 


  
Data Manipulation 

    public partial class MainWindow : Window 
    { 
        Random randomVariable = new Random(); 
        DateTime lastDate = new DateTime(); 
 
        // Timer to load dynamic data. 
        DispatcherTimer timer; 
        ViewModel viewModel; 
 
        public MainWindow() 
        { 
            InitializeComponent(); 
            timer = new DispatcherTimer(); 
            timer.Tick += Timer_Tick; 
            timer.Interval = TimeSpan.FromMilliseconds(100); 
            viewModel = this.DataContext as ViewModel; 
        } 
 
        private void Timer_Tick(object sender, EventArgs e) 
        { 
            var itemsSource = viewModel.TempData; 
 
            // Gets the last date from the collection. 
            if (itemsSource.Count > 0) 
            { 
                lastDate = itemsSource[itemsSource.Count - 1].XValue; 
            } 
            else 
            { 
                lastDate = viewModel.CurrentData[viewModel.CurrentData.Count - 1].XValue; 
            } 
 
            itemsSource.Add(new Model() { XValue = lastDate.AddDays(1), YValue = randomVariable.Next(10, 40) }); 
        } 
 
        private void StartTimerButton_Click(object sender, RoutedEventArgs e) 
        { 
            timer.Start(); 
        } 
 
        private void EndTimerButton_Click(object sender, RoutedEventArgs e) 
        { 
            timer.Stop(); 
        } 
 
        private void UpdateButton_Click(object sender, RoutedEventArgs e) 
        { 
            var viewModel = (this.DataContext as ViewModel); 
 
            foreach (var tempData in viewModel.TempData) 
            { 
                viewModel.CurrentData.Add(tempData); 
            } 
 
            viewModel.TempData.Clear(); 
        } 
    } 


  
Regards,
Samuel 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon