com.aspose.words

Class AxisBuiltInUnit

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

Utility class containing constants. Specifies the display units for an axis.

Example:

Shows how to manipulate the tick marks and displayed values of a chart axis.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Insert a scatter chart, which is populated by default values
Shape shape = builder.insertChart(ChartType.SCATTER, 450.0, 250.0);
Chart chart = shape.getChart();

// Set they Y axis to show major ticks every at every 10 units and minor ticks at every 1 units
ChartAxis axis = chart.getAxisY();
axis.setMajorTickMark(AxisTickMark.OUTSIDE);
axis.setMinorTickMark(AxisTickMark.OUTSIDE);

axis.setMajorUnit(10.0);
axis.setMinorUnit(1.0);

// Stretch out the bounds of the axis out to show 3 major ticks and 27 minor ticks
axis.getScaling().setMinimum(new AxisBound(-10));
axis.getScaling().setMaximum(new AxisBound(20.0));

// Do the same for the X-axis
axis = chart.getAxisX();
axis.setMajorTickMark(AxisTickMark.INSIDE);
axis.setMinorTickMark(AxisTickMark.INSIDE);
axis.setMajorUnit(10.0);
axis.getScaling().setMinimum(new AxisBound(-10));
axis.getScaling().setMaximum(new AxisBound(30.0));

// We can also use this attribute to set minor tick spacing
axis.setTickLabelSpacing(2);
// We can define text alignment when axis tick labels are multi-line
// MS Word aligns them to the center by default
axis.setTickLabelAlignment(ParagraphAlignment.RIGHT);

// Get the axis to display values, but in millions
axis.getDisplayUnit().setUnit(AxisBuiltInUnit.MILLIONS);

// Besides the built-in axis units we can choose from,
// we can also set the axis to display values in some custom denomination, using the following attribute
// The statement below is equivalent to the one above
axis.getDisplayUnit().setCustomUnit(1000000.0);

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

Field Summary
static final intNONE = 0
Specifies the values on the chart shall displayed as is.
static final intCUSTOM = 1
Specifies the values on the chart shall be divided by a user-defined divisor. This value is not supported by the new chart types of MS Office 2016.
static final intBILLIONS = 2
Specifies the values on the chart shall be divided by 1,000,000,000.
static final intHUNDRED_MILLIONS = 3
Specifies the values on the chart shall be divided by 100,000,000.
static final intHUNDREDS = 4
Specifies the values on the chart shall be divided by 100.
static final intHUNDRED_THOUSANDS = 5
Specifies the values on the chart shall be divided by 100,000.
static final intMILLIONS = 6
Specifies the values on the chart shall be divided by 1,000,000.
static final intTEN_MILLIONS = 7
Specifies the values on the chart shall be divided by 10,000,000.
static final intTEN_THOUSANDS = 8
Specifies the values on the chart shall be divided by 10,000.
static final intTHOUSANDS = 9
Specifies the values on the chart shall be divided by 1,000.
static final intTRILLIONS = 10
Specifies the values on the chart shall be divided by 1,000,000,000,0000.
static final intPERCENTAGE = 11
Specifies the values on the chart shall be divided by 0.01. This value is supported only by the new chart types of MS Office 2016.
 

    • Field Detail

      • NONE = 0

        public static final int NONE
        Specifies the values on the chart shall displayed as is.
      • CUSTOM = 1

        public static final int CUSTOM
        Specifies the values on the chart shall be divided by a user-defined divisor. This value is not supported by the new chart types of MS Office 2016.
      • BILLIONS = 2

        public static final int BILLIONS
        Specifies the values on the chart shall be divided by 1,000,000,000.
      • HUNDRED_MILLIONS = 3

        public static final int HUNDRED_MILLIONS
        Specifies the values on the chart shall be divided by 100,000,000.
      • HUNDREDS = 4

        public static final int HUNDREDS
        Specifies the values on the chart shall be divided by 100.
      • HUNDRED_THOUSANDS = 5

        public static final int HUNDRED_THOUSANDS
        Specifies the values on the chart shall be divided by 100,000.
      • MILLIONS = 6

        public static final int MILLIONS
        Specifies the values on the chart shall be divided by 1,000,000.
      • TEN_MILLIONS = 7

        public static final int TEN_MILLIONS
        Specifies the values on the chart shall be divided by 10,000,000.
      • TEN_THOUSANDS = 8

        public static final int TEN_THOUSANDS
        Specifies the values on the chart shall be divided by 10,000.
      • THOUSANDS = 9

        public static final int THOUSANDS
        Specifies the values on the chart shall be divided by 1,000.
      • TRILLIONS = 10

        public static final int TRILLIONS
        Specifies the values on the chart shall be divided by 1,000,000,000,0000.
      • PERCENTAGE = 11

        public static final int PERCENTAGE
        Specifies the values on the chart shall be divided by 0.01. This value is supported only by the new chart types of MS Office 2016.