Edit

Share via


ExcelScript.ChartFill interface

Represents the fill formatting for a chart element.

Remarks

Examples

/**
 * This sample sets the fill color of a chart series.
 * This assumes the active worksheet has a stock chart (e.g., Volume-High-Low-Close).
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the first chart on the active worksheet.
  const sheet = workbook.getActiveWorksheet();
  const chart = sheet.getCharts()[0];
  
  // Set the fill color for the first series (volume).
  const volumeSeries = chart.getSeries()[0];
  volumeSeries.getFormat().getFill().setSolidColor("#B0C4DE");
}

Methods

clear()

Clears the fill color of a chart element.

getSolidColor()

Gets the uniform color fill formatting of a chart element.

setSolidColor(color)

Sets the fill formatting of a chart element to a uniform color.

Method Details

clear()

Clears the fill color of a chart element.

clear(): void;

Returns

void

getSolidColor()

Gets the uniform color fill formatting of a chart element.

getSolidColor(): string;

Returns

string

setSolidColor(color)

Sets the fill formatting of a chart element to a uniform color.

setSolidColor(color: string): void;

Parameters

color

string

HTML color code representing the color of the background, in the form #RRGGBB (e.g., "FFA500") or as a named HTML color (e.g., "orange").

Returns

void

Examples

/**
 * This sample sets a solid fill color for a chart series.
 * This assumes the active worksheet has a stock chart (e.g., Volume-Open-High-Low-Close).
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the first chart on the active worksheet.
  const sheet = workbook.getActiveWorksheet();
  const chart = sheet.getCharts()[0];
  
  // Set the fill color to light steel blue for the first series.
  const volumeSeries = chart.getSeries()[0];
  volumeSeries.getFormat().getFill().setSolidColor("#B0C4DE");
}