[]
Use this interface to format and position axis labels, including their font, number format, text direction, text orientation, and label offset. An ITickLabels object is returned by IAxis.getTickLabels().
worksheet.getRange("A1:B4").setValue(new Object[][] {
{"Month", "Sales"},
{"Jan", 1200}, {"Feb", 1500}, {"Mar", 1800}
});
IShape shape = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 360, 230);
shape.getChart().getSeriesCollection().add(worksheet.getRange("A1:B4"), RowCol.Columns, true, true);
IAxis categoryAxis = shape.getChart().getAxes().item(AxisType.Category);
ITickLabels tickLabels = categoryAxis.getTickLabels();
tickLabels.setDirection(TextDirection.Vertical);
getFont()IFontFormat object for the tick labels.booleanintintIAxis that contains these tick labels.voidsetDirection(TextDirection value) voidsetNumberFormat(String value) voidsetNumberFormatLinked(boolean value) voidsetOffset(int value) voidsetOrientation(int value) IFontFormat object for the tick labels.Use the returned font format to read or modify font settings for the text displayed in the chart axis tick labels.
worksheet.getRange("A1:B4").setValue(new Object[][] {
{"Month", "Sales"},
{"Jan", 1200},
{"Feb", 1500},
{"Mar", 1100}
});
IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 360, 220).getChart();
chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
IAxis axis = chart.getAxes().item(AxisType.Value, AxisGroup.Primary);
IFontFormat font = axis.getTickLabels().getFont();
font.getColor().setRGB(Color.GetBlue());
IFontFormat object for the tick labels.The returned format code controls how numeric values are displayed on the chart axis, such as currency, percentage, or decimal formatting.
worksheet.getRange("A1:B4").setValue(new Object[][] {
{"Month", "Sales"},
{"Jan", 1200},
{"Feb", 1500},
{"Mar", 1100}
});
worksheet.getRange("B2:B4").setNumberFormat("$#,##0");
IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 360, 220).getChart();
chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
IAxis axis = chart.getAxes().item(AxisType.Value, AxisGroup.Primary);
String numberFormat = axis.getTickLabels().getNumberFormat();
The returned format code controls how numeric values are displayed on the chart axis, such as currency, percentage, or decimal formatting.
worksheet.getRange("A1:B4").setValue(new Object[][] {
{"Month", "Sales"},
{"Jan", 1200},
{"Feb", 1500},
{"Mar", 1100}
});
worksheet.getRange("B2:B4").setNumberFormat("$#,##0");
IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 360, 220).getChart();
chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
IAxis axis = chart.getAxes().item(AxisType.Value, AxisGroup.Primary);
axis.getTickLabels().setNumberFormat("Sample");
value - The number format code for the tick labels.If this property is true, changes to the number format in the source cells are reflected in the axis tick labels.
worksheet.getRange("A1:B4").setValue(new Object[][] {
{"Month", "Sales"},
{"Jan", 1200},
{"Feb", 1500},
{"Mar", 1100}
});
IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 360, 220).getChart();
chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
IAxis axis = chart.getAxes().item(AxisType.Category, AxisGroup.Primary);
axis.getTickLabels().setNumberFormatLinked(false);
boolean linked = axis.getTickLabels().getNumberFormatLinked();
true if the tick label number format is linked to the source cells; otherwise, false.If this property is true, changes to the number format in the source cells are reflected in the axis tick labels.
worksheet.getRange("A1:B4").setValue(new Object[][] {
{"Month", "Sales"},
{"Jan", 1200},
{"Feb", 1500},
{"Mar", 1100}
});
IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 360, 220).getChart();
chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
IAxis axis = chart.getAxes().item(AxisType.Category, AxisGroup.Primary);
axis.getTickLabels().setNumberFormatLinked(false);
value - true if the tick label number format is linked to the source cells; otherwise, false.Use this property to read the current spacing applied to tick-mark labels on a chart axis.
worksheet.getRange("A1:B4").setValue(new Object[][] {
{"Month", "Sales"},
{"Jan", 120},
{"Feb", 150},
{"Mar", 110}
});
IShape shape = worksheet.getShapes().addChart(ChartType.ColumnClustered, worksheet.getRange("A1:B4"));
IAxis axis = shape.getChart().getAxes().item(AxisType.Category);
int offset = axis.getTickLabels().getOffset();
Use this property to set the spacing applied to tick-mark labels on a chart axis.
worksheet.getRange("A1:B4").setValue(new Object[][] {
{"Month", "Sales"},
{"Jan", 120},
{"Feb", 150},
{"Mar", 110}
});
IShape shape = worksheet.getShapes().addChart(ChartType.ColumnClustered, worksheet.getRange("A1:B4"));
IAxis axis = shape.getChart().getAxes().item(AxisType.Category);
axis.getTickLabels().setOffset(0);
value - The distance between label levels and between the first label level and the axis line.The returned value represents the rotation angle of the tick-mark label text, in degrees.
worksheet.getRange("A1:B3").setValue(new Object[][] {
{"Month", "Sales"},
{"Jan", 100},
{"Feb", 200}
});
IShape shape = worksheet.getShapes().addChart(ChartType.ColumnClustered, worksheet.getRange("A1:B3"));
IAxis axis = shape.getChart().getAxes().item(AxisType.Category);
int orientation = axis.getTickLabels().getOrientation();
Set this property to specify the rotation angle of the tick-mark label text, in degrees.
worksheet.getRange("A1:B3").setValue(new Object[][] {
{"Month", "Sales"},
{"Jan", 100},
{"Feb", 200}
});
IShape shape = worksheet.getShapes().addChart(ChartType.ColumnClustered, worksheet.getRange("A1:B3"));
IAxis axis = shape.getChart().getAxes().item(AxisType.Category);
axis.getTickLabels().setOrientation(0);
value - The text orientation of the tick-mark labels, in degrees.Use this method to determine how the text in chart axis tick labels is oriented, such as horizontal or vertical layout.
worksheet.getRange("A1:B4").setValue(new Object[][] {
{"Month", "Sales"},
{"Jan", 1200},
{"Feb", 1500},
{"Mar", 1100}
});
IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 360, 220).getChart();
chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
IAxis axis = chart.getAxes().item(AxisType.Category, AxisGroup.Primary);
TextDirection direction = axis.getTickLabels().getDirection();
TextDirection value that specifies the text direction for the tick-mark labels.Use this method to control how the axis tick-label text is displayed, such as horizontal or vertical layout.
worksheet.getRange("A1:B4").setValue(new Object[][] {
{"Month", "Sales"},
{"Jan", 1200},
{"Feb", 1500},
{"Mar", 1100}
});
IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 360, 220).getChart();
chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
IAxis axis = chart.getAxes().item(AxisType.Category, AxisGroup.Primary);
axis.getTickLabels().setDirection(TextDirection.Vertical);
value - The text direction to apply to the tick-mark labels.IAxis that contains these tick labels.Use this method to access the axis associated with the current tick labels when you need to continue configuring the axis after working with its labels.
worksheet.getRange("A1:B3").setValue(new Object[][] {
{"Month", "Sales"},
{"Jan", 100},
{"Feb", 200}
});
IShape shape = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 360, 230);
shape.getChart().getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns, true, true);
IAxis parentAxis = shape.getChart().getAxes().item(AxisType.Category).getTickLabels().getParent();
IAxis that contains these tick labels.