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

ChartControlSettings.CustomDrawSeries Property

Occurs before a series is drawn.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v19.2.dll

Declaration

public CustomDrawSeriesEventHandler CustomDrawSeries { get; set; }

Property Value

Type Description
CustomDrawSeriesEventHandler

A delegate method that handles the CustomDrawSeries event.

Remarks

The CustomDrawSeriesEventArgsBase.Series event parameter contains series options. The CustomDrawSeriesEventArgsBase.SeriesDrawOptions event parameter returns draw settings specific to each series. Note that this property value should be typecast to the corresponding type (e.g., BarDrawOptions, PointDrawOptions).

A chart raises the CustomDrawSeries and ChartControlSettings.CustomDrawSeriesPoint events in the following order:

  • The CustomDrawSeries event for the first series in the ChartControlSettings.Series collection. The first series in the series collection is a Series for which the IndexOf method returns 0.

  • The CustomDrawSeriesPoint event for all series points of the first series.

  • The CustomDrawSeries event for the second series in the ChartControlSettings.Series collection.

  • The CustomDrawSeriesPoint event for all series points of the second series.

  • …and so on for all the other series and their points.

The following example customizes series options in the CustomDrawSeries event handler:

settings.CustomDrawSeries = (sender, e) => {
    // Customize the legend text.
    e.LegendText = string.Format("{0} year", e.LegendText);

    // Fill all bar series with the aqua color.
    if (e.Series.View is BarSeriesView)
        e.SeriesDrawOptions.Color = Color.Aqua;

    // Find a series by its name and change its line style.
    // (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 their DrawOptions
    // and change their marker type.
    if (e.SeriesDrawOptions.GetType() == typeof(PointDrawOptions))
        ((PointDrawOptions)e.SeriesDrawOptions).Marker.Kind =
        MarkerKind.Diamond;
};
See Also