Back to Devexpress

SeriesDataSourceColorizer.DataSource Property

corelibraries-devexpress-dot-xtracharts-dot-seriesdatasourcecolorizer.md

latest3.8 KB
Original Source

SeriesDataSourceColorizer.DataSource Property

Gets or sets the data source whose data items the colorizer uses to paint series.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
public object DataSource { get; set; }
vb
Public Property DataSource As Object

Property Value

TypeDescription
Object

A data source instance.

|

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:

PropertyDescription
SeriesDataSourceColorizer.DataSourceGets or sets the data source whose data items the colorizer uses to paint series.
SeriesDataSourceColorizer.SeriesKeyMemberGets or sets the name of data member whose values represent colors in which the colorizer paints series.
SeriesDataSourceColorizer.SeriesColorMemberGets or sets the name of a data member whose values are used as series identifiers.
csharp
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"
};
vb
Class Department 
    Public Property Name As String
    Public Property Marker As Color
End Class
' ...
chartControl.SeriesTemplate.SeriesColorizer = New SeriesDataSourceColorizer With { _
    ' A data source containing series color.
    .DataSource = New List(Of Department ) From { _
        New Department With { .Name = "DevAV North", Marker = Color.FromArgb(0xE1, 0x83, 0x35)}, _
        New Department With { .Name = "DevAV Europe", Marker = Color.FromArgb(0x1E, 0x91, 0xD6)}, _
        New Department With { .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 a color.
    .SeriesColorMember = "Marker" _
}

See Also

SeriesDataSourceColorizer Class

SeriesDataSourceColorizer Members

DevExpress.XtraCharts Namespace