Excel.ChartDataLabels class

グラフのポイントにあるすべてのデータ ラベルのコレクションを表します。

Extends

プロパティ

autoText

データ ラベルがコンテキストに基づいて適切なテキストを自動的に生成するかどうかを指定します。

context

オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。

format

塗りつぶしやフォントの書式設定を含むグラフのデータ ラベルの書式を指定します。

geometricShapeType

データ ラベルの幾何学的形状の種類を指定します。 詳細については、Excel.GeometricShapeTypeを参照してください。 データ ラベルが幾何学的図形ではない場合、値は null です。

horizontalAlignment

グラフのデータ ラベルの水平方向の配置を指定します。 詳細は「Excel.ChartTextHorizontalAlignment」をご覧ください。 このプロパティは、データ ラベルの TextOrientation が 0 の場合にのみ有効です。

leaderLines

データ ラベルの引出線を表すオブジェクトを取得します。

linkNumberFormat

数値の表示形式をセルにリンクするかどうかを指定します。 true の場合、数値の表示形式は、セル内で変更されるとラベルの表示形式が変更されます。

numberFormat

データ ラベルの書式コードを指定します。

position

データ ラベルの位置を表す値。 詳細は「Excel.ChartDataLabelPosition」をご覧ください。

separator

グラフのデータ ラベルに使用される区切り文字を表す文字列を設定します。

showAsStickyCallout

データ ポイントにテール アンカーがアタッチされた吹き出しとしてデータ ラベルを表示するかどうかを指定します。 true の場合、吹き出しは次の値のいずれかになります: "AccentCallout1"、"AccentCallout2"、"BorderCallout1"、"BorderCallout2"、"WedgeRectCallout"、"WedgeRRectCallout"、または "WedgeEllipseCallout"。 詳細については、 GeometricShapeType を参照してください。

showBubbleSize

データ ラベルのバブル サイズを表示するかどうかを指定します。

showCategoryName

データ ラベル カテゴリ名を表示するかどうかを指定します。

showLeaderLines

データ ラベルに引出線を表示するかどうかを指定します。 true 引出線が表示されている場合。それ以外の場合は、 false

showLegendKey

データ ラベルの凡例キーを表示するかどうかを指定します。

showPercentage

データ ラベルのパーセンテージを表示するかどうかを指定します。

showSeriesName

データ ラベル系列名を表示するかどうかを指定します。

showValue

データ ラベルの値が表示されるかどうかを指定します。

textOrientation

テキストがデータ ラベルの向きになる角度を表します。 値は、-90 から 90 までの整数、または垂直方向のテキストの場合は 180 の整数にする必要があります。

verticalAlignment

グラフのデータ ラベルの垂直方向の配置を表します。 詳細は「Excel.ChartTextVerticalAlignment」をご覧ください。 このプロパティは、データ ラベルの TextOrientation が -90、90、または 180 の場合にのみ有効です。

メソッド

load(options)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(propertyNames)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(propertyNamesAndPaths)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

set(properties, options)

オブジェクトの複数のプロパティを同時に設定します。 適切なプロパティを持つプレーン オブジェクト、または同じ型の別の API オブジェクトを渡すことができます。

set(properties)

既存の読み込まれたオブジェクトに基づいて、オブジェクトに複数のプロパティを同時に設定します。

toJSON()

API オブジェクトが JSON.stringify() に渡されるときに、より有用な出力を提供するために、JavaScript toJSON() メソッドをオーバーライドします。 (次に、JSON.stringify渡されたオブジェクトの toJSON メソッドを呼び出します)。元の Excel.ChartDataLabels オブジェクトが API オブジェクトであるのに対し、 toJSON メソッドは、元のオブジェクトから読み込まれた子プロパティの浅いコピーを含むプレーンな JavaScript オブジェクト ( Excel.Interfaces.ChartDataLabelsData と型指定) を返します。

プロパティの詳細

autoText

データ ラベルがコンテキストに基づいて適切なテキストを自動的に生成するかどうかを指定します。

autoText: boolean;

