Gets or sets the position of the axis on the chart.
An AxisPosition enumeration value specifying the axis position.
When you set the Position property, it is necessary to take into account the default position settings for the different chart types. Most charts display the primary category axis running horizontally along the bottom of the plot area and the primary value axis running vertically on the left side of the chart. If the chart has the secondary axes, the secondary category axis, as a rule, coincides with the primary category axis and stays invisible on the chart. The secondary value axis is displayed on the right side of the plot area.
The default settings for the bar chart differ from the other chart types. Thus, the bar chart reverses the position of primary axes by displaying the category axis vertically to the left of the plot area and the value axis horizontally at the bottom of the chart. The secondary category axis is not displayed if it coincides with the primary category axis, and the secondary value axis is shown at the top of the plot area.
The scatter and bubble charts, which use only value axes, display the primary X-axis at the bottom of the plot area and the primary Y-axis to the left of the chart, while the secondary X-axis and Y-axis are shown at the top and to the right of the plot area, respectively.
However, you can change the default position of the axes by modifying the Position property. Note that only the value that is opposite to the default value affects the chart appearance. For example, you can change the default position of the primary value axis in a column chart by displaying it to the right of the plot area, as shown in the code snippet below. When you set the Position property for the axis, the SpreadsheetControl evaluates the cross point with the associated axis depending on its position and orientation (AxisScaling.Orientation).
The Position property is available only for the category and value axes and you cannot change the position of the series axis in a 3-D chart.
The example below demonstrates how to create a chart and specify its y-axis position using the Axis.Position property.
Dim worksheet As Worksheet = workbook.Worksheets("chartTask3") workbook.Worksheets.ActiveWorksheet = worksheet ' Create a chart and specify its location. Dim chart As Chart = worksheet.Charts.Add(ChartType.ColumnClustered, worksheet("B3:C5")) chart.TopLeftCell = worksheet.Cells("H2") chart.BottomRightCell = worksheet.Cells("N14") ' Set the positon of the value axis. chart.PrimaryAxes(1).Position = AxisPosition.Right ' Hide the legend. chart.Legend.Visible = False