com.aspose.words

Class AxisBound

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

Represents minimum or maximum bound of axis values.

Bound can be specified as a numeric, datetime or a special "auto" value.

The instances of this class are immutable.

Example:

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

// Insert chart.
Shape shape = builder.insertChart(ChartType.LINE, 432.0, 252.0);
Chart chart = shape.getChart();

// Clear demo data.
chart.getSeries().clear();

// Fill data.
chart.getSeries().add("Aspose Test Series",
        new Date[]
                {
                        java.sql.Date.valueOf(LocalDate.of(2017, 11, 6)),
                        java.sql.Date.valueOf(LocalDate.of(2017, 11, 9)),
                        java.sql.Date.valueOf(LocalDate.of(2017, 11, 15)),
                        java.sql.Date.valueOf(LocalDate.of(2017, 11, 21)),
                        java.sql.Date.valueOf(LocalDate.of(2017, 11, 25)),
                        java.sql.Date.valueOf(LocalDate.of(2017, 11, 29))
                },
        new double[]{1.2, 0.3, 2.1, 2.9, 4.2, 5.3});

ChartAxis xAxis = chart.getAxisX();
ChartAxis yAxis = chart.getAxisY();

// Set X axis bounds.
xAxis.getScaling().setMinimum(new AxisBound(java.sql.Date.valueOf(LocalDate.of(2017, 11, 5))));
xAxis.getScaling().setMaximum(new AxisBound(java.sql.Date.valueOf(LocalDate.of(2017, 12, 3))));

// Set major units to a week and minor units to a day.
xAxis.setMajorUnit(7.0);
xAxis.setMinorUnit(1.0);
xAxis.setMajorTickMark(AxisTickMark.CROSS);
xAxis.setMinorTickMark(AxisTickMark.OUTSIDE);

// Define Y axis properties.
yAxis.setTickLabelPosition(AxisTickLabelPosition.HIGH);
yAxis.setMajorUnit(100.0);
yAxis.setMinorUnit(50.0);
yAxis.getDisplayUnit().setUnit(AxisBuiltInUnit.HUNDREDS);
yAxis.getScaling().setMinimum(new AxisBound(100.0));
yAxis.getScaling().setMaximum(new AxisBound(700.0));

doc.save(getArtifactsDir() + "ChartAxisProperties.docx");
See Also:
AxisScaling.Minimum, AxisScaling.Maximum

Constructor Summary
AxisBound()
Creates a new instance indicating that axis bound should be determined automatically by a word-processing application.
AxisBound(doublevalue)
Creates an axis bound represented as a number.
AxisBound(java.util.Datedatetime)
Creates an axis bound represented as datetime value.
 
Property Getters/Setters Summary
booleanisAuto()
Returns a flag indicating that axis bound should be determined automatically.
doublegetValue()
Returns numeric value of axis bound.
java.util.DategetValueAsDate()
Returns value of axis bound represented as datetime.
 
