com.aspose.words

Class AxisScaleType

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

Utility class containing constants. Specifies the possible scale types for an axis.

Example:

Shows how to set up logarithmic axis scaling.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Insert a scatter chart and clear its default data series
Shape chartShape = builder.insertChart(ChartType.SCATTER, 450.0, 300.0);
Chart chart = chartShape.getChart();
chart.getSeries().clear();

// Insert a series with X/Y coordinates for 5 points
chart.getSeries().add("Series 1", new double[]{1.0, 2.0, 3.0, 4.0, 5.0}, new double[]{1.0, 20.0, 400.0, 8000.0, 160000.0});

// The scaling of the X axis is linear by default, which means it will display "0, 1, 2, 3..."
Assert.assertEquals(chart.getAxisX().getScaling().getType(), AxisScaleType.LINEAR);

// Linear axis scaling is suitable for our X-values, but not our erratic Y-values 
// We can set the scaling of the Y-axis to Logarithmic with a base of 20
// The Y-axis will now display "1, 20, 400, 8000...", which is ideal for accurate representation of this set of Y-values
chart.getAxisY().getScaling().setType(AxisScaleType.LOGARITHMIC);
chart.getAxisY().getScaling().setLogBase(20.0);

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

Field Summary
static final intLINEAR = 0
Linear scaling.
static final intLOGARITHMIC = 1
Logarithmic scaling.
 

    • Field Detail

      • LINEAR = 0

        public static final int LINEAR
        Linear scaling.
      • LOGARITHMIC = 1

        public static final int LOGARITHMIC
        Logarithmic scaling.