Package org.faceless.graph.formatter
Class DiscreteFormatter
- java.lang.Object
-
- org.faceless.graph.formatter.Formatter
-
- org.faceless.graph.formatter.DiscreteFormatter
-
public class DiscreteFormatter extends Formatter
The
DiscreteFormatter
treats it's double argument as an index into a list of String values, and returns the matching String.This is the formatter that's used to plot the String values on the X axis of a Bar Graph, but it's probably not suitable for general use.
-
-
Constructor Summary
Constructors Constructor Description DiscreteFormatter(java.util.List list)
Create a new DiscreteFormatter
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
format(double in)
Return a String that is the formatted version of the input parameter.boolean
isDiscrete()
For this subclass, discrete returns true.double[]
steps(double min, double max)
Which steps between min and max should be marked on the axis.-
Methods inherited from class org.faceless.graph.formatter.Formatter
fixMinMax, setDensity, setFixedEnds
-
-
-
-
Method Detail
-
isDiscrete
public boolean isDiscrete()
For this subclass, discrete returns true.- Overrides:
isDiscrete
in classFormatter
-
format
public java.lang.String format(double in)
Description copied from class:Formatter
Return a String that is the formatted version of the input parameter.
-
steps
public double[] steps(double min, double max)
Description copied from class:Formatter
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.
-
-