Excel.ChartDataLabel class

表示图表点的数据标签。Represents the data label of a chart point.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

Extends

属性

autoText

该布尔值表示数据标签是否根据上下文自动生成相应的文本。Boolean value representing if data label automatically generates appropriate text based on context.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

context

与该对象关联的请求上下文。The request context associated with the object. 这会将加载项的进程连接到 Office 主机应用程序的进程。This connects the add-in's process to the Office host application's process.

format

表示图表数据标签的格式。Represents the format of chart data label.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

formula

该字符串值表示采用 A1 表示法的图表数据标签的公式。String value that represents the formula of chart data label using A1-style notation.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

height

返回图表数据标签的高度,以磅为单位。Returns the height, in points, of the chart data label. 只读。Read-only. 如果图表数据标签不可见,则为 Null。Null if chart data label is not visible.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

horizontalAlignment

表示图表数据标签水平对齐。Represents the horizontal alignment for chart data label. 有关详细信息, 请参阅 ChartTextHorizontalAlignment。See Excel.ChartTextHorizontalAlignment for details. 仅当 TextOrientation 的数据标签为90、-90 或180时, 此属性才有效。This property is valid only when TextOrientation of data label is 90, -90 or 180.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

left

表示图表数据标签左边缘到图表区域左边缘的距离,以磅为单位。Represents the distance, in points, from the left edge of chart data label to the left edge of chart area. 如果图表数据标签不可见,则为 Null。Null if chart data label is not visible.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

linkNumberFormat

布尔值,表示数字格式是否链接到单元格(以便在单元格中更改时标签中的数字格式会发生改变)。Boolean value representing if the number format is linked to the cells (so that the number format changes in the labels when it changes in the cells).

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

numberFormat

该字符串值表示数据标签的格式代码。String value that represents the format code for data label.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

position

表示数据标签的位置的 DataLabelPosition 值。DataLabelPosition value that represents the position of the data label. 有关详细信息, 请参阅 ChartDataLabelPosition。See Excel.ChartDataLabelPosition for details.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

separator

该字符串表示用于图表中数据标签的分隔符。String representing the separator used for the data label on a chart.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

showBubbleSize

该布尔值表示数据标签气泡大小是否可见。Boolean value representing if the data label bubble size is visible or not.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

showCategoryName

表示数据标签分类名称是否可见的布尔值。Boolean value representing if the data label category name is visible or not.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

showLegendKey

该布尔值表示数据标签图例标示是否可见。Boolean value representing if the data label legend key is visible or not.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

showPercentage

该布尔值表示数据标签百分比是否可见。Boolean value representing if the data label percentage is visible or not.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

showSeriesName

该布尔值表示数据标签系列名称是否可见。Boolean value representing if the data label series name is visible or not.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

showValue

该布尔值表示数据标签值是否可见。Boolean value representing if the data label value is visible or not.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

text

该字符串表示图表上的数据标签文本。String representing the text of the data label on a chart.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

textOrientation

表示图表数据标签的文本方向。Represents the text orientation of chart data label. 此值应是 -90 到 90 或 180(垂直文本)之间的整数。The value should be an integer either from -90 to 90, or 180 for vertically-oriented text.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

top

表示图表数据标签上边缘到图表区域顶部的距离,以磅为单位。Represents the distance, in points, from the top edge of chart data label to the top of chart area. 如果图表数据标签不可见,则为 Null。Null if chart data label is not visible.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

verticalAlignment

表示图表数据标签垂直对齐。Represents the vertical alignment of chart data label. 有关详细信息, 请参阅 ChartTextVerticalAlignment。See Excel.ChartTextVerticalAlignment for details. 仅当 TextOrientation 的数据标签为0时, 此属性才有效。This property is valid only when TextOrientation of data label is 0.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

width

返回图表数据标签的宽度,以磅为单位。Returns the width, in points, of the chart data label. 只读。Read-only. 如果图表数据标签不可见,则为 Null。Null if chart data label is not visible.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

方法

load(option)

将命令加入队列以加载对象的指定属性。Queues up a command to load the specified properties of the object. 在读取属性之前,你必须调用“context.sync()”。You must call "context.sync()" before reading the properties.

