views:

433

answers:

1

Is it possible to have a dynamic number of series for a WPF toolkit line chart? Every example I find declares the series manually.

I want to be able to have this type of data:

ObservableCollection<ObservableCollection>ChartPoint>>

When I add or remove ObservableCollections to the main OC, the chart should add or remove series.

I have been successful in adding or removing series in code-behind, but this is not ideal. I end up manually subscribing to change events on the outer OC.

A: 

It would be neat wouldn't it? But alas currently this isn't possible. At least not in any typical manner. We would need the Chart to have an ItemsSource property and allow us to use a DataTemplate to describe the series we would want it use for each item.

It may be possible to create an Attached property to act as an ItemsSource property. Its something I've been considering but haven't got round to implementing yet.

Edit:

One day later and the October 2009 Toolkit is released with unsealed charting classes. Perhaps now a sub-classed Chart with an ItemsSource property is possible.

AnthonyWJones