プロパティ値

boolean

注釈

API セット: ExcelApi 1.8

context

オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。

context: RequestContext;

プロパティ値

format

塗りつぶしやフォントの書式設定を含むグラフのデータ ラベルの書式を指定します。

readonly format: Excel.ChartDataLabelFormat;

プロパティ値

注釈

API セット: ExcelApi 1.1

geometricShapeType

データ ラベルの幾何学的形状の種類を指定します。 詳細については、Excel.GeometricShapeTypeを参照してください。 データ ラベルが幾何学的図形ではない場合、値は null です。

geometricShapeType: Excel.GeometricShapeType | "LineInverse" | "Triangle" | "RightTriangle" | "Rectangle" | "Diamond" | "Parallelogram" | "Trapezoid" | "NonIsoscelesTrapezoid" | "Pentagon" | "Hexagon" | "Heptagon" | "Octagon" | "Decagon" | "Dodecagon" | "Star4" | "Star5" | "Star6" | "Star7" | "Star8" | "Star10" | "Star12" | "Star16" | "Star24" | "Star32" | "RoundRectangle" | "Round1Rectangle" | "Round2SameRectangle" | "Round2DiagonalRectangle" | "SnipRoundRectangle" | "Snip1Rectangle" | "Snip2SameRectangle" | "Snip2DiagonalRectangle" | "Plaque" | "Ellipse" | "Teardrop" | "HomePlate" | "Chevron" | "PieWedge" | "Pie" | "BlockArc" | "Donut" | "NoSmoking" | "RightArrow" | "LeftArrow" | "UpArrow" | "DownArrow" | "StripedRightArrow" | "NotchedRightArrow" | "BentUpArrow" | "LeftRightArrow" | "UpDownArrow" | "LeftUpArrow" | "LeftRightUpArrow" | "QuadArrow" | "LeftArrowCallout" | "RightArrowCallout" | "UpArrowCallout" | "DownArrowCallout" | "LeftRightArrowCallout" | "UpDownArrowCallout" | "QuadArrowCallout" | "BentArrow" | "UturnArrow" | "CircularArrow" | "LeftCircularArrow" | "LeftRightCircularArrow" | "CurvedRightArrow" | "CurvedLeftArrow" | "CurvedUpArrow" | "CurvedDownArrow" | "SwooshArrow" | "Cube" | "Can" | "LightningBolt" | "Heart" | "Sun" | "Moon" | "SmileyFace" | "IrregularSeal1" | "IrregularSeal2" | "FoldedCorner" | "Bevel" | "Frame" | "HalfFrame" | "Corner" | "DiagonalStripe" | "Chord" | "Arc" | "LeftBracket" | "RightBracket" | "LeftBrace" | "RightBrace" | "BracketPair" | "BracePair" | "Callout1" | "Callout2" | "Callout3" | "AccentCallout1" | "AccentCallout2" | "AccentCallout3" | "BorderCallout1" | "BorderCallout2" | "BorderCallout3" | "AccentBorderCallout1" | "AccentBorderCallout2" | "AccentBorderCallout3" | "WedgeRectCallout" | "WedgeRRectCallout" | "WedgeEllipseCallout" | "CloudCallout" | "Cloud" | "Ribbon" | "Ribbon2" | "EllipseRibbon" | "EllipseRibbon2" | "LeftRightRibbon" | "VerticalScroll" | "HorizontalScroll" | "Wave" | "DoubleWave" | "Plus" | "FlowChartProcess" | "FlowChartDecision" | "FlowChartInputOutput" | "FlowChartPredefinedProcess" | "FlowChartInternalStorage" | "FlowChartDocument" | "FlowChartMultidocument" | "FlowChartTerminator" | "FlowChartPreparation" | "FlowChartManualInput" | "FlowChartManualOperation" | "FlowChartConnector" | "FlowChartPunchedCard" | "FlowChartPunchedTape" | "FlowChartSummingJunction" | "FlowChartOr" | "FlowChartCollate" | "FlowChartSort" | "FlowChartExtract" | "FlowChartMerge" | "FlowChartOfflineStorage" | "FlowChartOnlineStorage" | "FlowChartMagneticTape" | "FlowChartMagneticDisk" | "FlowChartMagneticDrum" | "FlowChartDisplay" | "FlowChartDelay" | "FlowChartAlternateProcess" | "FlowChartOffpageConnector" | "ActionButtonBlank" | "ActionButtonHome" | "ActionButtonHelp" | "ActionButtonInformation" | "ActionButtonForwardNext" | "ActionButtonBackPrevious" | "ActionButtonEnd" | "ActionButtonBeginning" | "ActionButtonReturn" | "ActionButtonDocument" | "ActionButtonSound" | "ActionButtonMovie" | "Gear6" | "Gear9" | "Funnel" | "MathPlus" | "MathMinus" | "MathMultiply" | "MathDivide" | "MathEqual" | "MathNotEqual" | "CornerTabs" | "SquareTabs" | "PlaqueTabs" | "ChartX" | "ChartStar" | "ChartPlus";

