Seamless operation with diverse data sources is paramount for any data visualization solution. RadChart already supports automatic data binding to IEnumerable sources as seen in this example: http://demos.telerik.com/silverlight/#Chart/DataBinding. With the growing of Silverlight data sources and support for various data services, however, a new scenario is becoming more common: data binding to a collection of collections or nested collections. I am glad to announce that a new feature is coming in the Q2 2009 release which will make this automatic.
Consider the following code snippet:
This method shows how to set up RadChart’s series mappings to activate the feature. The first three lines are simply code for creating the nested data and inserting it into a parent collection (an array in this case). Next, we create our series mappings as usual, but now we specify a new property - “CollectionIndex” which basically tells RadChart that its ItemsSource is a collection of collections and maps each nested collection to a particular data series. The next two lines are pretty standard and should not be a surprise to RadChart veterans as they simply map the numeric data to the YValues of the series. Finally, we set the mappings and data to the chart and we’re done!
Simple, isn’t it? Let us know what your most common business scenarios are and what data source you use with RadChart most often. As always we will try to make things easier for you.
Vladimir Milev is a developer manager.