|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.faceless.graph2.Axis
org.faceless.graph2.NumericAxis
public class NumericAxis
The most common type of Axis, a NumericAxis is used to display numbers, either
as integers, real numbers, percentages, currency amounts or any type of format
that can be created with a NumberFormat
.
Field Summary |
---|
Fields inherited from class org.faceless.graph2.Axis |
---|
BOTTOM, DENSITY_MINIMAL, DENSITY_NORMAL, DENSITY_SPARSE, LEFT, RIGHT, TOP, ZAXIS |
Constructor Summary | |
---|---|
NumericAxis(NumberFormat format)
Create a new NumericAxis with the specified format and the default density. |
|
NumericAxis(NumberFormat format,
int density)
Create a new NumericAxis with the specified format and densty |
Method Summary | |
---|---|
String |
format(double in)
Given the specified number, return the text that should be placed against the tooth at that position. |
static NumericAxis |
getCurrencyAxis(Locale locale)
Return a NumericAxis that formats it's values as currencies in the specified locale. |
static NumericAxis |
getFloatingPointAxis()
Return a NumericAxis that formats it's values as real numbers |
static NumericAxis |
getIntegerAxis()
Return a NumericAxis that formats it's values as integers |
void |
setStretchEnds(boolean stretch)
Whether to "stretch" the ends of the graph to a "useful" value or not. |
double[] |
steps(double min,
double max)
Which steps between min and max should be marked with a tooth. |
Methods inherited from class org.faceless.graph2.Axis |
---|
setLabel, setMaxValue, setMinValue, setSpineStyle, setToothLength, setToothTextStyle, setWallPaint, setWallPaint, setZeroIntersection, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public NumericAxis(NumberFormat format)
format
- the format to use to display the valuespublic NumericAxis(NumberFormat format, int density)
format
- the format to use to display the valuesdensity
- the density to use - usually one of Axis.DENSITY_NORMAL
, Axis.DENSITY_SPARSE
or Axis.DENSITY_MINIMAL
, but may be any integer which is roughly the number of intended teeth on the axis.Method Detail |
---|
public static final NumericAxis getIntegerAxis()
public static final NumericAxis getFloatingPointAxis()
public static final NumericAxis getCurrencyAxis(Locale locale)
locale
- which Locale to use for currencies, or null
to use the default localepublic String format(double in)
Axis
Given the specified number, return the text that should be placed against the
tooth at that position. For example, an Axis that simply plotted integer
values might return Integer.toString((int)in)
Those wanting to create their own custom axis will typically override this
method and Axis.steps(double, double)
.
format
in class Axis
in
- the value to format
public void setStretchEnds(boolean stretch)
stretch
- whether to stretch the ends of the graphpublic double[] steps(double min, double max)
Which steps between min and max should be marked with a tooth. This method returns the default settings, which is to calculate a number of "useful" values between min and max, possibly rounding those two values up or down to fit the scale. The number of values returned depends on the density setting.
steps
in class Axis
min
- the minimum value of the data to plotmax
- the maximum value of the data to plot
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |