Articles in this section
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;

 

WPF Chart with Custom Palette Color

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied