ComponentOne Chart for WPF and Silverlight
Chart for WPF and Silverlight / Chart Types / Bar and Column Charts / Specifying the Color of Each Bar Or Column in the Data Series
In This Topic
    Specifying the Color of Each Bar Or Column in the Data Series
    In This Topic

    You can specify the color of each bar/column in the data series PlotElementLoaded event using the following code:

    C#
    Copy Code
    var palette = new Brush[] { Brushes.Red, Brushes.Plum, Brushes.Purple };
          dataSeries.PlotElementLoaded += (s, e) =>
            {
              PlotElement pe = (PlotElement)s;
              if (pe.DataPoint.PointIndex >= 0)
                pe.Fill = palette[pe.DataPoint.PointIndex % palette.Length];
            };
    
    See Also