Excel.ChartDataTable class

Representa el objeto de tabla de datos de un gráfico.

Extends

Comentarios

[ Conjunto de API: ExcelApi 1.14 ]

Propiedades

context

Contexto de solicitud asociado al objeto . Esto conecta el proceso del complemento al proceso de la aplicación host de Office.

format

Representa el formato de una tabla de datos de gráfico, que incluye el formato de relleno, fuente y borde.

showHorizontalBorder

Especifica si se va a mostrar el borde horizontal de la tabla de datos.

showLegendKey

Especifica si se va a mostrar la clave de leyenda de la tabla de datos.

showOutlineBorder

Especifica si se va a mostrar el borde de esquema de la tabla de datos.

showVerticalBorder

Especifica si se va a mostrar el borde vertical de la tabla de datos.

visible

Especifica si se va a mostrar la tabla de datos del gráfico.

Métodos

load(options)

Pone en cola un comando para cargar las propiedades especificadas del objeto. Debe llamar a context.sync() antes de leer las propiedades.

load(propertyNames)

Pone en cola un comando para cargar las propiedades especificadas del objeto. Debe llamar a context.sync() antes de leer las propiedades.

load(propertyNamesAndPaths)

Pone en cola un comando para cargar las propiedades especificadas del objeto. Debe llamar a context.sync() antes de leer las propiedades.

set(properties, options)

Establece varias propiedades de un objeto al mismo tiempo. Puede pasar un objeto sin formato con las propiedades adecuadas u otro objeto de API del mismo tipo.

set(properties)

Establece varias propiedades en el objeto al mismo tiempo, en función de un objeto cargado existente.

toJSON()

Invalida el método JavaScript toJSON() para proporcionar una salida más útil cuando se pasa un objeto de API a JSON.stringify(). (JSON.stringifya su vez, llama al toJSON método del objeto que se le pasa). Mientras que el objeto Excel.ChartDataTable original es un objeto de API, el toJSON método devuelve un objeto JavaScript sin formato (escrito como Excel.Interfaces.ChartDataTableData) que contiene copias superficiales de las propiedades secundarias cargadas del objeto original.

Detalles de las propiedades

context

Contexto de solicitud asociado al objeto . Esto conecta el proceso del complemento al proceso de la aplicación host de Office.

context: RequestContext;

Valor de propiedad

format

Representa el formato de una tabla de datos de gráfico, que incluye el formato de relleno, fuente y borde.

readonly format: Excel.ChartDataTableFormat;

Valor de propiedad

Comentarios

[ Conjunto de API: ExcelApi 1.14 ]

Ejemplos

// 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

Especifica si se va a mostrar el borde horizontal de la tabla de datos.

showHorizontalBorder: boolean;

Valor de propiedad

boolean

Comentarios

[ Conjunto de API: ExcelApi 1.14 ]

Ejemplos

// 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

Especifica si se va a mostrar la clave de leyenda de la tabla de datos.

showLegendKey: boolean;

Valor de propiedad

boolean

Comentarios

[ Conjunto de API: ExcelApi 1.14 ]

Ejemplos

// 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

Especifica si se va a mostrar el borde de esquema de la tabla de datos.

showOutlineBorder: boolean;

Valor de propiedad

boolean

Comentarios

[ Conjunto de API: ExcelApi 1.14 ]

Ejemplos

// 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

Especifica si se va a mostrar el borde vertical de la tabla de datos.

showVerticalBorder: boolean;

Valor de propiedad

boolean

Comentarios

[ Conjunto de API: ExcelApi 1.14 ]

Ejemplos

// 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

Especifica si se va a mostrar la tabla de datos del gráfico.

visible: boolean;

Valor de propiedad

boolean

Comentarios

[ Conjunto de API: ExcelApi 1.14 ]

Ejemplos

// 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();
});

Detalles del método

load(options)

Pone en cola un comando para cargar las propiedades especificadas del objeto. Debe llamar a context.sync() antes de leer las propiedades.

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

Parámetros

options
Excel.Interfaces.ChartDataTableLoadOptions

Proporciona opciones para las propiedades del objeto que se van a cargar.

Devoluciones

load(propertyNames)

Pone en cola un comando para cargar las propiedades especificadas del objeto. Debe llamar a context.sync() antes de leer las propiedades.

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

Parámetros

propertyNames

string | string[]

Una cadena delimitada por comas o una matriz de cadenas que especifican las propiedades que se van a cargar.

Devoluciones

load(propertyNamesAndPaths)

Pone en cola un comando para cargar las propiedades especificadas del objeto. Debe llamar a context.sync() antes de leer las propiedades.

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

Parámetros

propertyNamesAndPaths

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

propertyNamesAndPaths.select es una cadena delimitada por comas que especifica las propiedades que se van a cargar y propertyNamesAndPaths.expand es una cadena delimitada por comas que especifica las propiedades de navegación que se van a cargar.

Devoluciones

set(properties, options)

Establece varias propiedades de un objeto al mismo tiempo. Puede pasar un objeto sin formato con las propiedades adecuadas u otro objeto de API del mismo tipo.

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

Parámetros

properties
Excel.Interfaces.ChartDataTableUpdateData

Objeto JavaScript con propiedades estructuradas isomórficamente con las propiedades del objeto al que se llama al método.

options
OfficeExtension.UpdateOptions

Proporciona una opción para suprimir errores si el objeto properties intenta establecer propiedades de solo lectura.

Devoluciones

void

set(properties)

Establece varias propiedades en el objeto al mismo tiempo, en función de un objeto cargado existente.

set(properties: Excel.ChartDataTable): void;

Parámetros

Devoluciones

void

toJSON()

Invalida el método JavaScript toJSON() para proporcionar una salida más útil cuando se pasa un objeto de API a JSON.stringify(). (JSON.stringifya su vez, llama al toJSON método del objeto que se le pasa). Mientras que el objeto Excel.ChartDataTable original es un objeto de API, el toJSON método devuelve un objeto JavaScript sin formato (escrito como Excel.Interfaces.ChartDataTableData) que contiene copias superficiales de las propiedades secundarias cargadas del objeto original.

toJSON(): Excel.Interfaces.ChartDataTableData;

Devoluciones