com.aspose.words

Class AxisTickMark

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

Utility class containing constants. Specifies the possible positions for tick marks.

Example:

Shows how to insert chart with date/time values.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Add a line chart, and clear its demo data series to start with a clean chart.
Shape shape = builder.insertChart(ChartType.LINE, 500.0, 300.0);
Chart chart = shape.getChart();
chart.getSeries().clear();

// Add a custom series containing date/time values for the X-axis, and respective decimal values for the Y-axis.
chart.getSeries().add("Aspose Test Series",
    new Date[]
                {
                        DocumentHelper.createDate(2017, 11, 6), DocumentHelper.createDate(2017, 11, 9), DocumentHelper.createDate(2017, 11, 15),
                        DocumentHelper.createDate(2017, 11, 21), DocumentHelper.createDate(2017, 11, 25), DocumentHelper.createDate(2017, 11, 29)
                },
        new double[]{1.2, 0.3, 2.1, 2.9, 4.2, 5.3});

// Set lower and upper bounds for the X-axis.
ChartAxis xAxis = chart.getAxisX();
xAxis.getScaling().setMinimum(new AxisBound(DocumentHelper.createDate(2017, 11, 5)));
xAxis.getScaling().setMaximum(new AxisBound(DocumentHelper.createDate(2017, 12, 3)));

// Set the major units of the X-axis to a week, and the minor units to a day.
xAxis.setBaseTimeUnit(AxisTimeUnit.DAYS);
xAxis.setMajorUnit(7.0d);
xAxis.setMajorTickMark(AxisTickMark.CROSS);
xAxis.setMinorUnit(1.0d);
xAxis.setMinorTickMark(AxisTickMark.OUTSIDE);

// Define Y-axis properties for decimal values.
ChartAxis yAxis = chart.getAxisY();
yAxis.setTickLabelPosition(AxisTickLabelPosition.HIGH);
yAxis.setMajorUnit(100.0d);
yAxis.setMinorUnit(50.0d);
yAxis.getDisplayUnit().setUnit(AxisBuiltInUnit.HUNDREDS);
yAxis.getScaling().setMinimum(new AxisBound(100.0));
yAxis.getScaling().setMaximum(new AxisBound(700.0));

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

Field Summary
static final intCROSS = 0
Specifies that the tick marks shall cross the axis.
static final intINSIDE = 1
Specifies that the tick marks shall be inside the plot area.
static final intOUTSIDE = 2
Specifies that the tick marks shall be outside the plot area.
static final intNONE = 3
Specifies that there shall be no tick marks.
 

    • Field Detail

      • CROSS = 0

        public static final int CROSS
        Specifies that the tick marks shall cross the axis.
      • INSIDE = 1

        public static final int INSIDE
        Specifies that the tick marks shall be inside the plot area.
      • OUTSIDE = 2

        public static final int OUTSIDE
        Specifies that the tick marks shall be outside the plot area.
      • NONE = 3

        public static final int NONE
        Specifies that there shall be no tick marks.