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

Observations on binding to nested collections

7 Answers 94 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Ronan
Top achievements
Rank 1
Ronan asked on 20 Oct 2010, 11:03 AM
Hi there,

We've using the CollectionIndex on a SeriesMapping to bind to nested collections. Due to constraints on our data we have had to implement our own Collections:

Outer Collection:
IList<dataAccessorObjectColumn>, IList, IEnumerator<dataAccessorObjectColumn>, IEnumerable, INotifyCollectionChanged

Where dataAccessorObjectColumn is the inner collection and implements
IList, IList<dataAccessorObjectValueWrapper>, IEnumerator, IEnumerator<dataAccessorObjectValueWrapper>, INotifyCollectionChanged

We have debugged the behaviour of the Telerik Chart when it iterates over the collections:

1. Telerik seems to nicely find the most specific implementation (i.e uses the Generic interface rather than the object interface). It also seems to iterate several times over the data - I'm not sure why this is? I have used debug printing to examine the behaviour with a single series of 5 data points, and found that the inner array was iterated over 5 times, however on larger data sets (10, 50) it was iterated over twice. As this does not hit the limit for the number of points before sampling occurs, the Average should not be needed, is this due to the interfaces we have placed on the collection?

2. If the outer collection does not implement the INotifyCollectionChanged interface, then no changes are detected. We have verified that the inner collection always has a null CollectionChanged event, so Telerik is not subscribing to the inner array. In our case, there will be very little change in the outer array (no new columns/series added), but a lot of traffic on the inner array (new values added/removed). Would it not be more efficient to listen to the inner arrays? Changesets can then be passed in using the NotifyCollectionChangedEventArgs. What is the most efficient way to notify from the outer Array that data has changed?

Yours,

Ronan

7 Answers, 1 is accepted

Sort by
0
Ronan
Top achievements
Rank 1
answered on 21 Oct 2010, 02:37 PM
Hi guys,

Any thoughts on this?

Why does Telerik not bind to the inner collection? Why are the collections iterated more than once?

Many thanks,

Ronan
0
Velin
Telerik team
answered on 25 Oct 2010, 04:46 PM
Hello Ronan,

Thanks for sharing your thoughts about RadChart.

Onto your questions:
  1. I suppose that you are adding data objects to the source after the control is data bound. This causes the chart control the rebind each time a change has occurred. This behavior is about to change in a future version of the control and for the time being, we would recommend you to data bind the control to a fully populated source.
  2. Indeed, the chart control does not automatically register for change notifications coming from the inner collections. The approach we suggest in this case is to use a collection that internally handles change notifications of its children. You can use the RadHierarchicalObservableCollection<T> and handle its ItemChanged event. Our development team could consider the possibilities to improve this behavior also.


Regards,
Ryan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ronan
Top achievements
Rank 1
answered on 26 Oct 2010, 10:08 AM
Thank you for your reply,

I like the product, and my concerns here are only about performance!

1. Yes we are, and cannot change this behaviour. We will also be adding new data over time, so we cannot pre-populate it.

2. I have written my own hierachical container, and am already binding to the inner collections from the outer collection, so the chart is displaying the data perfectly. I am concerned that this means that you can't perform optimisations on the refresh of the chart (detecting which points are added and removed). We are animating our data with a moving window so that there might be a lot of data in the chart, but only a few new points added. I do not know if your internal code takes advantage of the possibilities of using small change-sets rather than refreshing the entire graph, but if you do I'm pretty sure that you cannot leverage it when you do not bind to the inner collections.

Yours.

Ronan
0
Velin
Telerik team
answered on 28 Oct 2010, 04:44 PM
Hi Ronan,

You have correctly guessed that while using a hierarchical container it is hard to reflect changes happening in nested level data. In these cases the chart control fully redraws its content and this causes slowdowns when a large amount of data is shown. The development team is already working on a new data binding implementation so this problem should fade away in one of the upcoming releases of the control.

Kind regards,
Ryan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Garth Kidd
Top achievements
Rank 1
answered on 30 Aug 2011, 08:38 AM
Is that also true for RadTreeView? I'm not seeing it update given INotifyPropertyChanged advertisements from the ItemsSource of HierarchialDataTemplates… 
0
Petar Mladenov
Telerik team
answered on 01 Sep 2011, 02:32 PM
Hi Garth Kidd,

 Could you please elaborate more on your question so that we would be better able to assist you? As I managed to understand , your RadTreeView does not update visually when a change in the ViewModel (which implements INotifyPropertyChanged) is performed? Am I correct? If so, which is the property that you try to change, is the IsChecked/CheckState ? Is it possible for you to open a new support thread with a project attached so that we could investigate this issue ? Thank you for your cooperation in advance.

Kind regards,
Petar Mladenov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Garth Kidd
Top achievements
Rank 1
answered on 04 Sep 2011, 03:27 AM
G'day! Thanks for chasing up. 

I'm pleased to report that I traced back the problem to some underlying code not actually making the changes it was supposed to. I'm delighted that RadTreeView, unlike the native control, does heed collection change notifications. 

 â€“ Garth
Tags
Chart
Asked by
Ronan
Top achievements
Rank 1
Answers by
Ronan
Top achievements
Rank 1
Velin
Telerik team
Garth Kidd
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or