Hello,
is it possible to change the color of the bars and the title of the legend when the chart is already created and displays chart data?
Currently I use the "SeriesCreated" event to do this, but need to change these properties when the user sets new data.
private void StackedColumnSeries_SeriesCreated(object sender, StackedSeriesCreatedEventArgs e) { if (_classInfos == null) return; StackedFragmentSeries series = sender as StackedFragmentSeries; Brush columnBrush = Brushes.Transparent; Brush outlineBrush = Brushes.Gray; string title = lang.Default_Label_NotAvailable; //Info: The series.ValueMemberPath contains the Group Number (ClassId) + _ as prefix. e.g. "0_Value" string[] vals = series.ValueMemberPath.Split('_'); if (vals.Length > 1) { Guid classId = Guid.Empty; ObjectClassificationConfig classInfo; Guid.TryParse(vals[0], out classId); _classInfos.ContainsKey(classId); if (_classInfos.TryGetValue(classId, out classInfo)) { columnBrush = new SolidColorBrush(classInfo.Color); outlineBrush = new SolidColorBrush(ImageUtils.MakeDarker(classInfo.Color, 60)); title = classInfo.Label; } } e.Brush = columnBrush; e.Outline = outlineBrush; e.Title = title; }
When the user sets new data you will need to iterate through the StackedBarSeries.Series collection and set the properties.
How to access the StackedFragmentSeries object within the StackedColumnSeries, in order I can set the required properties?