Excel.ChartDataTable class

グラフのデータ テーブル オブジェクトを表します。

Extends

注釈

[ API セット: ExcelApi 1.14 ]

プロパティ

context

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

format

塗りつぶし、フォント、罫線の形式を含むグラフ データ テーブルの形式を表します。

showHorizontalBorder

データ テーブルの水平罫線を表示するかどうかを指定します。

showLegendKey

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

showOutlineBorder

データ テーブルのアウトライン罫線を表示するかどうかを指定します。

showVerticalBorder

データ テーブルの垂直罫線を表示するかどうかを指定します。

visible

グラフのデータ テーブルを表示するかどうかを指定します。

メソッド

load(options)

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

load(propertyNames)

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

load(propertyNamesAndPaths)

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

set(properties, options)

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

set(properties)

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

toJSON()

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

プロパティの詳細

context

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

context: RequestContext;

プロパティ値

format

塗りつぶし、フォント、罫線の形式を含むグラフ データ テーブルの形式を表します。

readonly format: Excel.ChartDataTableFormat;

プロパティ値

注釈

[ API セット: ExcelApi 1.14 ]

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-data-table.yaml

// This function adjusts the display and format of a chart data table that already exists on the worksheet.
await Excel.run(async (context) => {
  // Retrieve the chart named "SalesChart" from the "Sample" worksheet.
  const chart = context.workbook.worksheets.getItem("Sample").charts.getItem("SalesChart");

  // Get the chart data table object and load its properties.
  const chartDataTable = chart.getDataTableOrNullObject();
  chartDataTable.load();

  // Set the display properties of the chart data table.
  chartDataTable.showLegendKey = true;
  chartDataTable.showHorizontalBorder = false;
  chartDataTable.showVerticalBorder = true;
  chartDataTable.showOutlineBorder = true;

  // Retrieve the chart data table format object and set font and border properties. 
  const chartDataTableFormat = chartDataTable.format;
  chartDataTableFormat.font.color = "#B76E79";
  chartDataTableFormat.font.name = "Comic Sans";
  chartDataTableFormat.border.color = "blue";
  await context.sync();
});

showHorizontalBorder

データ テーブルの水平罫線を表示するかどうかを指定します。

showHorizontalBorder: boolean;

プロパティ値

boolean

注釈

[ API セット: ExcelApi 1.14 ]

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-data-table.yaml

// This function adjusts the display and format of a chart data table that already exists on the worksheet.
await Excel.run(async (context) => {
  // Retrieve the chart named "SalesChart" from the "Sample" worksheet.
  const chart = context.workbook.worksheets.getItem("Sample").charts.getItem("SalesChart");

  // Get the chart data table object and load its properties.
  const chartDataTable = chart.getDataTableOrNullObject();
  chartDataTable.load();

  // Set the display properties of the chart data table.
  chartDataTable.showLegendKey = true;
  chartDataTable.showHorizontalBorder = false;
  chartDataTable.showVerticalBorder = true;
  chartDataTable.showOutlineBorder = true;

  // Retrieve the chart data table format object and set font and border properties. 
  const chartDataTableFormat = chartDataTable.format;
  chartDataTableFormat.font.color = "#B76E79";
  chartDataTableFormat.font.name = "Comic Sans";
  chartDataTableFormat.border.color = "blue";
  await context.sync();
});

showLegendKey

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

showLegendKey: boolean;

プロパティ値

boolean

注釈

[ API セット: ExcelApi 1.14 ]

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-data-table.yaml

// This function adjusts the display and format of a chart data table that already exists on the worksheet.
await Excel.run(async (context) => {
  // Retrieve the chart named "SalesChart" from the "Sample" worksheet.
  const chart = context.workbook.worksheets.getItem("Sample").charts.getItem("SalesChart");

  // Get the chart data table object and load its properties.
  const chartDataTable = chart.getDataTableOrNullObject();
  chartDataTable.load();

  // Set the display properties of the chart data table.
  chartDataTable.showLegendKey = true;
  chartDataTable.showHorizontalBorder = false;
  chartDataTable.showVerticalBorder = true;
  chartDataTable.showOutlineBorder = true;

  // Retrieve the chart data table format object and set font and border properties. 
  const chartDataTableFormat = chartDataTable.format;
  chartDataTableFormat.font.color = "#B76E79";
  chartDataTableFormat.font.name = "Comic Sans";
  chartDataTableFormat.border.color = "blue";
  await context.sync();
});

