Skip to main content
A newer version of this page is available. .

CustomDrawSeriesEventArgs Class

Provides data for a chart control’s ChartControl.CustomDrawSeries (WebChartControl.CustomDrawSeries) event.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v20.2.dll

NuGet Packages: DevExpress.Charts, DevExpress.WindowsDesktop.Charts

Declaration

public class CustomDrawSeriesEventArgs :
    CustomDrawSeriesEventArgsBase

Remarks

The CustomDrawSeriesEventArgs class represents an argument for the ChartControl.CustomDrawSeries event of a chart control.

An instance of the CustomDrawSeriesEventArgs class with appropriate settings is automatically created and passed to the corresponding event’s handler.

Important

Note, that if you change properties of the chart elements that are available only via getters (e.g., CustomDrawSeriesEventArgsBase.Series), these changes will not be effected. To make changes that should be effected, use the CustomDrawSeriesEventArgsBase.SeriesDrawOptions property.

Example

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;
}

Inheritance

See Also