Skip to main content

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.v22.2.dll

NuGet Package: DevExpress.Charts


public bool AutoGrid { get; set; }

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;

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AutoGrid property.


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.

See Also