showOutlineBorder

データ テーブルのアウトライン罫線を表示するかどうかを指定します。

showOutlineBorder: boolean;

プロパティ値

boolean

注釈

[ API セット: ExcelApi 1.14 ]

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-data-table.yaml

// This function adjusts the display and format of a chart data table that already exists on the worksheet.
await Excel.run(async (context) => {
  // Retrieve the chart named "SalesChart" from the "Sample" worksheet.
  const chart = context.workbook.worksheets.getItem("Sample").charts.getItem("SalesChart");

  // Get the chart data table object and load its properties.
  const chartDataTable = chart.getDataTableOrNullObject();
  chartDataTable.load();

  // Set the display properties of the chart data table.
  chartDataTable.showLegendKey = true;
  chartDataTable.showHorizontalBorder = false;
  chartDataTable.showVerticalBorder = true;
  chartDataTable.showOutlineBorder = true;

  // Retrieve the chart data table format object and set font and border properties. 
  const chartDataTableFormat = chartDataTable.format;
  chartDataTableFormat.font.color = "#B76E79";
  chartDataTableFormat.font.name = "Comic Sans";
  chartDataTableFormat.border.color = "blue";
  await context.sync();
});

showVerticalBorder

データ テーブルの垂直罫線を表示するかどうかを指定します。

showVerticalBorder: boolean;

プロパティ値

boolean

注釈

[ API セット: ExcelApi 1.14 ]

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-data-table.yaml

// This function adjusts the display and format of a chart data table that already exists on the worksheet.
await Excel.run(async (context) => {
  // Retrieve the chart named "SalesChart" from the "Sample" worksheet.
  const chart = context.workbook.worksheets.getItem("Sample").charts.getItem("SalesChart");

  // Get the chart data table object and load its properties.
  const chartDataTable = chart.getDataTableOrNullObject();
  chartDataTable.load();

  // Set the display properties of the chart data table.
  chartDataTable.showLegendKey = true;
  chartDataTable.showHorizontalBorder = false;
  chartDataTable.showVerticalBorder = true;
  chartDataTable.showOutlineBorder = true;

  // Retrieve the chart data table format object and set font and border properties. 
  const chartDataTableFormat = chartDataTable.format;
  chartDataTableFormat.font.color = "#B76E79";
  chartDataTableFormat.font.name = "Comic Sans";
  chartDataTableFormat.border.color = "blue";
  await context.sync();
});

visible

グラフのデータ テーブルを表示するかどうかを指定します。

visible: boolean;

プロパティ値

boolean

注釈

[ API セット: ExcelApi 1.14 ]

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/10-chart/chart-data-table.yaml

// This function adds a data table to a chart that already exists on the worksheet. 
await Excel.run(async (context) => {
  // Retrieve the chart named "SalesChart" from the "Sample" worksheet.
  const chart = context.workbook.worksheets.getItem("Sample").charts.getItem("SalesChart");

  // Get the data table object for the chart and set it to visible.
  const chartDataTable = chart.getDataTableOrNullObject();
  chartDataTable.load("visible");
  chartDataTable.visible = true;
  await context.sync();
});

メソッドの詳細

load(options)

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

load(options?: Excel.Interfaces.ChartDataTableLoadOptions): Excel.ChartDataTable;

パラメーター

options
Excel.Interfaces.ChartDataTableLoadOptions

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

戻り値

load(propertyNames)

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

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

パラメーター

propertyNames

string | string[]

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

戻り値

load(propertyNamesAndPaths)

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

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

パラメーター

propertyNamesAndPaths

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

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

戻り値

set(properties, options)

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

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

パラメーター

properties
Excel.Interfaces.ChartDataTableUpdateData

メソッドが呼び出されるオブジェクトのプロパティに等形的に構造化されたプロパティを持つ JavaScript オブジェクト。

options
OfficeExtension.UpdateOptions

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

戻り値

void

set(properties)

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

set(properties: Excel.ChartDataTable): void;

パラメーター

戻り値

void

toJSON()

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

toJSON(): Excel.Interfaces.ChartDataTableData;

戻り値