Programatically (or via XAML) Define color for each bar in ColumnSeries

Apr 30, 2014 at 6:30 PM
I'm really enjoying the OxyPlot library. Thank you!

I have a Plot with seven ColumnSeries. I need to set each bar color (in each of the series) based on a property in the model.

From the code, I tried defining a list of colors in DefaultColors the chart is drawn where all the bars in the 1st series are drawn with DefaultColor[0] and all the bars in the 2nd series are drawn with DefaultColors[1], etc.
        eg: plotModel.Series.Add(new ColumnSeries { Title = "V1", ItemsSource = CellList, ValueField = "CellVoltage" });
               OxyColor defaultColor = OxyColor.Parse("#FF000080"); // Default -- blue
               plotModel.DefaultColors.Add(defaultColor);
               ...
From XAML, I tried to set FillColor binding to a method that should return a bar color, but it appears to return the same color for all bars in the series.
 eg: <oxy:ColumnSeries Title="V1" ItemsSource="{Binding Path=CellList}" ValueField="Voltage"  FillColor="{Binding Path=CellBarColor}" />


Thank you for your help
jg