Axis2D.Alignment Property

Specifies the position of an axis relative to another primary axis.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v21.1.dll

Declaration

[XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)]
public AxisAlignment Alignment { get; set; }

Property Value

Type Description
AxisAlignment

An AxisAlignment enumeration value which specifies the relative position of the current axis.

Available values:

Name Description
Near

An axis is displayed at the left or bottom side of the diagram, depending on its type and orientation.

Far

An axis is displayed at the right or top side of the diagram, depending on its type and orientation.

Zero

An axis intercepts another primary axis at the zero level.

This alignment type is applicable to primary axes only.

In this mode, an axis title and labels are shown within the pane.

For an axis of (Y) values, the zero level is its zero line.

For an axis of (X) arguments, the zero level depends upon a series’ SeriesBase.ScaleType property value:

- for the ScaleType.Qualitative scale, the zero level is specified by the first point’s argument,

- for the ScaleType.Numerical scale, the zero level equals the zero value,

- for the ScaleType.DateTime scale, the zero level is equal to the earliest date.

Center

The axis is positioned in the center of chart plot area.

This alignment type is applicable to primary axes only.

In this mode, an axis title and labels are shown within the pane.

Remarks

You can use the following alignments to specify the Alignment property:

Alignment The example image
Center
Far
Near
Zero

Example

This example configures the axis label and axis title appearance.

The following code configures options of a y-axis to resemble to its appearance in the image above:

XYDiagram diagram = chartControl.Diagram as XYDiagram;
diagram.AxisY.Title.Position = AxisTitlePosition.Outside;
diagram.AxisY.Title.Text = "Total Harmonic Distortion";
diagram.AxisY.Title.Alignment = System.Drawing.StringAlignment.Center;
diagram.AxisY.Label.Alignment = AxisLabelAlignment.Far;
diagram.AxisY.LabelPosition = AxisLabelPosition.Inside;
diagram.AxisY.Label.TextPattern = "{V:0.##}%";
diagram.AxisY.Alignment = AxisAlignment.Near;

The following table lists the API members the code above uses:

Member Description
AxisTitle.Position Gets or sets the axis title position.
Title.Text Gets or sets the title’s text.
AxisTitle.Alignment Gets or sets the alignment of the axis title.
AxisLabel2D.Alignment Gets or sets the axis label alignment.
Axis2D.LabelPosition Gets or sets the axis label position.
AxisLabel.TextPattern Gets or sets a string that formats text for the auto-generated x- or y-axis labels.
Axis2D.Alignment Specifies the position of an axis relative to another primary axis.
See Also