Skip to main content

SeriesColorizerBase Class

The base class for all colorizers.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v24.1.dll

NuGet Package: DevExpress.Charts

Declaration

[TypeConverter(typeof(LocalizableExpandableObjectTypeConverter))]
public abstract class SeriesColorizerBase :
    ChartElement

The following members return SeriesColorizerBase objects:

Remarks

Refer to the Series Colorizer topic for more information about series colorizers.

Example

The following code demonstrates how to implement a custom colorizer that should paint series using a non-predefined algorithm:

class CustomSeriesColorizer : SeriesColorizer {
    List<object> metColors = new List<object>();

    public override Color GetSeriesColor(object seriesKey, Palette palette) {
        int keyIndex;
        if (metColors.Contains(seriesKey)) {
            keyIndex = metColors.IndexOf(seriesKey);
        } else {
            keyIndex = metColors.Count;
            metColors.Add(seriesKey);
        }
        return palette[keyIndex % palette.Count].Color;
    }

    protected override ChartElement CreateObjectForClone() {
        return new CustomSeriesColorizer();
    }
}
See Also