Skip to main content Skip to footer

How to Change the Color Palette

The ComponentOne Chart control for XAML includes 22 pre-defined color palettes. These palettes are the color scheme used for styling the plot elements. To choose one you just set the Palette property on the C1Chart control. Here's a graphic showing the 22 palettes by name. ChartPalettes You can also provide your own custom palette by setting the CustomPalette property. This is the preferred way to change the plot element colors because it also affects the legend items. Here is how you can create a custom palette in code:


c1Chart.CustomPalette = new SolidColorBrush[]  
   {  
     new SolidColorBrush(Colors.Red),  
     new SolidColorBrush(Colors.Yellow),  
     new SolidColorBrush(Colors.Orange),  
     ...  
   };  

Here is how you can create a custom palette in XAML:


<Style TargetType="c1:C1Chart">  
    <Setter Property="CustomPalette">  
        <Setter.Value>  
            <ResourceDictionary>  
                <SolidColorBrush x:Key="0" Color="#16ABA9"/>  
                <SolidColorBrush x:Key="1" Color="#EB7A2A"/>  
                <SolidColorBrush x:Key="2" Color="#F2CA04"/>  
                <SolidColorBrush x:Key="3" Color="#DC5B20"/>  
                <SolidColorBrush x:Key="4" Color="#8EBC00"/>  
                <SolidColorBrush x:Key="5" Color="#25A0DA"/>  
                <SolidColorBrush x:Key="6" Color="#25A0DA"/>  
                <SolidColorBrush x:Key="7" Color="#309B46"/>  
                <SolidColorBrush x:Key="8" Color="#24C6D2"/>  
                <SolidColorBrush x:Key="9" Color="#8A8065"/>  
            </ResourceDictionary>  
        </Setter.Value>  
    </Setter>  
</Style>  

If there are more series than brushes the brushes will repeat.

ComponentOne Product Manager Greg Lutz

Greg Lutz

comments powered by Disqus