corelibraries-devexpress-dot-xtracharts-dot-customdrawserieseventargsbase-49c801fa.md
Returns the series that is currently being painted.
Namespace : DevExpress.XtraCharts
Assembly : DevExpress.XtraCharts.v25.2.dll
NuGet Package : DevExpress.Charts
public Series Series { get; }
Public ReadOnly Property Series As Series
| Type | Description |
|---|---|
| Series |
The series that is currently being painted.
|
Important
Changes applied to the object accessed via this property will never be effected.
To change a series’ appearance in a specific case, use the CustomDrawSeriesEventArgs.DrawOptions property instead. If you configure appearance of an automatically generated series, use the ChartControl.BoundDataChanged event instead.
This example demonstrates how to implement custom drawing in charts when drawing its series. To do this you should handle the ChartControl.CustomDrawSeries event, and then you’re able to change some drawing parameters using its event args.
Note
For the WebChartControl you should handle its WebChartControl.CustomDrawSeries event to implement this task.
using DevExpress.XtraCharts;
// ...
private void chartControl1_CustomDrawSeries(object sender,
CustomDrawSeriesEventArgs e) {
// Find all Bar Series by their view type,
// and fill them with Aqua color.
if (e.Series.View is BarSeriesView)
e.SeriesDrawOptions.Color = Color.Aqua;
// Find the series by its name,
// and change its line style to dash-dot-dot.
// (Here it's assumed that the series view type is LineSeriesView).
if (e.Series.Name == "Line Series")
((LineDrawOptions)e.SeriesDrawOptions).LineStyle.DashStyle =
DashStyle.DashDotDot;
// Find all Point Series by the type of its DrawOptions,
// and change their marker kind to diamond.
if (e.SeriesDrawOptions.GetType() == typeof(PointDrawOptions))
((PointDrawOptions)e.SeriesDrawOptions).Marker.Kind =
MarkerKind.Diamond;
}
Imports DevExpress.XtraCharts
' ...
Private Sub OnCustomDrawSeries(sender As Object, e As CustomDrawSeriesEventArgs) _
Handles ChartControl1.CustomDrawSeries
' Find all Bar Series by their view type, and fill them with Aqua color.
If TypeOf e.Series.View Is BarSeriesView Then
e.SeriesDrawOptions.Color = Color.Aqua
End If
' Find the series by its name, and change its line style to dash-dot-dot.
' (Here it's assumed that the series view type is LineSeriesView).
If e.Series.Name = "Line Series" Then
CType(e.SeriesDrawOptions, LineDrawOptions).LineStyle.DashStyle = DashStyle.DashDotDot
End If
' Find all Point Series by the type of its DrawOptions,
' and change their marker kind to diamond.
If e.SeriesDrawOptions.GetType() Is GetType(PointDrawOptions) Then
CType(e.SeriesDrawOptions, PointDrawOptions).Marker.Kind = MarkerKind.Diamond
End If
End Sub
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Series property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
graphics.SmoothingMode = DXSmoothingMode.HighQuality;
Color seriesColor = GetSeriesColor(e.Series, chartControl);
using (DXPen radioPen = new DXPen(seriesColor, LegendRadioWidth)) {
graphics.SmoothingMode = DXSmoothingMode.HighQuality
Dim seriesColor As Color = GetSeriesColor(e.Series, chartControl)
Using radioPen As DXPen = New DXPen(seriesColor, LegendRadioWidth)
See Also
CustomDrawSeriesEventArgsBase Class