Axis

An axis is a reference line measuring distances or angles in a coordinate system. One or more axis are contained in a plot area. A PlotArea will have one default x-axis (XAxis) and one default y-axis (YAxis). But a PlotArea is not limited to the default axis and can have multiple x-axis and y-axes.

Each of the different series types has a specific type of axis created by default, not the user. For example, the DateTimeAreaSeries, the DateTimeBarSeries, DateTimeColumnSeries, and DateTimeLineSeries all have a DateTimeXAxis and a NumericYAxis.

A PlotArea has a Series property that specifies a SeriesList. A SeriesList has an Add method, which creates the appropriate axis when adding a series to the SeriesList.

Unless expressly specified, a series creates the appropriate axis class subclass and assigns the appropriate values for the axis by default.

Axis By Series

The following table lists the series and the x-axis and y-axis associated with the series.

Series x-axis y-axis
DateTimeAreaSeries DateTimeXAxis NumericYAxis
DateTimeBarSeries NumericXAxis DateTimeYAxis
DateTimeColumnSeries DateTimeXAxis NumericYAxis
DateTimeLineSeries DateTimeXAxis NumericYAxis
DateTimeStackedAreaSeries DateTimeXAxis NumericYAxis
DateTimeStackedBarSeries NumericXAxis DateTimeYAxis
DateTimeStackedColumnSeries DateTimeXAxis NumericYAxis
DateTimeStackedLineSeries DateTimeXAxis NumericYAxis
DateTime100PercentStackedAreaSeries NumericXAxis PercentageYAxis
DateTime100PercentStackedBarSeries PercentageXAxis DateTimeYAxis
DateTime100PercentStackedColumnSeries DateTimeXAxis PercentageYAxis
DateTime100PercentStackedLineSeries DateTimeXAxis PercentageYAxis
IndexedAreaSeries IndexedXAxis NumericYAxis
IndexedBarSeries NumericXAxis IndexedYAxis
IndexedColumnSeries IndexedXAxis NumericYAxis
IndexedLineSeries IndexedXAxis NumericYAxis
IndexedStackedAreaSeries IndexedXAxis NumericYAxis
IndexedStackedBarSeries NumericXAxis IndexedYAxis
IndexedStackedColumnSeries IndexedXAxis NumericYAxis
IndexedStackedLineSeries IndexedXAxis NumericYAxis
Indexed100PercentStackedAreaSeries IndexedXAxis PercentageYAxis
Indexed100PercentStackedBarSeries PercentageXAxis IndexedYAxis
Indexed100PercentStackedColumnSeries IndexedXAxis PercentageYAxis
Indexed100PercentStackedLineSeries IndexedXAxis PercentageYAxis

See the API documentation for each axis type for a complete code example.

XAxis

An x-axis (specified by the XAxis class) is the horizontal axis of a two-dimensional Cartesian coordinate system. To change an XAxis position - on the plot area's bottom by default - use the XAxisAnchorType enumeration.

To specify a series-specific type of x-axis, use code similar to the following (using the appropriate XAxis subclass depending upon the series).

NumericXAxis axis = barSeries.XAxis;
DateTimeXAxis axis2 = dateTimeSeries.XAxis;
Dim MyAxis As NumericXAxis = MyBarSeries.XAxis   
Dim MyAxis2 AS DateTimeXAxis = MyDateTimeSeries.XAxis

The XAxis creates the appropriate default x-axis if not specified. It can be retrieved from the PlotArea or Series after adding the Series to SeriesList.

The XAxis has the following sub-classes for each of the different x-axis types (see table above).

XAxis Properties

The XAxis class has the following properties inherited by all the specific XAxis subclasses.

Refer to the API documentation for properties specific to each XAxis subclass.

