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

AxisXBase.StickToEdge Property

Gets or sets the value that specifies whether the visual range sticks to the whole range’s start or end.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v20.2.dll

NuGet Packages: DevExpress.Charts, DevExpress.WindowsDesktop.Charts

Declaration

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

Property Value

Type Description
Boolean

true if the visual range sticks to the whole range’s edge; otherwise false.

Remarks

The following table demonstrates the possible values:

Note

When the property is set to true, the visual range’s range stays constant.

Description

Sample Image

StickToEdge = false

AxisBase_StickToEnd--false

StickToEdge = true;

The Visual Range is at the end of the Whole Range.

AxisBase_StickToEnd--true-end

StickToEdge = true;

The Visual Range is at the start of the Whole Range.

AxisBase_StickToEnd--true-start

Example

If you specify the maximum value of an x-axis’s visual range (for example, via the Range.Set MinMaxValues method) and the StickToEdge property is enabled, you should also define the Range.SideMarginsValue property.

XYDiagram diagram = chartControl1.Diagram as XYDiagram;
diagram.DependentAxesYRange = DevExpress.Utils.DefaultBoolean.True;
diagram.AxisX.StickToEdge = true;
diagram.AxisX.WholeRange.SideMarginsValue = 2;
diagram.AxisX.VisualRange.SetMinMaxValues((double)diagram.AxisX.WholeRange.MaxValue - 20, diagram.AxisX.WholeRange.MaxValue);
See Also