Back to Devexpress

Range.EndSideMargin Property

corelibraries-devexpress-dot-xtracharts-dot-range-8dffcca0.md

latest7.2 KB
Original Source

Range.EndSideMargin Property

Gets or sets the distance between the series point with the highest value and the end of the axis range.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
public double EndSideMargin { get; set; }
vb
Public Property EndSideMargin As Double

Property Value

TypeDescription
Double

The side margin value, in units specified by SideMarginSizeUnit.

|

Remarks

Use the WholeRange and VisualRange properties to access the EndSideMargin property. To specify the margin on the opposite side, use StartSideMargin. Set the Range.SideMarginsValue property to define both side margins.

Specify Margins in Axis Units

The following images show a chart with different EndSideMargin values (the x-axis measurement unit is Hour):

Property ValueExample
WholeRange.EndSideMargin = 5 (Hours)
(WholeRange.SideMarginSizeUnit = SideMarginSizeUnit.AxisUnit)
WholeRange.EndSideMargin = 0 (Hours)
(WholeRange.SideMarginSizeUnit = SideMarginSizeUnit.AxisUnit)
csharp
XYDiagram diagram = chart.Diagram as XYDiagram;
diagram.AxisX.WholeRange.SideMarginSizeUnit = SideMarginSizeUnit.AxisUnit;
diagram.AxisX.WholeRange.EndSideMargin = 5;
vb
Dim diagram As XYDiagram = TryCast(chart.Diagram, XYDiagram)
diagram.AxisX.WholeRange.SideMarginSizeUnit = SideMarginSizeUnit.AxisUnit
diagram.AxisX.WholeRange.EndSideMargin = 5

Note: If you set EndSideMargin or StartSideMargin, the control ignores the Range.AutoSideMargins property.

When the SideMarginSizeUnit property is set to AxisUnit , side margins are specified in axis measurement units (NumericScaleOptions.MeasureUnit, DateTimeScaleOptions.MeasureUnit, or TimeSpanScaleOptions.MeasureUnit). These axis measurement units vary according to the axis type.

|

Axis Type

|

Axis Mode

|

Default Measurement Unit

| | --- | --- | --- | |

Date-time

|

Continuous

|

DateTimeMeasureUnit.Millisecond

| |

Date-time

|

Automatic, Manual, Interval

|

DateTimeMeasureUnit.Day

| |

Time-span

|

Continuous

|

TimeSpanMeasureUnit.Millisecond

| |

Time-span

|

Automatic, Manual, Interval

|

TimeSpanMeasureUnit.Second

| |

Numerical

|

Automatic, Continuous, Manual, Interval

|

NumericMeasureUnit.Ones

| |

Qualitative

| |

Ones

|

Specify Margins as a Percentage

Set the Range.SideMarginSizeUnit property to SideMarginSizeUnit.AxisRangePercentage to define a margin value as a percentage of the axis range, for example:

csharp
XYDiagram diagram = chart.Diagram as XYDiagram;
diagram.AxisX.WholeRange.SideMarginSizeUnit = SideMarginSizeUnit.AxisRangePercentage;
diagram.AxisX.WholeRange.EndSideMargin = 20;
vb
Dim diagram As XYDiagram = TryCast(chart.Diagram, XYDiagram)
diagram.AxisX.WholeRange.SideMarginSizeUnit = SideMarginSizeUnit.AxisRangePercentage
diagram.AxisX.WholeRange.EndSideMargin = 20

Reversed Axis Margins

If the Axis.Reverse property is enabled (axis values are arranged in reversed order), side margins change their positions. As a result, the end margin is displayed at the left (for an x-axis) or bottom (for a y-axis) of the diagram.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the EndSideMargin 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.

winforms-charts-create-real-time-chart-and-collect-data-in-separate-thread/CS/RealTimeChartUpdates/Form1.cs#L41

csharp
diagram.AxisX.Label.ResolveOverlappingOptions.AllowStagger = false;
diagram.AxisX.VisualRange.EndSideMargin = 200;
diagram.DependentAxesYRange = DefaultBoolean.True;

winforms-charts-create-real-time-chart-and-collect-data-in-separate-thread/VB/RealTimeChartUpdates/Form1.vb#L51

vb
diagram.AxisX.Label.ResolveOverlappingOptions.AllowStagger = False
diagram.AxisX.VisualRange.EndSideMargin = 200
diagram.DependentAxesYRange = DefaultBoolean.True

See Also

Axis Ranges

Range.StartSideMargin

Range.SideMarginsValue

Range Class

Range Members

DevExpress.XtraCharts Namespace