productionSeries = new StackedAreaSeries();
.
.
.
foreach (IEnergyConverter conv in model.GetProducer())
{
SeriesDefinition ser = new SeriesDefinition //creating a new seriesdefinition
{
Title = conv.Name,
IndependentValuePath = "X_Value",
DependentValuePath = "Y_Value"
};
productionSeries.SeriesDefinitions.Add(ser); //Add to the StackedAreaSeries
producerSources.Add(new ObservableCollection<Datapoint>()); //producerSources holds the Data that is updated during execution
ser.ItemsSource = producerSources.Last(); // Data Binding
}
.
.
.
View.chart.Series.Add(productionSeries);
This is what i got so far. I am adding 5 SeriesDefinitions to "productionSeries" and they are displayed fine: the first is at the bottom and the following stacked upon. My problem now is that the legend orders the items in the same way as they were added. So the first SeriesDefinitions which is at the bottom in the diagram appears in the legend at the top.. So is it reversed and looks confusing. Is there a way to reverse the legend items or to rearrange them somehow?
I havent found anything about this problem and as far as I know unfortunately there is no documentation of the WinRTXaml Toolkit.
I hope somebody can help me out here or has a tip, thanks.
The code itself is going to be your main documentation, I'm afraid. Two main ways I see for addressing this are - change the order legend items are added (in the control itself - you'll need to change the code of the data visualization controls) or change the order in which they're displayed by replacing the
StackPanelthat's most likely used there right now with some kind of aReverseOrderStackPanelimplementation. A third way might be to draw your own legend and a fourth one might be to iterate through the visual elements once they're generated and reorder them by manipulating the visual tree.Ultimately, while the controls do support some customization, I recommend using Win2D to draw your own charts if you want more customized visualization or better performance.