プロパティ値

Excel.GeometricShapeType | "LineInverse" | "Triangle" | "RightTriangle" | "Rectangle" | "Diamond" | "Parallelogram" | "Trapezoid" | "NonIsoscelesTrapezoid" | "Pentagon" | "Hexagon" | "Heptagon" | "Octagon" | "Decagon" | "Dodecagon" | "Star4" | "Star5" | "Star6" | "Star7" | "Star8" | "Star10" | "Star12" | "Star16" | "Star24" | "Star32" | "RoundRectangle" | "Round1Rectangle" | "Round2SameRectangle" | "Round2DiagonalRectangle" | "SnipRoundRectangle" | "Snip1Rectangle" | "Snip2SameRectangle" | "Snip2DiagonalRectangle" | "Plaque" | "Ellipse" | "Teardrop" | "HomePlate" | "Chevron" | "PieWedge" | "Pie" | "BlockArc" | "Donut" | "NoSmoking" | "RightArrow" | "LeftArrow" | "UpArrow" | "DownArrow" | "StripedRightArrow" | "NotchedRightArrow" | "BentUpArrow" | "LeftRightArrow" | "UpDownArrow" | "LeftUpArrow" | "LeftRightUpArrow" | "QuadArrow" | "LeftArrowCallout" | "RightArrowCallout" | "UpArrowCallout" | "DownArrowCallout" | "LeftRightArrowCallout" | "UpDownArrowCallout" | "QuadArrowCallout" | "BentArrow" | "UturnArrow" | "CircularArrow" | "LeftCircularArrow" | "LeftRightCircularArrow" | "CurvedRightArrow" | "CurvedLeftArrow" | "CurvedUpArrow" | "CurvedDownArrow" | "SwooshArrow" | "Cube" | "Can" | "LightningBolt" | "Heart" | "Sun" | "Moon" | "SmileyFace" | "IrregularSeal1" | "IrregularSeal2" | "FoldedCorner" | "Bevel" | "Frame" | "HalfFrame" | "Corner" | "DiagonalStripe" | "Chord" | "Arc" | "LeftBracket" | "RightBracket" | "LeftBrace" | "RightBrace" | "BracketPair" | "BracePair" | "Callout1" | "Callout2" | "Callout3" | "AccentCallout1" | "AccentCallout2" | "AccentCallout3" | "BorderCallout1" | "BorderCallout2" | "BorderCallout3" | "AccentBorderCallout1" | "AccentBorderCallout2" | "AccentBorderCallout3" | "WedgeRectCallout" | "WedgeRRectCallout" | "WedgeEllipseCallout" | "CloudCallout" | "Cloud" | "Ribbon" | "Ribbon2" | "EllipseRibbon" | "EllipseRibbon2" | "LeftRightRibbon" | "VerticalScroll" | "HorizontalScroll" | "Wave" | "DoubleWave" | "Plus" | "FlowChartProcess" | "FlowChartDecision" | "FlowChartInputOutput" | "FlowChartPredefinedProcess" | "FlowChartInternalStorage" | "FlowChartDocument" | "FlowChartMultidocument" | "FlowChartTerminator" | "FlowChartPreparation" | "FlowChartManualInput" | "FlowChartManualOperation" | "FlowChartConnector" | "FlowChartPunchedCard" | "FlowChartPunchedTape" | "FlowChartSummingJunction" | "FlowChartOr" | "FlowChartCollate" | "FlowChartSort" | "FlowChartExtract" | "FlowChartMerge" | "FlowChartOfflineStorage" | "FlowChartOnlineStorage" | "FlowChartMagneticTape" | "FlowChartMagneticDisk" | "FlowChartMagneticDrum" | "FlowChartDisplay" | "FlowChartDelay" | "FlowChartAlternateProcess" | "FlowChartOffpageConnector" | "ActionButtonBlank" | "ActionButtonHome" | "ActionButtonHelp" | "ActionButtonInformation" | "ActionButtonForwardNext" | "ActionButtonBackPrevious" | "ActionButtonEnd" | "ActionButtonBeginning" | "ActionButtonReturn" | "ActionButtonDocument" | "ActionButtonSound" | "ActionButtonMovie" | "Gear6" | "Gear9" | "Funnel" | "MathPlus" | "MathMinus" | "MathMultiply" | "MathDivide" | "MathEqual" | "MathNotEqual" | "CornerTabs" | "SquareTabs" | "PlaqueTabs" | "ChartX" | "ChartStar" | "ChartPlus"

