Skip to main content

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.Xpf.Charts

Assembly: DevExpress.Xpf.Charts.v24.2.dll

NuGet Package: DevExpress.Wpf.Charts

Declaration

public double EndSideMargin { get; set; }

Property Value

Type Description
Double

The side margin value. SideMarginSizeUnit specifies the unit.

Remarks

Use an instance of the Range class to access the EndSideMargin property. To specify the margin on the opposite side, use the StartSideMargin property. 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 Day):

Property Value Example
EndSideMargin = 20 (Days)
(SideMarginSizeUnit = SideMarginSizeUnit.AxisUnit)
EndSideMargin = 0 (Days)
(SideMarginSizeUnit = SideMarginSizeUnit.AxisUnit)

Markup:

<dxc:ChartControl ... >
    <dxc:XYDiagram2D>
        <dxc:XYDiagram2D.AxisX>
            <dxc:AxisX2D ...>
                <dxc:AxisX2D.WholeRange>
                    <dxc:Range EndSideMargin="20" 
                               SideMarginSizeUnit="AxisUnit"/>
                </dxc:AxisX2D.WholeRange>
            </dxc:AxisX2D>
        </dxc:XYDiagram2D.AxisX>
    </dxc:XYDiagram2D>
    ...
</dxc:ChartControl>

At runtime:

Range range = new Range();
xAxis.WholeRange = range;
range.SideMarginSizeUnit = SideMarginSizeUnit.AxisUnit;
range.EndSideMargin = 20;

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.

These axis measurement units vary according to the axis type.

Axis Type

Axis Mode

Default Measurement Unit

Date-time

Continuous

DateTimeMeasureUnit.Millisecond

Date-time

Manual, Interval

DateTimeMeasureUnit.Day

Time-span

Continuous

TimeSpanMeasureUnit.Millisecond

Time-span

Manual, Interval

TimeSpanMeasureUnit.Second

Numerical

Continuous, Manual, Interval

Ones

Qualitative

Ones

In Automatic mode, the Chart Control determines an axis measurement unit based on underlying data.

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:

Markup:

<dxc:ChartControl ... >
    <dxc:XYDiagram2D>
        <dxc:XYDiagram2D.AxisX>
            <dxc:AxisX2D ...>
                <dxc:AxisX2D.WholeRange>
                    <dxc:Range EndSideMargin="20" 
                               SideMarginSizeUnit="AxisRangePercentage"/>
                </dxc:AxisX2D.WholeRange>
            </dxc:AxisX2D>
        </dxc:XYDiagram2D.AxisX>
    </dxc:XYDiagram2D>
    ...
</dxc:ChartControl>

At runtime:

Range range = new Range();
xAxis.WholeRange = range;
range.SideMarginSizeUnit = SideMarginSizeUnit.AxisRangePercentage;
range.EndSideMargin = 20;

Reversed Axis Margins

If the Axis2D.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.

See Also