ChartArea 类

定义

表示图表图像上的图表区域。Represents a chart area on the chart image.

public ref class ChartArea : System::Windows::Forms::DataVisualization::Charting::ChartNamedElement
public class ChartArea : System.Windows.Forms.DataVisualization.Charting.ChartNamedElement
type ChartArea = class
    inherit ChartNamedElement
Public Class ChartArea
Inherits ChartNamedElement
继承

注解

在任意给定的图表中,内部绘图位置是在绘制数据点的 x 和 y 轴内的矩形区域。Within any given chart, the inner plot position is the rectangular area, inside the x and y-axis lines, where the data points are drawn. 绘图位置是包含内部绘图位置、刻度线和轴标签的矩形区域。The plot position is the rectangular area that encompasses the inner plot position, the tick marks, and the axis labels. 图表区是一个矩形区域,该区域包含图表上的绘图位置、刻度线、轴标签和轴标题。The chart area is the rectangular area that encompasses the plot position, the tick marks, the axis labels and the axis titles on the chart.

图表区由 ChartArea 类表示;ChartArea 对象存储在 ChartAreaCollection 类中。A chart area is represented by a ChartArea class; ChartArea objects are stored in the ChartAreaCollection class.

可在图表区域中绘制的图表序列的数目不受限制。The number of chart series that can be plotted in a chart area is unlimited.

一个 ChartArea 对象:A ChartArea object:

  • 使用一个不同的内部绘图区。Uses one distinct inner plotting area.

  • 用于绘制一个或多个图表序列。Is used to plot one or more chart series.

  • 具有主 x 和 y 轴,饼图和圆环图类型除外。Has primary and secondary x and y-axes, except for pie and doughnut chart types.

使用形状图表类型(包括饼图、圆环图、漏斗图、棱锥图、极坐标图和雷达图)时,内部绘图位置将定义图表类型形状的大小。When you use Shape chart types, which includes pie, doughnut, funnel, pyramid, polar, and radar charts, the inner plotting position defines the size of the chart type shape. 例如,当您在饼图上增加 InnerPlotPosition 属性的值时,您将增加扇形的半径。For example, when you increase the value of the InnerPlotPosition property on a pie chart, you will increase the radius of the pie shape.

对于所有其他图表类型,每个图表区具有两组 X 轴和 Y 轴(主要和辅助)。For all other chart types, each chart area has two sets of X- and Y-axes, primary and secondary. 若要访问与这些轴相关的属性,请使用 AxisXAxisX2AxisYAxisY2 属性。To access properties related to these axes, use the AxisX, AxisX2, AxisY and AxisY2 properties. 如果需要设置影响图表上所有轴的属性,请使用 "Axes" 属性。If you need to set a property that affects all axes on the chart, use the Axes property.

一个或多个序列与图表区相关联。One or more series are associated with a chart area. 序列具有 ChartArea 属性,该属性确定每个序列所属的图表区。The series has a ChartArea property that determines the chart area that each series belongs to. 默认情况下,序列连接到默认图表区。By default, the series is connected to the default chart area. 若要禁用序列的显示,请将序列的 ChartArea 属性设置为长度为零的字符串。To disable the display of a series, set the ChartArea property of that series to a zero-length string.

如果将其他图表区添加到图表中,则可以将任何序列与新的图表区相关联。If another chart area is added to the chart, you can associate any series with the new chart area. 在所有形状图表类型以及条形图和堆积条形图类型中,每个序列都必须在单独的图表区域中进行绘制。In all Shape chart types, as well as bar and stacked bar chart types, each series must be plotted in a separate chart area. 在所有其他图表类型中,可以将多个序列组合到同一个图表区域中。In all other chart types, multiple series can be combined in the same chart area.

三维图表按图表区域的区域显示。A 3D chart is displayed on a chart area-by-chart area basis. 可以使用 Area3DStyle 属性在三维中启用和自定义图表。You can use the Area3DStyle property to enable and customize your chart in 3D.

如果添加新数据,将不会自动重新计算图表区的最小值和最大值,因此,图表不会自动更改轴大小。The chart area minimum and maximum will not be automatically recalculated if you add new data, so the chart will not automatically change axis sizes. 您可以通过使用 RecalculateAxesScale 方法,要求图表区重新计算这些值。You can require the chart area to recalculate these values by using the RecalculateAxesScale method.

若要垂直对齐多个图表区,请设置 "AlignmentOrientation" 属性。To align multiple chart areas vertically, set the AlignmentOrientation property. 若要水平对齐多个图表区,必须首先使用 Position 属性定位图表区,然后将 "AlignmentOrientation" 属性设置为 "水平"。To align multiple chart areas horizontally, you must first position the chart areas using the Position property, and then set the AlignmentOrientation property to Horizontal.

若要禁止显示序列,请将序列的 Series 属性设置为长度为零的字符串。To suppress the display of a series, set the Series property of that series to a zero-length string.

构造函数

ChartArea()

初始化 ChartArea 类的新实例。Initializes a new instance of the ChartArea class.

ChartArea(String)

用指定的图表区域名称初始化 ChartArea 类的新实例。Initializes a new instance of the ChartArea class with the specified chart area name.

属性

AlignmentOrientation

获取或设置图表区域的对齐方向。Gets or sets the alignment orientation of a chart area.

AlignmentStyle

获取或设置 ChartArea 的对齐样式。Gets or sets the alignment style of the ChartArea.

AlignWithChartArea

