Chart Builder API (beta)

oracle.ord.media.chart.types
Class NumAxisDesc

java.lang.Object
  |
  +--oracle.ord.media.chart.types.AxisDesc
        |
        +--oracle.ord.media.chart.types.NumAxisDesc

public class NumAxisDesc
extends AxisDesc

NumAxisDesc objects are used to customize numerical axes, and are normally supplied as arguments to setChartAttributes(). Users have control of axis labeling fonts, extents, spacing attributes, labeling special characters, and the axis labeling location.

By default, extents (the minimum and maximum values for the numerical axis) are defined automatically. The user can override the extents with setExtent(), setExtentMin(), and setExtentMax().

Axis labels may be placed on the left, right, or both axes. The left axis is the default. This can be changed with setLabelLocation(), using LABEL_RIGHT to label the right axis, or LABEL_BOTH to label both axes.

Note that dual axes can be customized using two separate calls to setChartAttributes(), one that includes a NumAxisDesc with setSecondAxis() set to false, and the other with setSecondAxis() set to true.

By default, the spacing between numerical axis labels is generated automatically, based on the desired number of labels (getNumLabels()). The user can change the desired number of labels to be generated by invoking setNumLabels(). Alternatively, a fixed spacing between Y-axis labels can be specified with setLabelIncrement().

Y-axis labels can be left- or right-justified. By default, they are right-justified.

Note that the current release only supports numerical Y-axes.

Consider the following example, which sets the prefix of Y-axis labels to a dollar sign ($):

 
AxisChart myChart = new AxisChart();
... 
NumAxisDesc myNumAxisDesc = new NumAxisDesc();
myNumAxisDesc.setPrefix("$");
myChart.setChartAttributes(myNumAxisDesc);

Note that when using stacked charts, it is possible to define each numerical Y-axis independently. This is accomplished by using the two parameter overloading of setChartAttributes(), where the first parameter names the subchart.

See Also:
AxisChart.setChartAttributes(NumAxisDesc), AxisChart.setChartAttributes(String, NumAxisDesc), AxisChart.setSubChart(String), AxisDesc

Field Summary
static int LABEL_BOTH
          Identifier for positioning the axis labels on both the left and the right.
static int LABEL_LEFT
          Identifier for positioning the axis labels on the left.
static int LABEL_RIGHT
          Identifier for positioning the axis labels on the right.
static int LEFT_JUSTIFY
          Identifier for specifying that the axis labels be left-justified.
static int RIGHT_JUSTIFY
          Identifier for specifying that the axis labels be right-justified.
 
Constructor Summary
NumAxisDesc()
           
 
Method Summary
 boolean getAutoExtentMax()
          Return true if the maximum extent is Automatic.
 boolean getAutoExtentMin()
          Return true if the minimum extent is Automatic.
 boolean getAutoSpacing()
          Get the flag corresponding to automatic spacing.
 double getExtentMax()
          Get the maximum extent.
 double getExtentMin()
          Get the minimum extent.
 double getLabelIncrement()
          Get the increment between labels.
 int getLabelJustify()
          Get the label justification.
 int getLabelLocation()
          Get the location of the label.
 java.text.NumberFormat getNumberFormat()
          Get the NumberFormat string for the Y-axis labels.
 int getNumLabels()
          Get the number of labels to be written.
 java.lang.String getPrefix()
          Get the prefix associated with the Y-axis label.
 boolean getSecondAxis()
          Get the secondAxis flag.
 java.lang.String getSuffix()
          Get the suffix associated with the Y-axis label.
 void setExtent(double ymin, double ymax)
          Set the axis extents.
 void setExtentMax(double ymax)
          Set the maximum axis extent.
 void setExtentMin(double ymin)
          Set the minimum axis extent.
 void setLabelIncrement(double increment)
          Set the increment between labels.
 void setLabelJustify(int justify)
          Set the justification of the axis labels.
 void setLabelLocation(int labelLocation)
          Set the axis label location.
 void setNumberFormat(java.text.NumberFormat numFormat)
          Set the NumberFormat string for the Y-axis labels.
 void setNumLabels(int numLabels)
          Set the number of labels to be written.
 void setPrefix(java.lang.String prefix)
          Set the prefix of the Y-axis label.
 void setSecondAxis()
          Assert that this descriptor applies to the second axis.
 void setSuffix(java.lang.String suffix)
          Set the suffix of the Y-axis labels.
 
Methods inherited from class oracle.ord.media.chart.types.AxisDesc
getColor, getDrawLabel, getFont, setColor, setDrawLabelOff, setFont
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LABEL_LEFT

