Category / Section
How to define the fill color for each datapoint in WPF Chart (SfChart)?
1 min read
WPF Chart (SfChart) provides option which enables you to define your own color brushes with your preferred order for the Palette, using ColorModel property. You can define the custom palette for series by using CustomBrushes property.
C#
Viewmodel view = new Viewmodel(); ColumnSeries columnSeries = new ColumnSeries(); columnSeries.ItemsSource = view.SneakersDetail; columnSeries.XBindingPath = "Brand"; columnSeries.YBindingPath = "No_Of_Items"; columnSeries.Palette = ChartColorPalette.Custom; //Adding colorModel to the series ChartColorModel colorModel = new ChartColorModel(); foreach (var item in view.SneakersDetail) view.SeriesColor.Add(item.SegmentColor); colorModel.CustomBrushes = view.SeriesColor; columnSeries.ColorModel = colorModel;