Compartilhar via


ExcelScript.ChartLegend interface

Representa a legenda de um gráfico.

Comentários

Exemplos

/**
 * This sample configures the chart legend.
 * This assumes the active worksheet has a chart.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the first chart on the active worksheet.
  const sheet = workbook.getActiveWorksheet();
  const chart = sheet.getCharts()[0];
  
  // Configure the legend.
  const legend = chart.getLegend();
  legend.setPosition(ExcelScript.ChartLegendPosition.bottom);
  legend.setVisible(true);
}

Métodos

getFormat()

Representa a formatação de uma legenda de gráfico, que inclui a formatação de fonte e de preenchimento.

getHeight()

Especifica a altura, em pontos, da legenda no gráfico. O valor é null se a legenda não estiver visível.

getLeft()

Especifica o valor esquerdo, em pontos, da legenda no gráfico. O valor é null se a legenda não estiver visível.

getLegendEntries()

Representa uma coleção de legendEntries na legenda.

getOverlay()

Especifica se a legenda do gráfico deve sobrepor-se ao corpo principal do gráfico.

getPosition()

Especifica a posição da legenda no gráfico. Veja ExcelScript.ChartLegendPosition para obter detalhes.

getShowShadow()

Especifica se a legenda tem uma sombra no gráfico.

getTop()

Especifica a parte superior de uma legenda de gráfico.

getVisible()

Especifica se a legenda do gráfico está visível.

getWidth()

Especifica a largura, em pontos, da legenda no gráfico. O valor é null se a legenda não estiver visível.

setHeight(height)

Especifica a altura, em pontos, da legenda no gráfico. O valor é null se a legenda não estiver visível.

setLeft(left)

Especifica o valor esquerdo, em pontos, da legenda no gráfico. O valor é null se a legenda não estiver visível.

setOverlay(overlay)

Especifica se a legenda do gráfico deve sobrepor-se ao corpo principal do gráfico.

setPosition(position)

Especifica a posição da legenda no gráfico. Veja ExcelScript.ChartLegendPosition para obter detalhes.

setShowShadow(showShadow)

Especifica se a legenda tem uma sombra no gráfico.

setTop(top)

Especifica a parte superior de uma legenda de gráfico.

setVisible(visible)

Especifica se a legenda do gráfico está visível.

setWidth(width)

Especifica a largura, em pontos, da legenda no gráfico. O valor é null se a legenda não estiver visível.

Detalhes do método

getFormat()

Representa a formatação de uma legenda de gráfico, que inclui a formatação de fonte e de preenchimento.

getFormat(): ChartLegendFormat;

Retornos

getHeight()

Especifica a altura, em pontos, da legenda no gráfico. O valor é null se a legenda não estiver visível.

getHeight(): number;

Retornos

number

getLeft()

Especifica o valor esquerdo, em pontos, da legenda no gráfico. O valor é null se a legenda não estiver visível.

getLeft(): number;

Retornos

number

getLegendEntries()

Representa uma coleção de legendEntries na legenda.

getLegendEntries(): ChartLegendEntry[];

Retornos

getOverlay()

Especifica se a legenda do gráfico deve sobrepor-se ao corpo principal do gráfico.

getOverlay(): boolean;

Retornos

boolean

getPosition()

Especifica a posição da legenda no gráfico. Veja ExcelScript.ChartLegendPosition para obter detalhes.

getPosition(): ChartLegendPosition;

Retornos

getShowShadow()

Especifica se a legenda tem uma sombra no gráfico.

getShowShadow(): boolean;

Retornos

boolean

getTop()

Especifica a parte superior de uma legenda de gráfico.

getTop(): number;

Retornos

number

getVisible()

Especifica se a legenda do gráfico está visível.

getVisible(): boolean;

Retornos

boolean

getWidth()

Especifica a largura, em pontos, da legenda no gráfico. O valor é null se a legenda não estiver visível.

getWidth(): number;

Retornos

number

setHeight(height)

Especifica a altura, em pontos, da legenda no gráfico. O valor é null se a legenda não estiver visível.

setHeight(height: number): void;

Parâmetros

height

number

Retornos

void

setLeft(left)

Especifica o valor esquerdo, em pontos, da legenda no gráfico. O valor é null se a legenda não estiver visível.

setLeft(left: number): void;

Parâmetros

left

number

Retornos

void

setOverlay(overlay)

Especifica se a legenda do gráfico deve sobrepor-se ao corpo principal do gráfico.

setOverlay(overlay: boolean): void;

Parâmetros

overlay

boolean

Retornos

void

setPosition(position)

Especifica a posição da legenda no gráfico. Veja ExcelScript.ChartLegendPosition para obter detalhes.

setPosition(position: ChartLegendPosition): void;

Parâmetros

Retornos

void

Exemplos

/**
 * This sample sets the legend position on a chart.
 * This assumes the active worksheet has a chart.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the first chart on the active worksheet.
  const sheet = workbook.getActiveWorksheet();
  const chart = sheet.getCharts()[0];
  
  // Position the legend on the right side.
  chart.getLegend().setPosition(ExcelScript.ChartLegendPosition.right);
}

setShowShadow(showShadow)

Especifica se a legenda tem uma sombra no gráfico.

setShowShadow(showShadow: boolean): void;

Parâmetros

showShadow

boolean

Retornos

void

setTop(top)

Especifica a parte superior de uma legenda de gráfico.

setTop(top: number): void;

Parâmetros

top

number

Retornos

void

setVisible(visible)

Especifica se a legenda do gráfico está visível.

setVisible(visible: boolean): void;

Parâmetros

visible

boolean

Retornos

void

Exemplos

/**
 * This sample hides the chart legend.
 * This assumes the active worksheet has a chart.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the first chart on the active worksheet.
  const sheet = workbook.getActiveWorksheet();
  const chart = sheet.getCharts()[0];
  
  // Hide the legend.
  chart.getLegend().setVisible(false);
}

setWidth(width)

Especifica a largura, em pontos, da legenda no gráfico. O valor é null se a legenda não estiver visível.

setWidth(width: number): void;

Parâmetros

width

number

Retornos

void