แก้ไข

แชร์ผ่าน


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()

Initializes a new instance of the Axis class.

Axis(ChartArea, AxisName)

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

Properties

ArrowStyle

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

AxisName

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

Crossing

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

CustomLabels

Gets a CustomLabelsCollection object used to store CustomLabel objects.

Enabled

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

InterlacedColor

Gets or sets the color of interlaced strip lines.

Interval

Gets or sets the interval of an axis.

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

Gets or sets the interval offset of an axis.

IntervalOffsetType

Gets or sets the interval offset type of an axis.

IntervalType

Gets or sets the interval type of an axis.

IsInterlaced

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

IsLabelAutoFit

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

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

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

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

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

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

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

LabelAutoFitMinFontSize

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

LabelAutoFitStyle

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

LabelStyle

Gets or sets the LabelStyle properties of an axis.

LineColor

Gets or sets the line color of an axis.

LineDashStyle

Gets or sets the line style of an axis.

LineWidth

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

LogarithmBase

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

MajorGrid

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

MajorTickMark

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

Maximum

Gets or sets the maximum value of an axis.

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

Gets or sets the minimum value of an axis.

MinorGrid

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

MinorTickMark

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

Name

Gets or sets the name of the axis.

ScaleBreakStyle

Gets or sets the axis scale break style.

ScaleView

Gets or sets the view of an axis.

ScrollBar

Gets or sets an axis scrollbar.

StripLines

Gets a StripLinesCollection collection object.

Tag

Gets or sets an object associated with this chart element.

(Inherited from ChartElement)
TextOrientation

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

Title

Gets or sets the title of the axis.

TitleAlignment

Gets or sets the alignment of an axis title.

TitleFont

Gets or sets the title font properties of an axis.

TitleForeColor

Gets or sets the text color of the axis title.

ToolTip

Gets or sets the tooltip used for the axis.

Methods

Dispose()

Releases the resources used by the ChartElement.

(Inherited from ChartElement)
Dispose(Boolean)

Releases unmanaged and, optionally, managed resources.

Equals(Object)

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

(Inherited from ChartElement)
GetHashCode()

Returns a hash function for a particular type.

(Inherited from ChartElement)
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()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
PixelPositionToValue(Double)

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

PositionToValue(Double)

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

RoundAxisValues()

Automatically rounds axis values.

ToString()

Returns a string that represents the current Object.

(Inherited from ChartElement)
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)

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