load(propertyNames)

将命令加入队列以加载对象的指定属性。Queues up a command to load the specified properties of the object. 在读取属性context.sync()之前, 必须先调用。You must call context.sync() before reading the properties.

load(propertyNamesAndPaths)

将命令加入队列以加载对象的指定属性。Queues up a command to load the specified properties of the object. 在读取属性context.sync()之前, 必须先调用。You must call context.sync() before reading the properties.

set(properties, options)

同时设置一个对象的多个属性。Sets multiple properties of an object at the same time. 您可以传递具有相应属性的纯对象或相同类型的其他 API 对象。You can pass either a plain object with the appropriate properties, or another API object of the same type.

set(properties)

基于现有加载的对象同时设置该对象的多个属性。Sets multiple properties on the object at the same time, based on an existing loaded object.

toJSON()

重写 JavaScript toJSON()方法, 以便在将 API 对象传递到时提供更有用的输出JSON.stringify()Overrides the JavaScript toJSON() method in order to provide more useful output when an API object is passed to JSON.stringify(). (JSON.stringify反过来, 也会调用传递toJSON给它的对象的方法。尽管原始 ChartDataLabel 对象是 API 对象, 但toJSON方法返回一个无格式的 JavaScript 对象 (类型为Excel.Interfaces.ChartDataLabelData, in turn, calls the toJSON method of the object that is passed to it.) Whereas the original Excel.ChartDataLabel object is an API object, the toJSON method returns a plain JavaScript object (typed as Excel.Interfaces.ChartDataLabelData), 其中包含原始对象中所有已加载的子属性的浅表副本。) that contains shallow copies of any loaded child properties from the original object.

属性详细信息

autoText

该布尔值表示数据标签是否根据上下文自动生成相应的文本。Boolean value representing if data label automatically generates appropriate text based on context.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

autoText: boolean;

属性值

boolean

context

与该对象关联的请求上下文。The request context associated with the object. 这会将加载项的进程连接到 Office 主机应用程序的进程。This connects the add-in's process to the Office host application's process.

context: RequestContext;

属性值

RequestContext

format

表示图表数据标签的格式。Represents the format of chart data label.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

readonly format: Excel.ChartDataLabelFormat;

属性值

formula

该字符串值表示采用 A1 表示法的图表数据标签的公式。String value that represents the formula of chart data label using A1-style notation.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

formula: string;

属性值

string

height

返回图表数据标签的高度,以磅为单位。Returns the height, in points, of the chart data label. 只读。Read-only. 如果图表数据标签不可见,则为 Null。Null if chart data label is not visible.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

readonly height: number;

属性值

number

horizontalAlignment

表示图表数据标签水平对齐。Represents the horizontal alignment for chart data label. 有关详细信息, 请参阅 ChartTextHorizontalAlignment。See Excel.ChartTextHorizontalAlignment for details. 仅当 TextOrientation 的数据标签为90、-90 或180时, 此属性才有效。This property is valid only when TextOrientation of data label is 90, -90 or 180.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

horizontalAlignment: Excel.ChartTextHorizontalAlignment | "Center" | "Left" | "Right" | "Justify" | "Distributed";

属性值

Excel.ChartTextHorizontalAlignment | "Center" | "Left" | "Right" | "Justify" | "Distributed"

left

表示图表数据标签左边缘到图表区域左边缘的距离,以磅为单位。Represents the distance, in points, from the left edge of chart data label to the left edge of chart area. 如果图表数据标签不可见,则为 Null。Null if chart data label is not visible.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

left: number;

属性值

number

linkNumberFormat

布尔值,表示数字格式是否链接到单元格(以便在单元格中更改时标签中的数字格式会发生改变)。Boolean value representing if the number format is linked to the cells (so that the number format changes in the labels when it changes in the cells).

[API 集: ExcelApi 1.9][ API set: ExcelApi 1.9 ]

linkNumberFormat: boolean;

属性值

boolean

numberFormat

该字符串值表示数据标签的格式代码。String value that represents the format code for data label.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

numberFormat: string;

属性值

string

position

