SeriesDataSourceColorizer Class
Colorizer that paints series with colors stored in a data source.
Namespace: DevExpress.XtraCharts
Assembly: DevExpress.XtraCharts.v24.1.dll
NuGet Package: DevExpress.Charts
Declaration
[TypeConverter(typeof(SeriesDataSourceColorizerTypeConverter))]
public class SeriesDataSourceColorizer :
SeriesColorizerBase,
IDataSourceColorizer,
IBindingProvider,
IDataSourceChangedEventHandlerProvider
Remarks
This colorizer uses data objects from a data source to paint series. These objects can be an integer representing an ARGB color, a string that is the color name or a System.Drawing.Color object.
Example
The code below shows how to customize the colorizer.
Important
The main data source mentioned in the code snippet is the series template’s data source.
The code snippet uses the following properties:
Property | Description |
---|---|
SeriesDataSourceColorizer.DataSource | Gets or sets the data source whose data items the colorizer uses to paint series. |
SeriesDataSourceColorizer.SeriesKeyMember | Gets or sets the name of data member whose values represent colors in which the colorizer paints series. |
SeriesDataSourceColorizer.SeriesColorMember | Gets or sets the name of a data member whose values are used as series identifiers. |
class Department {
public String Name { get; set; }
public Color Marker { get; set; }
}
// ...
chartControl.SeriesTemplate.SeriesColorizer = new SeriesDataSourceColorizer() {
// The data source storing objects that contain a series's color.
DataSource = new List<Department> {
new Department { Name = "DevAV North", Marker = Color.FromArgb(0xE1, 0x83, 0x35)},
new Department { Name = "DevAV Europe", Marker = Color.FromArgb(0x1E, 0x91, 0xD6)},
new Department { Name = "DevAV Australia", Marker = Color.FromArgb(0x8F, 0xC9, 0x3A)},
};
// The name of the data member storing objects that should be equal to a series data member's values from the main data source.
SeriesKeyMember = "Name",
// The name of the data member that contains colors.
SeriesColorMember = "Marker"
};
Inheritance
Object
ChartElement
SeriesColorizerBase
SeriesDataSourceColorizer
See Also