注釈

API セット: ExcelApi 1.19

horizontalAlignment

グラフのデータ ラベルの水平方向の配置を指定します。 詳細は「Excel.ChartTextHorizontalAlignment」をご覧ください。 このプロパティは、データ ラベルの TextOrientation が 0 の場合にのみ有効です。

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

プロパティ値

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

注釈

API セット: ExcelApi 1.8

leaderLines

データ ラベルの引出線を表すオブジェクトを取得します。

readonly leaderLines: Excel.ChartLeaderLines;

プロパティ値

注釈

API セット: ExcelApi 1.19

linkNumberFormat

数値の表示形式をセルにリンクするかどうかを指定します。 true の場合、数値の表示形式は、セル内で変更されるとラベルの表示形式が変更されます。

linkNumberFormat: boolean;

プロパティ値

boolean

注釈

API セット: ExcelApi 1.9

numberFormat

データ ラベルの書式コードを指定します。

numberFormat: string;

プロパティ値

string

注釈

API セット: ExcelApi 1.8

position

データ ラベルの位置を表す値。 詳細は「Excel.ChartDataLabelPosition」をご覧ください。

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"

注釈

API セット: ExcelApi 1.1

separator

グラフのデータ ラベルに使用される区切り文字を表す文字列を設定します。

separator: string;

プロパティ値

string

注釈

API セット: ExcelApi 1.1

showAsStickyCallout

データ ポイントにテール アンカーがアタッチされた吹き出しとしてデータ ラベルを表示するかどうかを指定します。 true の場合、吹き出しは次の値のいずれかになります: "AccentCallout1"、"AccentCallout2"、"BorderCallout1"、"BorderCallout2"、"WedgeRectCallout"、"WedgeRRectCallout"、または "WedgeEllipseCallout"。 詳細については、 GeometricShapeType を参照してください。

readonly showAsStickyCallout: boolean;

プロパティ値

boolean

注釈

API セット: ExcelApi 1.19

showBubbleSize

データ ラベルのバブル サイズを表示するかどうかを指定します。

showBubbleSize: boolean;

プロパティ値

boolean

注釈

API セット: ExcelApi 1.1

showCategoryName

データ ラベル カテゴリ名を表示するかどうかを指定します。

showCategoryName: boolean;

プロパティ値

boolean

注釈

API セット: ExcelApi 1.1

showLeaderLines

データ ラベルに引出線を表示するかどうかを指定します。 true 引出線が表示されている場合。それ以外の場合は、 false

showLeaderLines: boolean;

プロパティ値

boolean

注釈

