Hi team,
I am trying to create StackingColumnSeries dynamically. I have a number of categories for which I want to show Column Chart where on X axis is time (months) and Y shows some amount of data. So there should be stacked columns for each month. In each column I want to display stacked columns for each available category. However the number of categories it not known before runtime.
Is there a way how to dynamically add StackingColumnSeries for each category in code, instead of XAML markup?
I have tried to add it like this, based on your demo:
var temp = new StackingColumnSeries
{
ItemsSource = ColumnViewModel.MedalDetails2,
XBindingPath = "CountryName",
YBindingPath = "GoldMedals",
AdornmentsInfo = new ChartAdornmentInfo
{
ShowMarker = false,
ShowLabel = true,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Bottom,
}
,
Label = "asdsd"
};
stColumnChart.Series.Add(temp);
However this does not seam to work. I have also pointed the DataContext of the whole chart to the ColumnViewModel. Nothing is displayed on the chart.
Thank you for your help!
Petr