Back to Devexpress

DrawOptions Class

corelibraries-devexpress-dot-xtracharts-d9a0b492.md

latest6.2 KB
Original Source

DrawOptions Class

Represents a base for classes that contain settings for custom drawing series of different view types.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
[RuntimeObject]
public abstract class DrawOptions :
    ICloneable
vb
<RuntimeObject>
Public MustInherit Class DrawOptions
    Implements ICloneable

The following members return DrawOptions objects:

Remarks

The DrawOptions class serves as a base for objects that are passed to the ChartControl.CustomDrawSeries and ChartControl.CustomDrawSeriesPoint events via the CustomDrawSeriesEventArgsBase.SeriesDrawOptions property and contain appropriate drawing settings which are specific to the view type of the currently drawn series.

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.

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

Inheritance

Show 26 items

Object DrawOptions Bar3DDrawOptions

BarDrawOptions

BoxPlotDrawOptions

FinancialDrawOptions

Line3DDrawOptions

PointDrawOptionsBase

SimpleDiagramDrawOptionsBase

SwiftPlotDrawOptions

SwiftPointDrawOptions

LineDrawOptions

StockDrawOptions

PieDrawOptions

CandleStickDrawOptions

PointDrawOptions

FullStackedAreaDrawOptions

Funnel3DDrawOptions

FunnelDrawOptions

GanttDrawOptions

RangeAreaDrawOptions

RangeBarDrawOptions

Pie3DDrawOptions

Area3DDrawOptions

AreaDrawOptions

WaterfallDrawOptions

See Also

DrawOptions Members

DevExpress.XtraCharts Namespace