How can I dynamically create a stacked column series? I'm setting AutoGenerateSeries="true", but unable to find where I can define the KeyMemberPath or ValueMemberPath. Also, I don't need to use the ig:GroupBy resource because we already calculate the totals in SQL before it hits the app. Is there another resource setting I can create to assign these objects appropriately?
Hello PMac,
Auto-generation in the StackedColumnSeries requires the usage of a GroupBy ItemsSource, as the StackedColumnSeries does not have an inbuilt KeyMemberPath or ValueMemberPath.
Instead, when using a traditional list of objects, you are expected to populate the StackedColumnSeries.Series collection with StackedFragmentSeries objects. These StackedFragmentSeries objects have a ValueMemberPath property that you can set corresponding to the underlying data items that exist in the collection used for your ItemsSource. The "Key" in this case will correspond to the category which is bound to your CategoryXAxis' Label property. For example, if you had a Label setting in your CategoryXAxis of "{}{Country}," the key would be the underlying Country property on the data items that are bound to the ItemsSource of your chart.
So, in order to dynamically create a StackedColumnSeries, I would recommend looping through each of the properties that you are looking to create a column fragment for, create a StackedFragmentSeries for each, and add it to the StackedColumnSeries.Series collection.
I hope this helps. Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer
Okay great, thank you for the reply. I'm trying to stick with the MVVM architecture, so the latter option may be tough to plug. I'll unhinge the groupby in SQL and use the groupby resource to construct the member-value objects. Was hoping for another option but this should work. Thanks!