ExcelScript.ChartAxes interface
表示图表坐标轴。
注解
示例
/**
* This sample gets the chart axes and customizes them.
* 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];
// Access and customize the axes.
const axes = chart.getAxes();
axes.getValueAxis().setDisplayUnit(ExcelScript.ChartAxisDisplayUnit.thousands);
axes.getCategoryAxis().setVisible(true);
}
方法
| get |
表示图表中的类别轴。 |
| get |
返回通过类型和组标识的特定轴。 |
| get |
表示三维图表的系列轴。 |
| get |
表示坐标轴中的数值轴。 |
方法详细信息
getCategoryAxis()
表示图表中的类别轴。
getCategoryAxis(): ChartAxis;
返回
示例
/**
* This sample gets and customizes the category axis.
* 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];
// Get and customize the category axis.
const categoryAxis = chart.getAxes().getCategoryAxis();
categoryAxis.setTickLabelPosition(ExcelScript.ChartAxisTickLabelPosition.low);
}
getChartAxis(type, group)
返回通过类型和组标识的特定轴。
getChartAxis(type: ChartAxisType, group?: ChartAxisGroup): ChartAxis;
参数
指定坐标轴类型。 有关详细信息,请参阅 ExcelScript.ChartAxisType。
可选。 指定坐标轴组。 有关详细信息,请参阅 ExcelScript.ChartAxisGroup。
返回
getSeriesAxis()
getValueAxis()
表示坐标轴中的数值轴。
getValueAxis(): ChartAxis;
返回
示例
/**
* This sample gets and customizes the value axis.
* 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];
// Get and customize the value axis.
const valueAxis = chart.getAxes().getValueAxis();
valueAxis.setDisplayUnit(ExcelScript.ChartAxisDisplayUnit.thousands);
valueAxis.setMinimum(40000);
valueAxis.setMaximum(60000);
}