Override OxyPlot default color palette

stoic picture stoic · Mar 23, 2015 · Viewed 7.3k times · Source

I've been making use of OxyPlot lately, and was wondering if there is a way of overriding the default Color Palette of PlotSeries / PlotModel?

I know i can set the color individually for each series, but it would be nice to have an array of color and then apply it to the model / series.

Answer

forallepsilon picture forallepsilon · Apr 24, 2015

You can change the DefaultColors list in PlotView's Model:

plotView.Model.DefaultColors =  new List<OxyColor>
        {
            OxyColors.Red,
            OxyColors.Green,
            OxyColors.Blue,
            OxyColor.FromRgb(0x20, 0x4A, 0x87)
        };

To make it even more easy, OxyPalettes's class methods can be used:

plotView.Model.DefaultColors = OxyPalettes.Jet(plotView.Model.Series.Count).Colors;