Axis2D.Alignment Property
Specifies the position of an axis relative to another primary axis.
Namespace: DevExpress.XtraCharts
Assembly: DevExpress.XtraCharts.v24.2.dll
NuGet Package: DevExpress.Charts
#Declaration
[XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)]
public AxisAlignment Alignment { get; set; }
#Property Value
Type | Description |
---|---|
Axis |
An 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’ Series - for the Scale - for the Scale - for the Scale |
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 |
---|---|
Axis |
Gets or sets the axis title position. |
Title. |
Gets or sets the title’s text. |
Axis |
Gets or sets the alignment of the axis title. |
Axis |
Gets or sets the axis label alignment. |
Axis2D. |
Gets or sets the axis label position. |
Axis |
Gets or sets a string that formats text for the auto-generated x- or y-axis labels. |
Axis2D. |
Specifies the position of an axis relative to another primary axis. |
#Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Alignment 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.