public class NumericAxis extends Axis
NumberFormat
.BOTTOM, DENSITY_MINIMAL, DENSITY_NORMAL, DENSITY_SPARSE, LEFT, RIGHT, spinestyle, TOP, ZAXIS
Constructor and Description |
---|
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
|
Modifier and Type | Method and Description |
---|---|
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 |
getFloatingPointAxis(Locale locale)
Return a NumericAxis that formats it's values as integers in the specified Locale
|
static NumericAxis |
getIntegerAxis()
Return a NumericAxis that formats it's values as integers
|
static NumericAxis |
getIntegerAxis(Locale locale)
Return a NumericAxis that formats it's values as integers in the specified Locale
|
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.
|
setLabel, setMaxValue, setMinValue, setSpineStyle, setToothLength, setToothTextStyle, setWallPaint, setWallPaint, setWallPaint, setZeroIntersection, toString
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.public static final NumericAxis getIntegerAxis()
public static final NumericAxis getIntegerAxis(Locale locale)
Locale
- the locale to format the numbers inpublic static final NumericAxis getFloatingPointAxis()
public static final NumericAxis getFloatingPointAxis(Locale locale)
Locale
- the locale to format the numbers inpublic 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)
.
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.
Copyright © 2001-2016 Big Faceless Organization