Property Description
AnchorType Gets or sets the XAxisAnchorType enumeration that specifies the position of the XAxis.
LabelFormat Gets or sets the format of the labels. (Inherited from Axis)
LabelOffset Gets or sets the label offset of the axis. (Inherited from Axis)
LabelPosition Gets or sets the XAxisLabelPosition enumeration that specifies the position of the labels.
LineColor Gets or sets the Color object to use for the line color of the axis. (Inherited from (Axis)
LineStyle Gets or sets the LineStyle object specifying the line style of the axis. (Inherited from (Axis)
LineWidth Gets or sets the line width of the axis. (Inherited from Axis)
MajorGridLines Gets or sets the XAxisGridLines object to use for the MajorGridLines of the XAxis.
MajorTickMarks Gets or sets the XAxisTickMarks object to use for the MajorTickMarks of the XAxis.
MinorGridLines Gets or sets the XAxisGridLines object to use for the MinorGridLines of the XAxis.
MinorTickMarks Gets or sets the XAxisTickMarks object to use for the MinorTickMarks of the XAxis.
Offset Gets or sets the offset of the axis. (Inherited from Axis)
TitlePosition Gets or sets the XAxisTitlePosition enumeration that specifies the position of the Title.
Titles Gets the TitleList object to use for the Title of the XAxis.
Visible Gets or sets the visible status of the axis. By default it is True. (Inherited from Axis)

It is unnecessary to set maximum or minimum values or intervals for an axis, as the provided data calculate these values. However, the x-axis subclasses also have Min, Max, and Interval properties for specifying the minimum and maximum series values. But be sure to set the subclass label's AutoLabels property to False.

myAxis.Min = 185;
myYAxis.Max = 235;
myYAxis.Interval = 10;
myYAxis.Labels.AutoLabels = False;

NumericXAxis

The NumericXAxis uses numeric data, displays the values using NumericXAxisLabels, and places the NumericXAxis on the plot area. See the table above for a listing showing the series that use a NumericXAxis.

Refer to the NumericXAxis API documentation for a complete example.

DateTimeXAxis

The DateTimeXAxis uses date and time data, displays the values using DateTimeXAxisLabels, and places the DateTimeXAxis on the plot area. See the table above for a listing showing the series that use a DateTimeXAxis.

Refer to the DateTimeXAxis API documentation for a complete example.

PercentageXAxis

The PercentageXAxis uses numeric data in percentage format, displays the values using PercentageXAxisLabels, and places the PercentageXAxis on the plot area. See the table above for a listing showing the series that use a PercentageXAxis.

Refer to the PercentageXAxis API documentation for a complete example.

IndexedXAxis

The IndexedXAxis uses non-numeric data, displays the values using IndexedXAxisLabel, and places the IndexedXAxis on the plot area. See the table above for a listing showing the series that uses an IndexedXAxis.

Refer to the IndexedXAxis API documentation for a complete example.

YAxis

A y-axis (specified by the YAxis class) is the vertical axis of a two-dimensional Cartesian coordinate system. To change the y-axis - to the left of the plot area by default - use the YAxisAnchorType enumeration.

A y-axis position can also be changed to the plot area's right or floating (refer to the YAxisAnchorType API documentation for details).

myYAxis.AnchorType = YAxisAnchorType.Left;

To specify a specific type of y-axis from a series, use code similar to the following (using the appropriate YAxis subclass depending upon the series).

IndexedYAxis yAxis = barSeries.YAxis;
NumericYAxis yAxis2 = dateTimeSeries.YAxis;
Dim MyYAxis As IndexedYAxis = MyBarSeries.YAxis  
Dim MyYAxis2 As NumericYAxis = MyDateTimeSeries.YAxis;

The YAxis uses the appropriate default y-axis if not specified. The default y-axis type can be retrieved from the PlotArea or Series after adding the series to the SeriesList.

The YAxis has the following sub-classes for each y-axis type (see table above).

YAxis Properties

The YAxis class has the following properties inherited by all the specific YAxis subclasses.

Refer to the API documentation for properties specific to each YAxis subclass.

Property Description
AnchorType Gets or sets the YAxisAnchorType enumeration that specifies the position of the YAxis.
LabelFormat Gets or sets the format of the labels. (Inherited from Axis)
LabelOffset Gets or sets the label offset of the axis. (Inherited from Axis)
LabelPosition Gets or sets the YAxisLabelPosition enumeration that specifies the position of the labels.
LineColor Gets or sets the Color object to use for the line color of the axis. (Inherited from Axis)
LineStyle Gets or sets the LineStyle object specifying the line style of the axis. (Inherited from Axis).
LineWidth Gets or sets the line width of the axis. (Inherited from Axis)
MajorGridLines Gets or sets the YAxisGridLines object to use for the MajorGridLines of the YAxis.
MajorTickMarks Gets or sets the YAxisTickMarks object to use for the MajorTickMarks of the YAxis.
MinorGridLines Gets or sets the YAxisGridLines object to use for the MinorGridLines of the YAxis.
MinorTickMarks Gets or sets the YAxisTickMarks object to use for the MinorTickMarks of the YAxis.
Offset Gets or sets the offset of the axis. (Inherited from Axis)
TitlePosition Gets or sets YAxisTitlePosition enumeration that specifies the position of the Title.
Titles Gets or sets the Title object to use for the title of the YAxis.
Visible Gets or sets the visible status of the axis. By default it is true. (Inherited from Axis)

It is unnecessary to set maximum or minimum values or intervals for an axis, as the provided data calculate these values. However, the y-axis subclasses also have Min, Max, and Interval properties for specifying the minimum and maximum series values. But be sure to set the subclass label's AutoLabels property to False.

myAxis.Min = 185;
myYAxis.Max = 235;
myYAxis.Interval = 10;
myYAxis.Labels.AutoLabels = False;

NumericYAxis

The NumericYAxis uses numeric data, displays the values using NumericYAxisLabels, and places the NumericYAxis on the plot area. See the table above for a listing showing the series that use a NumericYAxis.

Refer to the NumericYAxis API documentation for a complete example.

DateTimeYAxis

The DateTimeYAxis uses date and time data, displays the values using DateTimeYAxisLabels, and places the DateTimeYAxis on the plot area. See the table above for a listing showing the series that use a DateTimeYAxis.

Refer to the DateTimeYAxis API documentation for a complete example.

PercentageYAxis

The PercentageYAxis uses numeric data in percentage format, displays the values using PercentageYAxisLabels, and places the PercentageYAxis on the plot area. See the table above for a listing showing the series that use a PercentageYAxis.

Refer to the PercentageYAxis API documentation for a complete example.

IndexedYAxis

The IndexedYAxis uses non-numeric data, displays the values using IndexedYAxisLabels, and places the IndexedYAxis on the plot area. See the table above for a listing showing the series that uses an IndexedYAxis.

Refer to the IndexedYAxis API documentation for a complete example.

In this topic