ScaleGridOptionsBase.AutoGrid Property

Gets or sets the value specifying whether the alignment, spacing and offset of grid lines and major tickmarks should be calculated automatically.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v19.2.dll


public bool AutoGrid { get; set; }
Public Property AutoGrid As Boolean

Property Value

Type Description

true, if grid spacing is performed automatically; otherwise, false.


The AutoGrid property is tightly interrelated with the ScaleGridOptionsBase.GridSpacing, ScaleGridOptionsBase.GridOffset and NumericScaleOptions.GridAlignment(DateTimeScaleOptions.GridAlignment) properties. Changing the value of one property affects the other. By default, the AutoGrid property is set to true and the grid line spacing is calculated automatically.

The following images demonstrate how the AutoGrid property works.

AutoGrid = true;

(auto) GridAlignment = Week;

(auto) GridSpacing = 1;

AutoGrid = false;

GridAlignment = Day;

GridSpacing = 3;



Note that if you need to define a custom grid interval, change the value of the ScaleGridOptionsBase.GridSpacing, ScaleGridOptionsBase.GridOffset or NumericScaleOptions.GridAlignment(DateTimeScaleOptions.GridAlignment) property. This automatically sets the AutoGrid property to false.

For more information, refer to Axis Scale Types.


Use AxisBase.NumericScaleOptions, AxisBase.DateTimeScaleOptions, AxisBase.TimeSpanScaleOptions or AxisXBase.QualitativeScaleOptions to access the AutoGrid property.

NumericScaleOptions xAxisOptions = ((XYDiagram)chartControl1.Diagram).AxisX.NumericScaleOptions;
xAxisOptions.AutoGrid = true;
See Also