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

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

NuGet Package: DevExpress.Charts

Declaration

[XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)]
public bool AutoGrid { get; set; }

Property Value

Type Description
Boolean

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

Remarks

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;

GridSpacing_Auto

GridSpacing_1

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.

Example

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.

Note

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