Method Summary
booleanequals(java.lang.Object obj)
Determines whether the specified object is equal in value to the current object.
inthashCode()
Serves as a hash function for this type.
java.lang.StringtoString()
Returns a user-friendly string that displays the value of this object.
 

    • Constructor Detail

      • AxisBound

        public AxisBound()
        Creates a new instance indicating that axis bound should be determined automatically by a word-processing application.
      • AxisBound

        public AxisBound(double value)
        Creates an axis bound represented as a number.

        Example:

        Shows how to insert chart with date/time values
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        // Insert chart.
        Shape shape = builder.insertChart(ChartType.LINE, 432.0, 252.0);
        Chart chart = shape.getChart();
        
        // Clear demo data.
        chart.getSeries().clear();
        
        // Fill data.
        chart.getSeries().add("Aspose Test Series",
                new Date[]
                        {
                                java.sql.Date.valueOf(LocalDate.of(2017, 11, 6)),
                                java.sql.Date.valueOf(LocalDate.of(2017, 11, 9)),
                                java.sql.Date.valueOf(LocalDate.of(2017, 11, 15)),
                                java.sql.Date.valueOf(LocalDate.of(2017, 11, 21)),
                                java.sql.Date.valueOf(LocalDate.of(2017, 11, 25)),
                                java.sql.Date.valueOf(LocalDate.of(2017, 11, 29))
                        },
                new double[]{1.2, 0.3, 2.1, 2.9, 4.2, 5.3});
        
        ChartAxis xAxis = chart.getAxisX();
        ChartAxis yAxis = chart.getAxisY();
        
        // Set X axis bounds.
        xAxis.getScaling().setMinimum(new AxisBound(java.sql.Date.valueOf(LocalDate.of(2017, 11, 5))));
        xAxis.getScaling().setMaximum(new AxisBound(java.sql.Date.valueOf(LocalDate.of(2017, 12, 3))));
        
        // Set major units to a week and minor units to a day.
        xAxis.setMajorUnit(7.0);
        xAxis.setMinorUnit(1.0);
        xAxis.setMajorTickMark(AxisTickMark.CROSS);
        xAxis.setMinorTickMark(AxisTickMark.OUTSIDE);
        
        // Define Y axis properties.
        yAxis.setTickLabelPosition(AxisTickLabelPosition.HIGH);
        yAxis.setMajorUnit(100.0);
        yAxis.setMinorUnit(50.0);
        yAxis.getDisplayUnit().setUnit(AxisBuiltInUnit.HUNDREDS);
        yAxis.getScaling().setMinimum(new AxisBound(100.0));
        yAxis.getScaling().setMaximum(new AxisBound(700.0));
        
        doc.save(getArtifactsDir() + "ChartAxisProperties.docx");
      • AxisBound

        public AxisBound(java.util.Date datetime)
        Creates an axis bound represented as datetime value.

        Example:

        Shows how to insert chart with date/time values
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        // Insert chart.
        Shape shape = builder.insertChart(ChartType.LINE, 432.0, 252.0);
        Chart chart = shape.getChart();
        
        // Clear demo data.
        chart.getSeries().clear();
        
        // Fill data.
        chart.getSeries().add("Aspose Test Series",
                new Date[]
                        {
                                java.sql.Date.valueOf(LocalDate.of(2017, 11, 6)),
                                java.sql.Date.valueOf(LocalDate.of(2017, 11, 9)),
                                java.sql.Date.valueOf(LocalDate.of(2017, 11, 15)),
                                java.sql.Date.valueOf(LocalDate.of(2017, 11, 21)),
                                java.sql.Date.valueOf(LocalDate.of(2017, 11, 25)),
                                java.sql.Date.valueOf(LocalDate.of(2017, 11, 29))
                        },
                new double[]{1.2, 0.3, 2.1, 2.9, 4.2, 5.3});
        
        ChartAxis xAxis = chart.getAxisX();
        ChartAxis yAxis = chart.getAxisY();
        
        // Set X axis bounds.
        xAxis.getScaling().setMinimum(new AxisBound(java.sql.Date.valueOf(LocalDate.of(2017, 11, 5))));
        xAxis.getScaling().setMaximum(new AxisBound(java.sql.Date.valueOf(LocalDate.of(2017, 12, 3))));
        
        // Set major units to a week and minor units to a day.
        xAxis.setMajorUnit(7.0);
        xAxis.setMinorUnit(1.0);
        xAxis.setMajorTickMark(AxisTickMark.CROSS);
        xAxis.setMinorTickMark(AxisTickMark.OUTSIDE);
        
        // Define Y axis properties.
        yAxis.setTickLabelPosition(AxisTickLabelPosition.HIGH);
        yAxis.setMajorUnit(100.0);
        yAxis.setMinorUnit(50.0);
        yAxis.getDisplayUnit().setUnit(AxisBuiltInUnit.HUNDREDS);
        yAxis.getScaling().setMinimum(new AxisBound(100.0));
        yAxis.getScaling().setMaximum(new AxisBound(700.0));
        
        doc.save(getArtifactsDir() + "ChartAxisProperties.docx");
    • Property Getters/Setters Detail

      • isAuto

        public boolean isAuto()
        
        Returns a flag indicating that axis bound should be determined automatically.
      • getValue

        public double getValue()
        
        Returns numeric value of axis bound.
      • getValueAsDate

        public java.util.Date getValueAsDate()
        
        Returns value of axis bound represented as datetime.
    • Method Detail

      • equals

        public boolean equals(java.lang.Object obj)
        Determines whether the specified object is equal in value to the current object.
      • hashCode

        public int hashCode()
        Serves as a hash function for this type.
      • toString

        public java.lang.String toString()
        Returns a user-friendly string that displays the value of this object.