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

ChartSeriesDataSource throwing ArgumentOutOfRangeException during data binding

5 Answers 24 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 26 Mar 2016, 11:34 PM
I have a custom queue-like collection that implements INotifyCollectionChanged and IList<>. Rather than raising CollectionChanged for every Enqueue() operation, it raises CollectionChanged once for every 5 Enqueue() operations: NotifyCollectionChangedEventArgs.NewItems contains a list of the 5 items added since the last CollectionChanged call, and NotifyCollectionChangedEventArgs.NewStartingIndex is set to my collection's Count property - 5.

This collection is being used as a data binding source to a RadCartesianChart with a DateTimeContinuousAxis. Unfortunately, when my collection raises CollectionChanged, an ArgumentOutOfRangeException is thrown out of ChartSeriesDataSource.GenerateDataPoint(). It appears that ChartSeriesDataSource's internal List<> is out of sync with my collection. NotifyCollectionChangedEventArgs.NewStartingIndex lies within my collection, but is several indices (1-4) beyond the end of ChartSeriesDataSource's internal List<>. 

Questions:

1. Does ChartSeriesDataSource (and ChartView generally) play nicely when it receives a NotifyCollectionChangedEventArgs.NewItems that contains more than one item? Especially if the source collection already contains data when the data binding is set up?

2. If not, is there another way to throttle ChartView's updates?

5 Answers, 1 is accepted

Sort by
0
Accepted
Martin Ivanov
Telerik team
answered on 29 Mar 2016, 08:21 AM
Hi Eric,

The chartview doesn't support adding a range of items and currently such implementation is not included in our planning. In order to resolve the exception you will need to add the items one by one.

Regards,
Martin
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Eric
Top achievements
Rank 1
answered on 30 Mar 2016, 10:14 PM
OK, a follow-up question then: does ChartView perform better when its source collection implements IList and/or IList<>, compared to simply IEnumerable? (This is the case in other parts of WPF, but I don't see a specific mention of it in the ChartView docs.)
0
Martin Ivanov
Telerik team
answered on 04 Apr 2016, 12:18 PM
Hello Eric,

RadChartView is working with any collection that implements the IEnumerable interface. I hope that answers your question.

Regards,
Martin
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Eric
Top achievements
Rank 1
answered on 04 Apr 2016, 04:40 PM

My question is whether ChartView performs better with a collection that implements IList, versus a collection that only implements IEnumerable. 

The docs for several other Telerik controls specifically mention that IList data sources perform better than IEnumerable data sources. Examples include RadListBox and RadGridView, both of which state: "If the scenario requires a custom collection to be implemented, use the IList interface, which provides individual access by index to its items and the best performance."

Is this also the case for RadChartView?

0
Accepted
Martin Ivanov
Telerik team
answered on 05 Apr 2016, 06:23 AM
Hi Eric,

No, the chart itself won't benefit much if you use IList instead of IEnumerable. If there is any performance difference it will came from the collection implementation itself and it won't be noticeable.

Regards,
Martin
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
ChartView
Asked by
Eric
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Eric
Top achievements
Rank 1
Share this question
or