ExcelScript.ChartFill interface
表示图表元素的格式填充。
注解
示例
/**
* 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");
}
方法
| clear() | 清除图表元素的填充颜色。 |
| get |
获取图表元素的统一颜色填充格式。 |
| set |
将图表元素的填充格式设置为统一颜色。 |
方法详细信息
clear()
清除图表元素的填充颜色。
clear(): void;
返回
void
getSolidColor()
获取图表元素的统一颜色填充格式。
getSolidColor(): string;
返回
string
setSolidColor(color)
将图表元素的填充格式设置为统一颜色。
setSolidColor(color: string): void;
参数
- color
-
string
表示背景颜色的 HTML 颜色代码,格式 #RRGGBB (例如“FFA500”) 或命名的 HTML 颜色 (例如“orange”) 。
返回
void
示例
/**
* 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");
}