ExcelScript.ChartAxes interface
Represents the chart axes.
Remarks
Examples
/**
* 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);
}
Methods
| get |
Represents the category axis in a chart. |
| get |
Returns the specific axis identified by type and group. |
| get |
Represents the series axis of a 3-D chart. |
| get |
Represents the value axis in an axis. |
Method Details
getCategoryAxis()
Represents the category axis in a chart.
getCategoryAxis(): ChartAxis;
Returns
Examples
/**
* 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)
Returns the specific axis identified by type and group.
getChartAxis(type: ChartAxisType, group?: ChartAxisGroup): ChartAxis;
Parameters
Specifies the axis type. See ExcelScript.ChartAxisType for details.
Optional. Specifies the axis group. See ExcelScript.ChartAxisGroup for details.
Returns
getSeriesAxis()
Represents the series axis of a 3-D chart.
getSeriesAxis(): ChartAxis;
Returns
getValueAxis()
Represents the value axis in an axis.
getValueAxis(): ChartAxis;
Returns
Examples
/**
* 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);
}