|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.faceless.graph.formatter.Formatter
public abstract class Formatter
A Formatter
controls how the values displayed on
the axis of a graph are displayed - as integers, floating point,
percentages, dates etc.
Several concrete subclasses are provided which allow for easy graphing of integers, floats, percentages, dates and discrete values (like the names of the bars in a bar graph). The class can easily be overridden however to allow just about anything to be used as an axis value.
Field Summary | |
---|---|
static int |
MINIMAL
Passed to the setDensity(int) method to set the number of
ticks returned by this formatter
to a "minimal" level - depending on the data and formatter
between 3 and 4 points. |
static int |
NORMAL
Passed to the setDensity(int) method to set the number of
ticks returned by this formatter
to a "normal" level - depending on the data and formatter,
between about 8 and 14 points. |
static int |
SPARSE
Passed to the setDensity(int) method to set the number of
ticks returned by this formatter
to a "sparse" level - depending on the data and formatter,
between about 4 and 7 points. |
Method Summary | |
---|---|
abstract String |
format(double in)
Return a String that is the formatted version of the input parameter. |
boolean |
isDiscrete()
If this formatter is for formatting discrete values. |
void |
setDensity(int density)
Set the "density" of the formatter - the number of ticks it asks to be printed on the axis. |
void |
setFixedEnds(boolean fixed)
Cause the ends of the axes to be fixed to the min and max values of the data. |
double[] |
steps(double min,
double max)
Which steps between min and max should be marked on the axis. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NORMAL
setDensity(int)
method to set the number of
ticks returned by this formatter
to a "normal" level - depending on the data and formatter,
between about 8 and 14 points.
public static final int SPARSE
setDensity(int)
method to set the number of
ticks returned by this formatter
to a "sparse" level - depending on the data and formatter,
between about 4 and 7 points.
public static final int MINIMAL
setDensity(int)
method to set the number of
ticks returned by this formatter
to a "minimal" level - depending on the data and formatter
between 3 and 4 points.
Method Detail |
---|
public void setDensity(int density)
Set the "density" of the formatter - the number of ticks
it asks to be printed on the axis. Valid values are either
NORMAL
(the default), SPARSE
or MINIMAL
Whether the subclass of formatter uses or ignores this value is down to it's implementation.
the
- density of the formatterpublic void setFixedEnds(boolean fixed)
Cause the ends of the axes to be fixed to the min and max values of the data. When this value is set to false, plotting data from (say) 31 to 78 would probably result in an axis that ran from 30 to 80. When this value is set to true, the axes will always start and end at the end of the data - 31 to 78 in this case. The default is false, except for the X-axis on area graphs, which default to true
public abstract String format(double in)
public boolean isDiscrete()
DiscreteFormatter
, which overrides this method
public double[] steps(double min, double max)
Which steps between min and max should be marked on the axis.
This is an array because although the steps will usually be
evenly spaced, they may not always be (see the DateFormatter
for an example).
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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |