Axis Axis Axis Axis Class

Definition

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

public ref class Axis : System::Windows::Forms::DataVisualization::Charting::ChartNamedElement
public class Axis : System.Windows.Forms.DataVisualization.Charting.ChartNamedElement
type Axis = class
    inherit ChartNamedElement
Public Class Axis
Inherits ChartNamedElement
Inheritance

Remarks

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.

Constructors

Axis() Axis() Axis() Axis()

Initializes a new instance of the Axis class.

Axis(ChartArea, AxisName) Axis(ChartArea, AxisName) Axis(ChartArea, AxisName) Axis(ChartArea, AxisName)

Initializes a new instance of the Axis class with the specified chartArea and axisTypeName values.

Properties

ArrowStyle ArrowStyle ArrowStyle ArrowStyle

Gets or sets the arrow style of a 2D axis; this style is not applied to 3D chart areas.

AxisName AxisName AxisName AxisName

Gets the name of the axis, which can be either X, Y, X2 or Y2.

Crossing Crossing Crossing Crossing

Gets or sets the location at which an axis is crossed by its associated axis.

CustomLabels CustomLabels CustomLabels CustomLabels

Gets a CustomLabelsCollection object used to store CustomLabel objects.

Enabled Enabled Enabled Enabled

Gets or sets a value that indicates whether an axis is enabled.

InterlacedColor InterlacedColor InterlacedColor InterlacedColor

Gets or sets the color of interlaced strip lines.

Interval Interval Interval Interval

Gets or sets the interval of an axis.

IntervalAutoMode IntervalAutoMode IntervalAutoMode IntervalAutoMode

Gets 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.

IntervalOffset IntervalOffset IntervalOffset IntervalOffset

Gets or sets the interval offset of an axis.

IntervalOffsetType IntervalOffsetType IntervalOffsetType IntervalOffsetType

Gets or sets the interval offset type of an axis.

IntervalType IntervalType IntervalType IntervalType

Gets or sets the interval type of an axis.

IsInterlaced IsInterlaced IsInterlaced IsInterlaced

Gets or sets a flag that determines if interlaced strip lines are displayed for an axis.

IsLabelAutoFit IsLabelAutoFit IsLabelAutoFit IsLabelAutoFit

Gets or sets a flag that determines whether axis labels are automatically fitted.

IsLogarithmic IsLogarithmic IsLogarithmic IsLogarithmic

Gets or sets a flag which indicates whether the axis is logarithmic. Zeros or negative data values are not allowed on logarithmic charts.

IsMarginVisible IsMarginVisible IsMarginVisible IsMarginVisible

Gets or sets a flag that determines whether to add a margin to the axis.

IsMarksNextToAxis IsMarksNextToAxis IsMarksNextToAxis IsMarksNextToAxis

Gets or sets a flag that determines whether tick marks and axis labels move with an axis if the crossing point of an axis changes.

IsReversed IsReversed IsReversed IsReversed

Gets or sets a flag which indicates whether the axis is reversed.

IsStartedFromZero IsStartedFromZero IsStartedFromZero IsStartedFromZero

Gets 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.

LabelAutoFitMaxFontSize LabelAutoFitMaxFontSize LabelAutoFitMaxFontSize LabelAutoFitMaxFontSize

Gets or sets the maximum font size that can be used by the label auto-fitting algorithm.

LabelAutoFitMinFontSize LabelAutoFitMinFontSize LabelAutoFitMinFontSize LabelAutoFitMinFontSize

Gets or sets the minimum font size that can be used by the label auto-fitting algorithm.

LabelAutoFitStyle LabelAutoFitStyle LabelAutoFitStyle LabelAutoFitStyle

Gets or sets the allowable label changes that can be made to enable the label to be fit along an axis.

LabelStyle LabelStyle LabelStyle LabelStyle

Gets or sets the LabelStyle properties of an axis.

LineColor LineColor LineColor LineColor

Gets or sets the line color of an axis.

LineDashStyle LineDashStyle LineDashStyle LineDashStyle

Gets or sets the line style of an axis.

LineWidth LineWidth LineWidth LineWidth

Gets or sets the line width of an axis, in pixels.

LogarithmBase LogarithmBase LogarithmBase LogarithmBase

Gets or sets a value for the logarithm base for the logarithmic axis.

MajorGrid MajorGrid MajorGrid MajorGrid

Gets or sets a Grid object used to set the major grid line properties for an axis.

MajorTickMark MajorTickMark MajorTickMark MajorTickMark

Gets or sets a TickMark object used to set the major tick mark properties of an axis.

Maximum Maximum Maximum Maximum

Gets or sets the maximum value of an axis.

MaximumAutoSize MaximumAutoSize MaximumAutoSize MaximumAutoSize

Gets 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.

Minimum Minimum Minimum Minimum

Gets or sets the minimum value of an axis.

MinorGrid MinorGrid MinorGrid MinorGrid

Gets or sets a Grid object used to specify the minor grid lines attributes of an axis.

MinorTickMark MinorTickMark MinorTickMark MinorTickMark

Gets or sets a TickMark object used to set the minor tick mark properties of an axis.

Name Name Name Name

Gets or sets the name of the axis.

ScaleBreakStyle ScaleBreakStyle ScaleBreakStyle ScaleBreakStyle

Gets or sets the axis scale break style.

ScaleView ScaleView ScaleView ScaleView

Gets or sets the view of an axis.

ScrollBar ScrollBar ScrollBar ScrollBar

Gets or sets an axis scrollbar.

StripLines StripLines StripLines StripLines

Gets a StripLinesCollection collection object.

Tag Tag Tag Tag

Gets or sets an object associated with this chart element.

(Inherited from ChartElement)
TextOrientation TextOrientation TextOrientation TextOrientation

Gets or sets the orientation of the text in the axis title.

Title Title Title Title

Gets or sets the title of the axis.

TitleAlignment TitleAlignment TitleAlignment TitleAlignment

Gets or sets the alignment of an axis title.

TitleFont TitleFont TitleFont TitleFont

Gets or sets the title font properties of an axis.

TitleForeColor TitleForeColor TitleForeColor TitleForeColor

Gets or sets the text color of the axis title.

ToolTip ToolTip ToolTip ToolTip

Gets or sets the tooltip used for the axis.

Methods

Dispose() Dispose() Dispose() Dispose()

Releases the resources used by the ChartElement.

(Inherited from ChartElement)
Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

Releases unmanaged and, optionally, managed resources.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified Object is equal to the current ChartElement.

(Inherited from ChartElement)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Returns a hash function for a particular type.

(Inherited from ChartElement)
GetPosition(Double) GetPosition(Double) GetPosition(Double) GetPosition(Double)

Converts an axis value to a relative position (0-100%). If an axis is logarithmic, the value is converted to a linear scale.

GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
PixelPositionToValue(Double) PixelPositionToValue(Double) PixelPositionToValue(Double) PixelPositionToValue(Double)

Converts an absolute pixel position along an axis to an axis value. This method only works in paint events.

PositionToValue(Double) PositionToValue(Double) PositionToValue(Double) PositionToValue(Double)

Converts a relative coordinate along an axis to an axis value. This method only works in paint events.

RoundAxisValues() RoundAxisValues() RoundAxisValues() RoundAxisValues()

Automatically rounds axis values.

ToString() ToString() ToString() ToString()

Returns a string that represents the current Object.

(Inherited from ChartElement)
ValueToPixelPosition(Double) ValueToPixelPosition(Double) ValueToPixelPosition(Double) ValueToPixelPosition(Double)

Converts an axis value to an absolute coordinate along an axis. Measured in pixels. This method only works in paint events.

ValueToPosition(Double) ValueToPosition(Double) ValueToPosition(Double) ValueToPosition(Double)

Converts 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.

Applies to