表示数据标签的位置的 DataLabelPosition 值。DataLabelPosition value that represents the position of the data label. 有关详细信息, 请参阅 ChartDataLabelPosition。See Excel.ChartDataLabelPosition for details.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

position: Excel.ChartDataLabelPosition | "Invalid" | "None" | "Center" | "InsideEnd" | "InsideBase" | "OutsideEnd" | "Left" | "Right" | "Top" | "Bottom" | "BestFit" | "Callout";

属性值

Excel.ChartDataLabelPosition | "Invalid" | "None" | "Center" | "InsideEnd" | "InsideBase" | "OutsideEnd" | "Left" | "Right" | "Top" | "Bottom" | "BestFit" | "Callout"

separator

该字符串表示用于图表中数据标签的分隔符。String representing the separator used for the data label on a chart.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

separator: string;

属性值

string

showBubbleSize

该布尔值表示数据标签气泡大小是否可见。Boolean value representing if the data label bubble size is visible or not.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

showBubbleSize: boolean;

属性值

boolean

showCategoryName

表示数据标签分类名称是否可见的布尔值。Boolean value representing if the data label category name is visible or not.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

showCategoryName: boolean;

属性值

boolean

showLegendKey

该布尔值表示数据标签图例标示是否可见。Boolean value representing if the data label legend key is visible or not.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

showLegendKey: boolean;

属性值

boolean

showPercentage

该布尔值表示数据标签百分比是否可见。Boolean value representing if the data label percentage is visible or not.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

showPercentage: boolean;

属性值

boolean

showSeriesName

该布尔值表示数据标签系列名称是否可见。Boolean value representing if the data label series name is visible or not.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

showSeriesName: boolean;

属性值

boolean

showValue

该布尔值表示数据标签值是否可见。Boolean value representing if the data label value is visible or not.

[API 集: ExcelApi 1.7][ API set: ExcelApi 1.7 ]

showValue: boolean;

属性值

boolean

text

该字符串表示图表上的数据标签文本。String representing the text of the data label on a chart.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

text: string;

属性值

string

textOrientation

表示图表数据标签的文本方向。Represents the text orientation of chart data label. 此值应是 -90 到 90 或 180(垂直文本)之间的整数。The value should be an integer either from -90 to 90, or 180 for vertically-oriented text.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

textOrientation: number;

属性值

number

top

表示图表数据标签上边缘到图表区域顶部的距离,以磅为单位。Represents the distance, in points, from the top edge of chart data label to the top of chart area. 如果图表数据标签不可见,则为 Null。Null if chart data label is not visible.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

top: number;

属性值

number

verticalAlignment

表示图表数据标签垂直对齐。Represents the vertical alignment of chart data label. 有关详细信息, 请参阅 ChartTextVerticalAlignment。See Excel.ChartTextVerticalAlignment for details. 仅当 TextOrientation 的数据标签为0时, 此属性才有效。This property is valid only when TextOrientation of data label is 0.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

verticalAlignment: Excel.ChartTextVerticalAlignment | "Center" | "Bottom" | "Top" | "Justify" | "Distributed";

属性值

Excel.ChartTextVerticalAlignment | "Center" | "Bottom" | "Top" | "Justify" | "Distributed"

width

返回图表数据标签的宽度,以磅为单位。Returns the width, in points, of the chart data label. 只读。Read-only. 如果图表数据标签不可见,则为 Null。Null if chart data label is not visible.

[API 集: ExcelApi 1.8][ API set: ExcelApi 1.8 ]

readonly width: number;

属性值

number

方法详细信息

load(option)

将命令加入队列以加载对象的指定属性。Queues up a command to load the specified properties of the object. 在读取属性之前,你必须调用“context.sync()”。You must call "context.sync()" before reading the properties.

load(option?: Excel.Interfaces.ChartDataLabelLoadOptions): Excel.ChartDataLabel;

参数

返回

注解

除了此签名之外, 此方法还具有以下签名:In addition to this signature, this method has the following signatures:

load(option?: string | string[]): Excel.ChartDataLabel-Where 选项是一个逗号分隔的字符串或一个字符串数组, 用于指定要加载的属性。load(option?: string | string[]): Excel.ChartDataLabel - Where option is a comma-delimited string or an array of strings that specify the properties to load.

