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.v24.2.dll
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 | |
StickToEdge = true; The Visual Range is at the end of the Whole Range. | |
StickToEdge = true; The Visual Range is at the start of the Whole Range. |
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);