WPF Charting Documentation - SciChart WPF Charts SDK v5.x
Overriding Colors of our Themes

Override Theme Colors

Maybe you don’t want to create an entire custom theme, but just want to override one color or brush from one of our standard themes. You can do that too!

For example, the SciChartv4Dark.xaml theme looks very sleak but maybe you want to change the accent color from Green to Orange. You can override just a few brushes from the IThemeColorProvider type for this theme and apply to all charts as follows.

XAML

Override Theme Colors
Copy Code
<!-- Where xmlns:s="http://schemas.abtsoftware.co.uk/SciChart" -->
<!-- Omitted RenderableSeries for brevity -->
<s:SciChartSurface s:ThemeManager.Theme="SciChartv4Dark">

       <s:SciChartSurface.XAxis>
             <s:NumericAxis AxisAlignment="Bottom" AxisTitle="Left XAxis" />
       </s:SciChartSurface.XAxis>

       <s:SciChartSurface.YAxis>
             <s:NumericAxis AxisAlignment="Left" AxisTitle="Top YAxis" />
       </s:SciChartSurface.YAxis>

       <s:SciChartSurface.ChartModifier>
             <s:ModifierGroup>
                    <s:RolloverModifier/>
             </s:ModifierGroup>
       </s:SciChartSurface.ChartModifier>
</s:SciChartSurface>

Code Behind

Override Theme Colors
Copy Code
// Pass a theme name string to get the ThemeColorProvider for that theme
// A list of allowable theme names includes SciChartv4Dark, ExpressionDark,
// ExpressionLight, Oscilloscope, Electric, BlackSteel, Chrome and BrightSpark
IThemeProvider tcp = ThemeManager.GetThemeProvider("SciChartv4Dark");

// Now change some of the brushes.
// This will change the brushes globally for all charts which use this theme
tcp.TickTextBrush = new SolidColorBrush(Colors.Orange);           
tcp.CursorLineBrush = new SolidColorBrush(Colors.Orange);
tcp.RubberBandFill = new SolidColorBrush(Color.FromArgb(0x55,0xFF,0xA5,0x00));
tcp.RubberBandStrokeBrush = new SolidColorBrush(Color.FromArgb(0x99, 0xFF, 0xA5, 0x00));
tcp.CursorLabelBackgroundBrush = new SolidColorBrush(Color.FromArgb(0xAA, 0xFF, 0xA5, 0x00));
tcp.CursorLabelBorderBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xA5, 0x00));
tcp.RolloverLabelBackgroundBrush = new SolidColorBrush(Color.FromArgb(0xAA, 0xFF, 0xA5, 0x00));
tcp.RolloverLabelBorderBrush = new SolidColorBrush(Color.FromArgb(0xAA, 0xFF, 0xA5, 0x00));
tcp.RolloverLineStroke = new SolidColorBrush(Colors.Orange);// etc...

This results in the following:

                                                                         

                                                                                             Before adjusting Theme Colors                                                                     After adjusting Theme Colors

 

 


SCICHART ® is a Registered Trademark in the UK, US and EEC. Copyright SciChart Ltd 2011-2018.

Email us to give feedback!