com.aspose.words

Class AxisCrosses

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

Utility class containing constants. Specifies the possible crossing points for an axis.

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.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
The category axis crosses at the zero point of the value axis (if possible), or at the minimum value if the minimum is greater than zero, or at the maximum if the maximum is less than zero.
static final intMAXIMUM = 1
A perpendicular axis crosses at the maximum value of the axis.
static final intMINIMUM = 2
A perpendicular axis crosses at the minimum value of the axis.
static final intCUSTOM = 3
A perpendicular axis crosses at the specified value of the axis.
 

    • Field Detail

      • AUTOMATIC = 0

        public static final int AUTOMATIC
        The category axis crosses at the zero point of the value axis (if possible), or at the minimum value if the minimum is greater than zero, or at the maximum if the maximum is less than zero.
      • MAXIMUM = 1

        public static final int MAXIMUM
        A perpendicular axis crosses at the maximum value of the axis.
      • MINIMUM = 2

        public static final int MINIMUM
        A perpendicular axis crosses at the minimum value of the axis.
      • CUSTOM = 3

        public static final int CUSTOM
        A perpendicular axis crosses at the specified value of the axis.