获取或设置此图表区域应与之对齐的 ChartArea 对象的名称。Gets or sets the name of the ChartArea object to which this chart area should be aligned.

Area3DStyle

获取或设置 ChartArea3DStyle 对象,该对象用于实现图表区域中所有序列的三维 (3D)。Gets or sets a ChartArea3DStyle object, which is used to implement three-dimensional (3D) for all series in a chart area.

Axes

获取或设置表示图表区域中所有轴的数组。Gets or sets an array that represents all axes for a chart area.

AxisX

获取或设置表示主 X 轴的 Axis 对象。Gets or sets an Axis object that represents the primary X-axis.

AxisX2

获取或设置表示辅助 X 轴的 Axis 对象。Gets or sets an Axis object that represents the secondary X-axis.

AxisY

获取或设置表示主 Y 轴的 Axis 对象。Gets or sets an Axis object that represents the primary Y-axis.

AxisY2

获取或设置表示辅助 Y 轴的 Axis 对象。Gets or sets an Axis object that represents the secondary Y-axis.

BackColor

获取或设置 ChartArea 对象的背景色。Gets or sets the background color of a ChartArea object.

BackGradientStyle

获取或设置图表区域的背景渐变方向,还确定是否使用渐变。Gets or sets the orientation for the background gradient of a chart area, and also determines whether or not a gradient is used.

BackHatchStyle

获取或设置 ChartArea 对象的阴影样式。Gets or sets the hatching style of a ChartArea object.

BackImage

获取或设置 ChartArea 对象的背景图像。Gets or sets the background image of a ChartArea object.

BackImageAlignment

获取或设置 ChartArea 背景图像的对齐方式。Gets or sets the alignment of a ChartArea background image.

BackImageTransparentColor

获取或设置 ChartArea 对象背景图像的颜色,该背景图像将以透明色绘制。Gets or sets the color of a ChartArea object background image that will be drawn as transparent.

BackImageWrapMode

获取或设置 ChartArea 对象背景图像的绘制模式。Gets or sets the drawing mode for the background image of a ChartArea object.

BackSecondaryColor

获取或设置 ChartArea 对象背景的辅助颜色。Gets or sets the secondary color for the background of a ChartArea object.

BorderColor

获取或设置 ChartArea 对象的边框颜色。Gets or sets the border color of a ChartArea object.

BorderDashStyle

获取或设置 ChartArea 对象的边框样式。Gets or sets the border style of a ChartArea object.

BorderWidth

获取或设置 ChartArea 对象的边框宽度。Gets or sets the border width of a ChartArea object.

CursorX

获取或设置一个 Cursor 对象,该对象用于沿 X 轴的光标和所选范围。Gets or sets a Cursor object that is used for cursors and selected ranges along the X-axis.

CursorY

获取或设置一个 Cursor 对象,该对象用于沿 Y 轴的光标和所选范围。Gets or sets a Cursor object that is used for cursors and selected ranges along the Y-axis.

InnerPlotPosition

获取或设置 ElementPosition 对象,该对象定义图表区域对象的内部绘图位置。Gets or sets an ElementPosition object, which defines the inner plot position of a chart area object.

IsSameFontSizeForAllAxes

获取或设置一个标志,该标志确定相关图表区域轴的标签大小是否相等。Gets or sets a flag that determines if the labels of the relevant chart area axes are of equal size.

Name

获取或设置 ChartArea 对象的唯一名称。Gets or sets the unique name of a ChartArea object.

Position

获取或设置一个 ElementPosition 对象,该对象定义 ChartArea 对象在 Chart 内的位置。Gets or sets an ElementPosition object that defines the position of a ChartArea object within the Chart.

ShadowColor

获取或设置 ChartArea 对象的阴影颜色。Gets or sets the shadow color of a ChartArea object.

ShadowOffset

获取或设置 ChartArea 对象的阴影偏移量(以像素为单位)。Gets or sets the shadow offset, in pixels, of a ChartArea object.

Tag

获取或设置与此图表元素关联的对象。Gets or sets an object associated with this chart element.

(继承自 ChartElement)
Visible

获取或设置用于确定图表区域是否可见的标志。Gets or sets a flag that determines if a chart area is visible.

方法

Dispose()

释放由 ChartElement 占用的资源。Releases the resources used by the ChartElement.

(继承自 ChartElement)
Dispose(Boolean)

释放非托管资源和(可选)托管资源。Releases unmanaged and, optionally, managed resources.

Equals(Object)

确定指定的 Object 是否等同于当前的 ChartElementDetermines whether the specified Object is equal to the current ChartElement.

(继承自 ChartElement)
GetHashCode()

返回特定类型的哈希算法。Returns a hash function for a particular type.

(继承自 ChartElement)
GetSeriesDepth(Series)

返回图表区域中 Series 的深度。Returns the depth of a Series in a chart area.

GetSeriesZPosition(Series)

返回序列的 Z 位置,它对自定义绘图非常有用。Returns the Z position of a series, which is useful for custom drawing.

GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
RecalculateAxesScale()

Customize 事件中对图表进行更改之后,重新计算图表区域的属性。Recalculates the properties of the chart area after changes have been made to the chart in the Customize event.

ToString()

返回表示当前 Object 的字符串。Returns a string that represents the current Object.

(继承自 ChartElement)
TransformPoints(Point3D[])

将三维变换应用于一个三维点数组,必须完成该应用才能调用 GDI+ 绘图方法。Applies 3D transformations to an array of 3D points, which must be done before GDI+ drawing methods can be called.

适用于