public static final int LABEL_LEFT
Identifier for positioning the axis labels on the left. The default is left (LABEL_LEFT).

LABEL_RIGHT

public static final int LABEL_RIGHT
Identifier for positioning the axis labels on the right.

LABEL_BOTH

public static final int LABEL_BOTH
Identifier for positioning the axis labels on both the left and the right.

LEFT_JUSTIFY

public static final int LEFT_JUSTIFY
Identifier for specifying that the axis labels be left-justified.

RIGHT_JUSTIFY

public static final int RIGHT_JUSTIFY
Identifier for specifying that the axis labels be right-justified. The default is RIGHT_JUSTIFY.
Constructor Detail

NumAxisDesc

public NumAxisDesc()
Method Detail

getAutoSpacing

public boolean getAutoSpacing()
Get the flag corresponding to automatic spacing. Returns true if autospacing is asserted.

setLabelIncrement

public void setLabelIncrement(double increment)
Set the increment between labels.
Parameters:
increment - Labels will be written at increment increments.

setLabelJustify

public void setLabelJustify(int justify)
                     throws ChartException
Set the justification of the axis labels. By default, axis labels are right-justified.
Parameters:
justify - Justification of axis labels. Valid arguments are LEFT_JUSTIFY and RIGHT_JUSTIFY.

getLabelJustify

public int getLabelJustify()
Get the label justification.

getLabelIncrement

public double getLabelIncrement()
Get the increment between labels.

setNumLabels

public void setNumLabels(int numLabels)
Set the number of labels to be written.
Parameters:
numLabels - The number of labels to be written.

getNumLabels

public int getNumLabels()
Get the number of labels to be written.

setSecondAxis

public void setSecondAxis()
Assert that this descriptor applies to the second axis. Also, the label location is set to LABEL_RIGHT. The setChartAttributes() call queries this flag to determine to which axis the NumAxisDesc applies.

setLabelLocation

public void setLabelLocation(int labelLocation)
Set the axis label location. Y-axis labels may be placed either on the left (default), right, or both sides of the chart.
Parameters:
labelLocation - Valid values are LABEL_LEFT, LABEL_RIGHT, or LABEL_BOTH.

setExtent

public void setExtent(double ymin,
                      double ymax)
Set the axis extents.
Parameters:
ymin - Minimum Y-axis value.
ymax - Maximum Y-axis value.

setExtentMin

public void setExtentMin(double ymin)
Set the minimum axis extent.
Parameters:
ymin - Minimum Y-axis value.

setExtentMax

public void setExtentMax(double ymax)
Set the maximum axis extent.
Parameters:
ymax - Maximum Y-axis value.

setPrefix

public void setPrefix(java.lang.String prefix)
Set the prefix of the Y-axis label. For example, providing a "$" will prepend a "$" to the top numerical label.
Parameters:
prefix - Prefix associated with the top numerical value.

setNumberFormat

public void setNumberFormat(java.text.NumberFormat numFormat)
Set the NumberFormat string for the Y-axis labels. By default, Y-axis labels will be written as raw integers or Doubles. Invoking setNumberFormat() will cause Y-axis labels to be written using the NumberFormat class. This enables labeling the Y-axis using internationalized grouping symbols, currencies, etc.

For example, the following code causes the Y-axis to be labeled with numerical values delimited with grouping symbols:

 
NumberFormat nf = NumberFormat.getInstance();
nf.setGroupingUsed();
myChart.setNumberFormat(nf);
Parameters:
numFormat - The number format.

getNumberFormat

public java.text.NumberFormat getNumberFormat()
Get the NumberFormat string for the Y-axis labels.

setSuffix

public void setSuffix(java.lang.String suffix)
Set the suffix of the Y-axis labels. For example, providing a "%" will append a "%" to the top numerical label.
Parameters:
suffix - Suffix associated with the top numerical value.

getLabelLocation

public int getLabelLocation()
Get the location of the label.

getAutoExtentMin

public boolean getAutoExtentMin()
Return true if the minimum extent is Automatic. Return false if the user has explicitly set the minimum extent.

getAutoExtentMax

public boolean getAutoExtentMax()
Return true if the maximum extent is Automatic. Return false if the user has explicitly set the maximum extent.

getSecondAxis

public boolean getSecondAxis()
Get the secondAxis flag.

getExtentMin

public double getExtentMin()
Get the minimum extent.

getExtentMax

public double getExtentMax()
Get the maximum extent.

getSuffix

public java.lang.String getSuffix()
Get the suffix associated with the Y-axis label.

getPrefix

public java.lang.String getPrefix()
Get the prefix associated with the Y-axis label.

Chart Builder API (beta)