I have the following problem:
In our application we have a list of reports with sub categories defined at runtime...
The overall results of the report are shown in a ColumnSeries, which works fine. Now I have to show the results of the sub categories in a LineSeries for direct comparison, which won't work.
This is what I have so far (in code behind):
foreach (var item in ReportListViewModel.ReportSections)
{
var series = new LineSeries();
series.SetBinding(DataPointSeries.ItemsSourceProperty, new Binding("ItemList"));
series.IndependentValuePath = "Date";
series.DependentValuePath = item.BindingPath; // points to an existing entry in a Dictionary<string, double>
series.Title = item.Text;
chart.Series.Add(series);
}
It works fine, but once the data is loaded, I get a InvalidOperationException stating that no suitable axis for plotting the values is found.
The following works totally fine (even though it isn't exactly what I need):
foreach (...)
{
...
series.DependentValuePath = "Result" // Result is the dependent property of the ColumnSeries, and I tested it just to make sure it isn't me
...
}
I don't know what's different, but now it works...
foreach (var item in ReportListViewModel.ReportSections)
{
var series = new LineSeries();
series.SetBinding(DataPointSeries.ItemsSourceProperty, new Binding("ItemList"));
series.IndependentValuePath = "Date";
series.DependentValuePath = item.BindingPath;
series.Title = item.Text;
chart.Series.Add(series);
}