Articles in this section
Category / Section

How to set the color for WPF Chart (SfChart) series?

1 min read

You can set the color for WPF Chart (SfChart) series using ColorModel property by adding custom brushes to ChartColorModel.

C#

ChartColorModel colorModel = new ChartColorModel();
colorModel.CustomBrushes.Add(new SolidColorBrush(Colors.Red));
colorModel.CustomBrushes.Add(new SolidColorBrush(Colors.RosyBrown));
colorModel.CustomBrushes.Add(new SolidColorBrush(Colors.RoyalBlue));
colorModel.CustomBrushes.Add(new SolidColorBrush(Colors.SaddleBrown));
colorModel.CustomBrushes.Add(new SolidColorBrush(Colors.Salmon));
chart.Series[0].Palette = ChartColorPalette.Custom;
chart.Series[0].ColorModel = colorModel;

XAML

<syncfusion:ColumnSeries  ItemsSource="{Binding TestingModel}" XBindingPath="X" YBindingPath="Y1" Palette="Custom">
     <syncfusion:ColumnSeries.ColorModel>
          <syncfusion:ChartColorModel>
               <syncfusion:ChartColorModel.CustomBrushes>
                     <SolidColorBrush Color="Red"/>
                     <SolidColorBrush Color="RosyBrown"/>
                     <SolidColorBrush Color="RoyalBlue"/>
                     <SolidColorBrush Color="SaddleBrown"/>
                     <SolidColorBrush Color="Salmon"/>
               </syncfusion:ChartColorModel.CustomBrushes>
           </syncfusion:ChartColorModel>
      </syncfusion:ColumnSeries.ColorModel>
</syncfusion:ColumnSeries>

 

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