load(option?: { select?: string; expand?: string; }): Excel.ChartDataLabel-Where 选项。选择是一个用逗号分隔的字符串, 用于指定要加载的属性和选项。 expand 是一个用逗号分隔的字符串, 用于指定要加载的导航属性。load(option?: { select?: string; expand?: string; }): Excel.ChartDataLabel - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load.

load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.ChartDataLabel-仅适用于集合类型。load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.ChartDataLabel - Only available on collection types. 它类似于前面的签名。It is similar to the preceding signature. Top 指定结果中可包含的集合项的最大数量。Option.top specifies the maximum number of collection items that can be included in the result. 选项。 skip 指定要跳过且不包含在结果中的项目数。Option.skip specifies the number of items that are to be skipped and not included in the result. 如果指定了 top 选项, 则在跳过指定数目的项目后将启动结果集。If option.top is specified, the result set will start after skipping the specified number of items.

load(propertyNames)

将命令加入队列以加载对象的指定属性。Queues up a command to load the specified properties of the object. 在读取属性context.sync()之前, 必须先调用。You must call context.sync() before reading the properties.

load(propertyNames?: string | string[]): Excel.ChartDataLabel;

参数

propertyNames
string | string[]

一个以逗号分隔的字符串或字符串数组, 用于指定要加载的属性。A comma-delimited string or an array of strings that specify the properties to load.

返回

load(propertyNamesAndPaths)

将命令加入队列以加载对象的指定属性。Queues up a command to load the specified properties of the object. 在读取属性context.sync()之前, 必须先调用。You must call context.sync() before reading the properties.

load(propertyNamesAndPaths?: { select?: string; expand?: string; }): Excel.ChartDataLabel;

参数

propertyNamesAndPaths
{ select?: string; expand?: string; }

其中, propertyNamesAndPaths 是用逗号分隔的字符串, 用于指定要加载的属性和 propertyNamesAndPaths。扩展是一个用逗号分隔的字符串, 用于指定要加载的导航属性。Where propertyNamesAndPaths.select is a comma-delimited string that specifies the properties to load, and propertyNamesAndPaths.expand is a comma-delimited string that specifies the navigation properties to load.

返回

set(properties, options)

同时设置一个对象的多个属性。Sets multiple properties of an object at the same time. 您可以传递具有相应属性的纯对象或相同类型的其他 API 对象。You can pass either a plain object with the appropriate properties, or another API object of the same type.

set(properties: Interfaces.ChartDataLabelUpdateData, options?: OfficeExtension.UpdateOptions): void;

参数

properties
Interfaces.ChartDataLabelUpdateData

一个 JavaScript 对象, 其属性的结构 isomorphically 为在其上调用方法的对象的属性。A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called.

options
OfficeExtension.UpdateOptions

提供一个选项, 以在 properties 对象尝试设置任何只读属性时禁止显示错误。Provides an option to suppress errors if the properties object tries to set any read-only properties.

返回

void

注解

此方法具有以下附加签名:This method has the following additional signature:

set(properties: Excel.ChartDataLabel): void

set(properties)

基于现有加载的对象同时设置该对象的多个属性。Sets multiple properties on the object at the same time, based on an existing loaded object.

set(properties: Excel.ChartDataLabel): void;

参数

返回

void

toJSON()

重写 JavaScript toJSON()方法, 以便在将 API 对象传递到时提供更有用的输出JSON.stringify()Overrides the JavaScript toJSON() method in order to provide more useful output when an API object is passed to JSON.stringify(). (JSON.stringify反过来, 也会调用传递toJSON给它的对象的方法。尽管原始 ChartDataLabel 对象是 API 对象, 但toJSON方法返回一个无格式的 JavaScript 对象 (类型为Excel.Interfaces.ChartDataLabelData, in turn, calls the toJSON method of the object that is passed to it.) Whereas the original Excel.ChartDataLabel object is an API object, the toJSON method returns a plain JavaScript object (typed as Excel.Interfaces.ChartDataLabelData), 其中包含原始对象中所有已加载的子属性的浅表副本。) that contains shallow copies of any loaded child properties from the original object.

toJSON(): Excel.Interfaces.ChartDataLabelData;

返回