API セット: ExcelApi 1.19

showLegendKey

データ ラベルの凡例キーを表示するかどうかを指定します。

showLegendKey: boolean;

プロパティ値

boolean

注釈

API セット: ExcelApi 1.1

showPercentage

データ ラベルのパーセンテージを表示するかどうかを指定します。

showPercentage: boolean;

プロパティ値

boolean

注釈

API セット: ExcelApi 1.1

showSeriesName

データ ラベル系列名を表示するかどうかを指定します。

showSeriesName: boolean;

プロパティ値

boolean

注釈

API セット: ExcelApi 1.1

showValue

データ ラベルの値が表示されるかどうかを指定します。

showValue: boolean;

プロパティ値

boolean

注釈

API セット: ExcelApi 1.1

textOrientation

テキストがデータ ラベルの向きになる角度を表します。 値は、-90 から 90 までの整数、または垂直方向のテキストの場合は 180 の整数にする必要があります。

textOrientation: number;

プロパティ値

number

注釈

API セット: ExcelApi 1.8

verticalAlignment

グラフのデータ ラベルの垂直方向の配置を表します。 詳細は「Excel.ChartTextVerticalAlignment」をご覧ください。 このプロパティは、データ ラベルの TextOrientation が -90、90、または 180 の場合にのみ有効です。

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

プロパティ値

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

注釈

API セット: ExcelApi 1.8

メソッドの詳細

load(options)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(options?: Excel.Interfaces.ChartDataLabelsLoadOptions): Excel.ChartDataLabels;

パラメーター

options
Excel.Interfaces.ChartDataLabelsLoadOptions

読み込むオブジェクトのプロパティのオプションを指定します。

返品

load(propertyNames)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

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

パラメーター

propertyNames

string | string[]

読み込むプロパティを指定するコンマ区切りの文字列または文字列の配列。

返品

// Show the series name in data labels and set the position of the data labels to "top".
await Excel.run(async (context) => {
    const chart = context.workbook.worksheets.getItem("Sheet1").charts.getItem("Chart1");
    chart.dataLabels.showValue = true;
    chart.dataLabels.position = Excel.ChartDataLabelPosition.top;
    chart.dataLabels.showSeriesName = true;
    await context.sync();

    console.log("Data labels shown");
});

load(propertyNamesAndPaths)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

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

パラメーター

propertyNamesAndPaths

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

propertyNamesAndPaths.select は読み込むプロパティを指定するコンマ区切りの文字列であり、 propertyNamesAndPaths.expand は読み込むナビゲーションのプロパティを指定するコンマ区切りの文字列です。

返品

set(properties, options)

オブジェクトの複数のプロパティを同時に設定します。 適切なプロパティを持つプレーン オブジェクト、または同じ型の別の API オブジェクトを渡すことができます。

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

パラメーター

properties
Excel.Interfaces.ChartDataLabelsUpdateData

メソッドが呼び出されたオブジェクトのプロパティと同型構造のプロパティを持つ JavaScript オブジェクト。

options
OfficeExtension.UpdateOptions

プロパティ オブジェクトが読み取り専用プロパティを設定しようとした場合にエラーを抑制するオプションを提供します。

返品

void

set(properties)

既存の読み込まれたオブジェクトに基づいて、オブジェクトに複数のプロパティを同時に設定します。

set(properties: Excel.ChartDataLabels): void;

パラメーター

返品

void

toJSON()

API オブジェクトが JSON.stringify() に渡されるときに、より有用な出力を提供するために、JavaScript toJSON() メソッドをオーバーライドします。 (次に、JSON.stringify渡されたオブジェクトの toJSON メソッドを呼び出します)。元の Excel.ChartDataLabels オブジェクトが API オブジェクトであるのに対し、 toJSON メソッドは、元のオブジェクトから読み込まれた子プロパティの浅いコピーを含むプレーンな JavaScript オブジェクト ( Excel.Interfaces.ChartDataLabelsData と型指定) を返します。

toJSON(): Excel.Interfaces.ChartDataLabelsData;

返品