java.lang.Object
com.aspose.words.AxisTickLabels
public class AxisTickLabels
Example:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.COLUMN, 500.0, 300.0);
Chart chart = shape.getChart();
// Clear the chart's demo data series to start with a clean chart.
chart.getSeries().clear();
// Insert a chart series with categories for the X-axis and respective numeric values for the Y-axis.
chart.getSeries().add("Aspose Test Series",
new String[]{"Word", "PDF", "Excel", "GoogleDocs", "Note"},
new double[]{640.0, 320.0, 280.0, 120.0, 150.0});
// Chart axes have various options that can change their appearance,
// such as their direction, major/minor unit ticks, and tick marks.
ChartAxis xAxis = chart.getAxisX();
xAxis.setCategoryType(AxisCategoryType.CATEGORY);
xAxis.setCrosses(AxisCrosses.MINIMUM);
xAxis.setReverseOrder(false);
xAxis.setMajorTickMark(AxisTickMark.INSIDE);
xAxis.setMinorTickMark(AxisTickMark.CROSS);
xAxis.setMajorUnit(10.0d);
xAxis.setMinorUnit(15.0d);
xAxis.getTickLabels().setOffset(50);
xAxis.getTickLabels().setPosition(AxisTickLabelPosition.LOW);
xAxis.getTickLabels().isAutoSpacing(false);
xAxis.setTickMarkSpacing(1);
ChartAxis yAxis = chart.getAxisY();
yAxis.setCategoryType(AxisCategoryType.AUTOMATIC);
yAxis.setCrosses(AxisCrosses.MAXIMUM);
yAxis.setReverseOrder(true);
yAxis.setMajorTickMark(AxisTickMark.INSIDE);
yAxis.setMinorTickMark(AxisTickMark.CROSS);
yAxis.setMajorUnit(100.0d);
yAxis.setMinorUnit(20.0d);
yAxis.getTickLabels().setPosition(AxisTickLabelPosition.NEXT_TO_AXIS);
yAxis.getTickLabels().setAlignment(ParagraphAlignment.CENTER);
yAxis.getTickLabels().getFont().setColor(Color.RED);
yAxis.getTickLabels().setSpacing(1);
// Column charts do not have a Z-axis.
Assert.assertNull(chart.getAxisZ());
doc.save(getArtifactsDir() + "Charts.AxisProperties.docx");
| Property Getters/Setters Summary | ||
|---|---|---|
int | getAlignment() | |
void | setAlignment(int value) | |
| Gets or sets text alignment of the axis tick labels. The value of the property is ParagraphAlignment integer constant. | ||
Font | getFont() | |
| Provides access to font formatting of the tick labels. | ||
boolean | isAutoSpacing() | |
void | isAutoSpacing(boolean value) | |
| Gets or sets a flag indicating whether to use automatic interval for drawing the tick labels. | ||
int | getOffset() | |
void | setOffset(int value) | |
| Gets or sets the distance of the tick labels from the axis. | ||
int | getOrientation() | |
void | setOrientation(int value) | |
| Gets or sets the orientation of the tick label text. The value of the property is ShapeTextOrientation integer constant. | ||
int | getPosition() | |
void | setPosition(int value) | |
| Gets or sets the position of the tick labels on the axis. The value of the property is AxisTickLabelPosition integer constant. | ||
int | getRotation() | |
void | setRotation(int value) | |
| Gets or sets the rotation of the tick labels in degrees. | ||
int | getSpacing() | |
void | setSpacing(int value) | |
| Gets or sets the interval at which the tick labels are drawn. | ||
| Property Getters/Setters Detail |
|---|
getAlignment/setAlignment | |
public int getAlignment() / public void setAlignment(int value) | |
This property has effect only for multi-line labels.
The default value is
Example:
Shows how to insert a chart and modify the appearance of its axes.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.COLUMN, 500.0, 300.0);
Chart chart = shape.getChart();
// Clear the chart's demo data series to start with a clean chart.
chart.getSeries().clear();
// Insert a chart series with categories for the X-axis and respective numeric values for the Y-axis.
chart.getSeries().add("Aspose Test Series",
new String[]{"Word", "PDF", "Excel", "GoogleDocs", "Note"},
new double[]{640.0, 320.0, 280.0, 120.0, 150.0});
// Chart axes have various options that can change their appearance,
// such as their direction, major/minor unit ticks, and tick marks.
ChartAxis xAxis = chart.getAxisX();
xAxis.setCategoryType(AxisCategoryType.CATEGORY);
xAxis.setCrosses(AxisCrosses.MINIMUM);
xAxis.setReverseOrder(false);
xAxis.setMajorTickMark(AxisTickMark.INSIDE);
xAxis.setMinorTickMark(AxisTickMark.CROSS);
xAxis.setMajorUnit(10.0d);
xAxis.setMinorUnit(15.0d);
xAxis.getTickLabels().setOffset(50);
xAxis.getTickLabels().setPosition(AxisTickLabelPosition.LOW);
xAxis.getTickLabels().isAutoSpacing(false);
xAxis.setTickMarkSpacing(1);
ChartAxis yAxis = chart.getAxisY();
yAxis.setCategoryType(AxisCategoryType.AUTOMATIC);
yAxis.setCrosses(AxisCrosses.MAXIMUM);
yAxis.setReverseOrder(true);
yAxis.setMajorTickMark(AxisTickMark.INSIDE);
yAxis.setMinorTickMark(AxisTickMark.CROSS);
yAxis.setMajorUnit(100.0d);
yAxis.setMinorUnit(20.0d);
yAxis.getTickLabels().setPosition(AxisTickLabelPosition.NEXT_TO_AXIS);
yAxis.getTickLabels().setAlignment(ParagraphAlignment.CENTER);
yAxis.getTickLabels().getFont().setColor(Color.RED);
yAxis.getTickLabels().setSpacing(1);
// Column charts do not have a Z-axis.
Assert.assertNull(chart.getAxisZ());
doc.save(getArtifactsDir() + "Charts.AxisProperties.docx");getFont | |
public Font getFont() | |
Example:
Shows how to insert a chart and modify the appearance of its axes.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.COLUMN, 500.0, 300.0);
Chart chart = shape.getChart();
// Clear the chart's demo data series to start with a clean chart.
chart.getSeries().clear();
// Insert a chart series with categories for the X-axis and respective numeric values for the Y-axis.
chart.getSeries().add("Aspose Test Series",
new String[]{"Word", "PDF", "Excel", "GoogleDocs", "Note"},
new double[]{640.0, 320.0, 280.0, 120.0, 150.0});
// Chart axes have various options that can change their appearance,
// such as their direction, major/minor unit ticks, and tick marks.
ChartAxis xAxis = chart.getAxisX();
xAxis.setCategoryType(AxisCategoryType.CATEGORY);
xAxis.setCrosses(AxisCrosses.MINIMUM);
xAxis.setReverseOrder(false);
xAxis.setMajorTickMark(AxisTickMark.INSIDE);
xAxis.setMinorTickMark(AxisTickMark.CROSS);
xAxis.setMajorUnit(10.0d);
xAxis.setMinorUnit(15.0d);
xAxis.getTickLabels().setOffset(50);
xAxis.getTickLabels().setPosition(AxisTickLabelPosition.LOW);
xAxis.getTickLabels().isAutoSpacing(false);
xAxis.setTickMarkSpacing(1);
ChartAxis yAxis = chart.getAxisY();
yAxis.setCategoryType(AxisCategoryType.AUTOMATIC);
yAxis.setCrosses(AxisCrosses.MAXIMUM);
yAxis.setReverseOrder(true);
yAxis.setMajorTickMark(AxisTickMark.INSIDE);
yAxis.setMinorTickMark(AxisTickMark.CROSS);
yAxis.setMajorUnit(100.0d);
yAxis.setMinorUnit(20.0d);
yAxis.getTickLabels().setPosition(AxisTickLabelPosition.NEXT_TO_AXIS);
yAxis.getTickLabels().setAlignment(ParagraphAlignment.CENTER);
yAxis.getTickLabels().getFont().setColor(Color.RED);
yAxis.getTickLabels().setSpacing(1);
// Column charts do not have a Z-axis.
Assert.assertNull(chart.getAxisZ());
doc.save(getArtifactsDir() + "Charts.AxisProperties.docx");isAutoSpacing/isAutoSpacing | |
public boolean isAutoSpacing() / public void isAutoSpacing(boolean value) | |
The default value is true.
The property has effect for text category and series axes. It is not supported by MS Office 2016 new charts.
Example:
Shows how to insert a chart and modify the appearance of its axes.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.COLUMN, 500.0, 300.0);
Chart chart = shape.getChart();
// Clear the chart's demo data series to start with a clean chart.
chart.getSeries().clear();
// Insert a chart series with categories for the X-axis and respective numeric values for the Y-axis.
chart.getSeries().add("Aspose Test Series",
new String[]{"Word", "PDF", "Excel", "GoogleDocs", "Note"},
new double[]{640.0, 320.0, 280.0, 120.0, 150.0});
// Chart axes have various options that can change their appearance,
// such as their direction, major/minor unit ticks, and tick marks.
ChartAxis xAxis = chart.getAxisX();
xAxis.setCategoryType(AxisCategoryType.CATEGORY);
xAxis.setCrosses(AxisCrosses.MINIMUM);
xAxis.setReverseOrder(false);
xAxis.setMajorTickMark(AxisTickMark.INSIDE);
xAxis.setMinorTickMark(AxisTickMark.CROSS);
xAxis.setMajorUnit(10.0d);
xAxis.setMinorUnit(15.0d);
xAxis.getTickLabels().setOffset(50);
xAxis.getTickLabels().setPosition(AxisTickLabelPosition.LOW);
xAxis.getTickLabels().isAutoSpacing(false);
xAxis.setTickMarkSpacing(1);
ChartAxis yAxis = chart.getAxisY();
yAxis.setCategoryType(AxisCategoryType.AUTOMATIC);
yAxis.setCrosses(AxisCrosses.MAXIMUM);
yAxis.setReverseOrder(true);
yAxis.setMajorTickMark(AxisTickMark.INSIDE);
yAxis.setMinorTickMark(AxisTickMark.CROSS);
yAxis.setMajorUnit(100.0d);
yAxis.setMinorUnit(20.0d);
yAxis.getTickLabels().setPosition(AxisTickLabelPosition.NEXT_TO_AXIS);
yAxis.getTickLabels().setAlignment(ParagraphAlignment.CENTER);
yAxis.getTickLabels().getFont().setColor(Color.RED);
yAxis.getTickLabels().setSpacing(1);
// Column charts do not have a Z-axis.
Assert.assertNull(chart.getAxisZ());
doc.save(getArtifactsDir() + "Charts.AxisProperties.docx");getOffset/setOffset | |
public int getOffset() / public void setOffset(int value) | |
The property represents a percentage of the default label offset.
Valid range is from 0 to 1000 percent inclusive. The default value is 100%.
The property has effect only for category axes. It is not supported by MS Office 2016 new charts.
Example:
Shows how to insert a chart and modify the appearance of its axes.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.COLUMN, 500.0, 300.0);
Chart chart = shape.getChart();
// Clear the chart's demo data series to start with a clean chart.
chart.getSeries().clear();
// Insert a chart series with categories for the X-axis and respective numeric values for the Y-axis.
chart.getSeries().add("Aspose Test Series",
new String[]{"Word", "PDF", "Excel", "GoogleDocs", "Note"},
new double[]{640.0, 320.0, 280.0, 120.0, 150.0});
// Chart axes have various options that can change their appearance,
// such as their direction, major/minor unit ticks, and tick marks.
ChartAxis xAxis = chart.getAxisX();
xAxis.setCategoryType(AxisCategoryType.CATEGORY);
xAxis.setCrosses(AxisCrosses.MINIMUM);
xAxis.setReverseOrder(false);
xAxis.setMajorTickMark(AxisTickMark.INSIDE);
xAxis.setMinorTickMark(AxisTickMark.CROSS);
xAxis.setMajorUnit(10.0d);
xAxis.setMinorUnit(15.0d);
xAxis.getTickLabels().setOffset(50);
xAxis.getTickLabels().setPosition(AxisTickLabelPosition.LOW);
xAxis.getTickLabels().isAutoSpacing(false);
xAxis.setTickMarkSpacing(1);
ChartAxis yAxis = chart.getAxisY();
yAxis.setCategoryType(AxisCategoryType.AUTOMATIC);
yAxis.setCrosses(AxisCrosses.MAXIMUM);
yAxis.setReverseOrder(true);
yAxis.setMajorTickMark(AxisTickMark.INSIDE);
yAxis.setMinorTickMark(AxisTickMark.CROSS);
yAxis.setMajorUnit(100.0d);
yAxis.setMinorUnit(20.0d);
yAxis.getTickLabels().setPosition(AxisTickLabelPosition.NEXT_TO_AXIS);
yAxis.getTickLabels().setAlignment(ParagraphAlignment.CENTER);
yAxis.getTickLabels().getFont().setColor(Color.RED);
yAxis.getTickLabels().setSpacing(1);
// Column charts do not have a Z-axis.
Assert.assertNull(chart.getAxisZ());
doc.save(getArtifactsDir() + "Charts.AxisProperties.docx");getOrientation/setOrientation | |
public int getOrientation() / public void setOrientation(int value) | |
The default value is
Note that some
Example:
Shows how to change orientation and rotation for axis tick labels.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Insert a column chart. Shape shape = builder.insertChart(ChartType.COLUMN, 432.0, 252.0); AxisTickLabels xTickLabels = shape.getChart().getAxisX().getTickLabels(); AxisTickLabels yTickLabels = shape.getChart().getAxisY().getTickLabels(); // Set axis tick label orientation and rotation. xTickLabels.setOrientation(ShapeTextOrientation.VERTICAL_FAR_EAST); xTickLabels.setRotation(-30); yTickLabels.setOrientation(ShapeTextOrientation.HORIZONTAL); yTickLabels.setRotation(45); doc.save(getArtifactsDir() + "Charts.TickLabelsOrientationRotation.docx");
getPosition/setPosition | |
public int getPosition() / public void setPosition(int value) | |
Example:
Shows how to insert a chart and modify the appearance of its axes.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.COLUMN, 500.0, 300.0);
Chart chart = shape.getChart();
// Clear the chart's demo data series to start with a clean chart.
chart.getSeries().clear();
// Insert a chart series with categories for the X-axis and respective numeric values for the Y-axis.
chart.getSeries().add("Aspose Test Series",
new String[]{"Word", "PDF", "Excel", "GoogleDocs", "Note"},
new double[]{640.0, 320.0, 280.0, 120.0, 150.0});
// Chart axes have various options that can change their appearance,
// such as their direction, major/minor unit ticks, and tick marks.
ChartAxis xAxis = chart.getAxisX();
xAxis.setCategoryType(AxisCategoryType.CATEGORY);
xAxis.setCrosses(AxisCrosses.MINIMUM);
xAxis.setReverseOrder(false);
xAxis.setMajorTickMark(AxisTickMark.INSIDE);
xAxis.setMinorTickMark(AxisTickMark.CROSS);
xAxis.setMajorUnit(10.0d);
xAxis.setMinorUnit(15.0d);
xAxis.getTickLabels().setOffset(50);
xAxis.getTickLabels().setPosition(AxisTickLabelPosition.LOW);
xAxis.getTickLabels().isAutoSpacing(false);
xAxis.setTickMarkSpacing(1);
ChartAxis yAxis = chart.getAxisY();
yAxis.setCategoryType(AxisCategoryType.AUTOMATIC);
yAxis.setCrosses(AxisCrosses.MAXIMUM);
yAxis.setReverseOrder(true);
yAxis.setMajorTickMark(AxisTickMark.INSIDE);
yAxis.setMinorTickMark(AxisTickMark.CROSS);
yAxis.setMajorUnit(100.0d);
yAxis.setMinorUnit(20.0d);
yAxis.getTickLabels().setPosition(AxisTickLabelPosition.NEXT_TO_AXIS);
yAxis.getTickLabels().setAlignment(ParagraphAlignment.CENTER);
yAxis.getTickLabels().getFont().setColor(Color.RED);
yAxis.getTickLabels().setSpacing(1);
// Column charts do not have a Z-axis.
Assert.assertNull(chart.getAxisZ());
doc.save(getArtifactsDir() + "Charts.AxisProperties.docx");getRotation/setRotation | |
public int getRotation() / public void setRotation(int value) | |
Example:
Shows how to change orientation and rotation for axis tick labels.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Insert a column chart. Shape shape = builder.insertChart(ChartType.COLUMN, 432.0, 252.0); AxisTickLabels xTickLabels = shape.getChart().getAxisX().getTickLabels(); AxisTickLabels yTickLabels = shape.getChart().getAxisY().getTickLabels(); // Set axis tick label orientation and rotation. xTickLabels.setOrientation(ShapeTextOrientation.VERTICAL_FAR_EAST); xTickLabels.setRotation(-30); yTickLabels.setOrientation(ShapeTextOrientation.HORIZONTAL); yTickLabels.setRotation(45); doc.save(getArtifactsDir() + "Charts.TickLabelsOrientationRotation.docx");
getSpacing/setSpacing | |
public int getSpacing() / public void setSpacing(int value) | |
The property has effect for text category and series axes. It is not supported by MS Office 2016 new charts. Valid range of a value is greater than or equal to 1.
Setting this property sets the false.
Example:
Shows how to insert a chart and modify the appearance of its axes.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.COLUMN, 500.0, 300.0);
Chart chart = shape.getChart();
// Clear the chart's demo data series to start with a clean chart.
chart.getSeries().clear();
// Insert a chart series with categories for the X-axis and respective numeric values for the Y-axis.
chart.getSeries().add("Aspose Test Series",
new String[]{"Word", "PDF", "Excel", "GoogleDocs", "Note"},
new double[]{640.0, 320.0, 280.0, 120.0, 150.0});
// Chart axes have various options that can change their appearance,
// such as their direction, major/minor unit ticks, and tick marks.
ChartAxis xAxis = chart.getAxisX();
xAxis.setCategoryType(AxisCategoryType.CATEGORY);
xAxis.setCrosses(AxisCrosses.MINIMUM);
xAxis.setReverseOrder(false);
xAxis.setMajorTickMark(AxisTickMark.INSIDE);
xAxis.setMinorTickMark(AxisTickMark.CROSS);
xAxis.setMajorUnit(10.0d);
xAxis.setMinorUnit(15.0d);
xAxis.getTickLabels().setOffset(50);
xAxis.getTickLabels().setPosition(AxisTickLabelPosition.LOW);
xAxis.getTickLabels().isAutoSpacing(false);
xAxis.setTickMarkSpacing(1);
ChartAxis yAxis = chart.getAxisY();
yAxis.setCategoryType(AxisCategoryType.AUTOMATIC);
yAxis.setCrosses(AxisCrosses.MAXIMUM);
yAxis.setReverseOrder(true);
yAxis.setMajorTickMark(AxisTickMark.INSIDE);
yAxis.setMinorTickMark(AxisTickMark.CROSS);
yAxis.setMajorUnit(100.0d);
yAxis.setMinorUnit(20.0d);
yAxis.getTickLabels().setPosition(AxisTickLabelPosition.NEXT_TO_AXIS);
yAxis.getTickLabels().setAlignment(ParagraphAlignment.CENTER);
yAxis.getTickLabels().getFont().setColor(Color.RED);
yAxis.getTickLabels().setSpacing(1);
// Column charts do not have a Z-axis.
Assert.assertNull(chart.getAxisZ());
doc.save(getArtifactsDir() + "Charts.AxisProperties.docx");