Export (0) Print
Expand All

Axis Class

Provides methods and properties that manage axes in the Chart control.

Namespace:  System.Windows.Forms.DataVisualization.Charting
Assembly:  System.Windows.Forms.DataVisualization (in System.Windows.Forms.DataVisualization.dll)

public class Axis : ChartNamedElement

The Axis type exposes the following members.

  NameDescription
Public methodAxis()Initializes a new instance of the Axis class.
Public methodAxis(ChartArea, AxisName)Initializes a new instance of the Axis class with the specified ChartArea and axisTypeName values.
Top

  NameDescription
Public propertyArrowStyleGets or sets the arrow style of a 2D axis; this style is not applied to 3D chart areas.
Public propertyAxisNameInfrastructure. Gets the name of the axis, which can be either X, Y, X2 or Y2.
Public propertyCrossingGets or sets the location at which an axis is crossed by its associated axis.
Public propertyCustomLabelsGets a CustomLabelsCollection object used to store CustomLabel objects.
Public propertyEnabledGets or sets a value that indicates whether an axis is enabled.
Public propertyInterlacedColorGets or sets the color of interlaced strip lines.
Public propertyIntervalGets or sets the interval of an axis.
Public propertyIntervalAutoModeGets or sets a flag that determines if a fixed number of intervals is used on the axis, or if the number of intervals depends on the axis size.
Public propertyIntervalOffsetGets or sets the interval offset of an axis.
Public propertyIntervalOffsetTypeGets or sets the interval offset type of an axis.
Public propertyIntervalTypeGets or sets the interval type of an axis.
Public propertyIsInterlacedGets or sets a flag that determines if interlaced strip lines are displayed for an axis.
Public propertyIsLabelAutoFitGets or sets a flag that determines whether axis labels are automatically fitted.
Public propertyIsLogarithmicGets or sets a flag which indicates whether the axis is logarithmic. Zeros or negative data values are not allowed on logarithmic charts.
Public propertyIsMarginVisibleGets or sets a flag that determines whether to add a margin to the axis.
Public propertyIsMarksNextToAxisGets or sets a flag that determines whether tick marks and axis labels move with an axis if the crossing point of an axis changes.
Public propertyIsReversedGets or sets a flag which indicates whether the axis is reversed.
Public propertyIsStartedFromZeroGets or sets a flag which indicates whether the minimum value of the axis will be automatically set to zero if all data point values are positive. If there are negative data point values, the minimum value of the data points will be used.
Public propertyLabelAutoFitMaxFontSizeGets or sets the maximum font size that can be used by the label auto-fitting algorithm.
Public propertyLabelAutoFitMinFontSizeGets or sets the minimum font size that can be used by the label auto-fitting algorithm.
Public propertyLabelAutoFitStyleGets or sets the allowable label changes that can be made to enable the label to be fit along an axis.
Public propertyLabelStyleGets or sets the LabelStyle properties of an axis.
Public propertyLineColorGets or sets the line color of an axis.
Public propertyLineDashStyleGets or sets the line style of an axis.
Public propertyLineWidthGets or sets the line width of an axis, in pixels.
Public propertyLogarithmBaseGets or sets a value for the logarithm base for the logarithmic axis.
Public propertyMajorGridGets or sets a Grid object used to set the major grid line properties for an axis.
Public propertyMajorTickMarkGets or sets a TickMark object used to set the major tick mark properties of an axis.
Public propertyMaximumGets or sets the maximum value of an axis.
Public propertyMaximumAutoSizeGets or sets the maximum size of the axis, measured as a percentage of the chart area. This value is used by the automatic layout algorithm.
Public propertyMinimumGets or sets the minimum value of an axis.
Public propertyMinorGridGets or sets a Grid object used to specify the minor grid lines attributes of an axis.
Public propertyMinorTickMarkGets or sets a TickMark object used to set the minor tick mark properties of an axis.
Public propertyNameGets or sets the name of the axis. (Overrides ChartNamedElement.Name.)
Public propertyScaleBreakStyleGets or sets the axis scale break style.
Public propertyScaleViewGets or sets the view of an axis.
Public propertyScrollBarGets or sets an axis scrollbar.
Public propertyStripLinesGets a StripLinesCollection collection object.
Public propertyTagGets or sets an object associated with this chart element. (Inherited from ChartElement.)
Public propertyTextOrientationGets or sets the orientation of the text in the axis title.
Public propertyTitleGets or sets the title of the axis.
Public propertyTitleAlignmentGets or sets the alignment of an axis title.
Public propertyTitleFontGets or sets the title font properties of an axis.
Public propertyTitleForeColorGets or sets the text color of the axis title.
Public propertyToolTipGets or sets the tooltip used for the axis.
Top

  NameDescription
Public methodDispose()Releases the resources used by the ChartElement. (Inherited from ChartElement.)
Protected methodDispose(Boolean)Releases unmanaged and, optionally, managed resources. (Overrides ChartElement.Dispose(Boolean).)
Public methodEqualsDetermines whether the specified Object is equal to the current ChartElement. (Inherited from ChartElement.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeReturns a hash function for a particular type. (Inherited from ChartElement.)
Public methodGetPositionConverts an axis value to a relative position (0-100%). If an axis is logarithmic, the value is converted to a linear scale.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodPixelPositionToValueConverts an absolute pixel position along an axis to an axis value. This method only works in paint events.
Public methodPositionToValueConverts a relative coordinate along an axis to an axis value. This method only works in paint events.
Public methodRoundAxisValuesAutomatically rounds axis values.
Public methodToStringReturns a string that represents the current Object. (Inherited from ChartElement.)
Public methodValueToPixelPositionConverts an axis value to an absolute coordinate along an axis. Measured in pixels. This method only works in paint events.
Public methodValueToPositionConverts an axis value to its relative position (0-100%). If an axis has a logarithmic scale, the value is converted to a linear scale. This method only works in paint events.
Top

This class encapsulates all the functionality for axes in the Chart control, and is exposed by the AxisX, AxisY, AxisX2 and AxisY2 properties of ChartArea objects.

For all charts—except bar, stacked bar, pie and doughnut—the primary and secondary axes are as follows:

Axis Type

Description

Primary X-Axis

Bottom horizontal axis.

Secondary X-Axis

Top horizontal axis.

Primary Y-Axis

Left vertical axis.

Secondary Y-Axis

Right vertical axis.

Bar and stacked-bar charts have their axes rotated 90 degrees clockwise, so the primary X axis for these two chart types is the left-vertical axis.

Note   There can be only one set of axes—two vertical and two horizontal—for each ChartArea object.

The Axis class also contains several methods that can be used to convert axis values to absolute pixel coordinates, which are useful for 2D custom drawing, or to relative coordinates, which are useful for 3D custom drawing. Absolute and relative coordinates can also be converted to axis values.

The following are the most important axis elements exposed by the Axis class:

Axis Element

Description

Axis Labels

The labels of an axis, and their associated properties.

Grid Lines

The major and minor grid lines of an axis.

Tick Marks

The major and minor tick marks of an axis.

Strip Lines

Strip lines.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft