This is a migrated thread and some comments may be shown as answers.

Updating Timeline

4 Answers 45 Views
TimeLine
This is a migrated thread and some comments may be shown as answers.
Amige
Top achievements
Rank 1
Veteran
Amige asked on 06 Apr 2015, 06:08 PM

 Hello,

In my application I need to update the ItemsSource every few seconds, I would like to know what would be the best way to perform this.

I might have up to 600 items divides

I have an ObervableCollection object, every time I receive new data I clear the ObervableCollection object and then I add the new data, something like this:
 

ObservableCollection<myData> myCollection = new ObservableCollection<myData>();
  
// Format the data the way I need it
  
myCollection.Clear();
  
foreach (myObject item in DataObject)
{
  myCollection.Add(new myData()
    {
        property1 = item.property1,
        property2 = item.property2,
        property3 = item.property3
        // Operations for other properties
‚Äč
 
    });
}

I wonder if it would be better to update my ObervableCollection object (update existing items, add the new ones, and delete those that no longer exist) than clear and add all again.

What I want to achieve is to reduce the rendering time.

I hope you can give me some advice.

Thanks in advance,

Alberto

 

 

 

4 Answers, 1 is accepted

Sort by
0
Accepted
Petar Marchev
Telerik team
answered on 08 Apr 2015, 12:28 PM
Hi Amige,

When the items source changes in any way, the whole timeline is redrawn. This is due to various reasons, such as if the timeline uses grouping and an item changes - the number of groups or order of groups may change. So all previous items are released and new ones are created.

With this being said, we think that you will get the same performance in all cases. However, if you need to you can try both approaches and see if you detect any difference in the performance. Let us know if you need more information.

Regards,
Petar Marchev
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Amige
Top achievements
Rank 1
Veteran
answered on 08 Apr 2015, 04:05 PM

Hello Petar,

Thanks for claryfing me the way the timeline is redrawn.

I'll try the second approach and see if the performance improves a little.

Regards,

Alberto

0
Leland
Top achievements
Rank 1
answered on 05 Jan 2021, 03:17 PM
I am experiencing a significant performance hit to the application when I update the timeline every 2 seconds. I'm adding 2 items and removing 2 items from the ObservableCollection every 2 seconds at event end. The previous items are changing slightly in size as new items are added, which suggests that the entire view may be re-rendered. Can you confirm this to be the case?
0
Martin Ivanov
Telerik team
answered on 07 Jan 2021, 01:34 PM

Hello Leland,

Yes, changes in the ItemsSource of the control trigger redrawing of the items. I've tested the described scenario but the I wasn't able to notice a significant performance hit in my project. Can you check it out and let me know if I am missing anything?

Regards,
Martin Ivanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
TimeLine
Asked by
Amige
Top achievements
Rank 1
Veteran
Answers by
Petar Marchev
Telerik team
Amige
Top achievements
Rank 1
Veteran
Leland
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or