com.aspose.words

Class AxisCategoryType

  • java.lang.Object
    • com.aspose.words.AxisCategoryType
public class AxisCategoryType 
extends java.lang.Object

Utility class containing constants. Specifies type of a category axis.

Example:

Shows how to insert a chart and modify the appearance of its axes.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Add a column chart, and then clear its demo data series to start with a clean chart.
Shape shape = builder.insertChart(ChartType.COLUMN, 500.0, 300.0);
Chart chart = shape.getChart();
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.setTickLabelOffset(50);
xAxis.setTickLabelPosition(AxisTickLabelPosition.LOW);
xAxis.setTickLabelSpacingIsAuto(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.setTickLabelPosition(AxisTickLabelPosition.NEXT_TO_AXIS);

// Column charts do not have a Z-axis.
Assert.assertNull(chart.getAxisZ());

doc.save(getArtifactsDir() + "Charts.AxisProperties.docx");

Field Summary
static final intAUTOMATIC = 0
Specifies that type of a category axis is determined automatically based on data.
static final intCATEGORY = 1
Specifies an axis of an arbitrary set of categories.
static final intTIME = 2
Specifies a time category axis.
 

    • Field Detail

      • AUTOMATIC = 0

        public static final int AUTOMATIC
        Specifies that type of a category axis is determined automatically based on data.
      • CATEGORY = 1

        public static final int CATEGORY
        Specifies an axis of an arbitrary set of categories.
      • TIME = 2

        public static final int TIME
        Specifies a time category axis.