|
||||||||||
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.LogAxis
public class LogAxis
A type of Axis that can be used to plot Logarithmic values. This class works as a "wrapper" around a simple axis. So, for example, to plot a logarithmic scale of dollar values on the left axis:
Axis axis = NumericAxis.getCurrencyAxis(Locale.USA); axis = new LogAxis(axis); graph.setAxis(Axis.LEFT, axis);
Field Summary |
---|
Fields inherited from class org.faceless.graph2.Axis |
---|
BOTTOM, DENSITY_MINIMAL, DENSITY_NORMAL, DENSITY_SPARSE, LEFT, RIGHT, TOP, ZAXIS |
Constructor Summary | |
---|---|
LogAxis(Axis axis)
Create a new LogAxis with a base of 10 |
|
LogAxis(Axis axis,
double base)
Create a new LogAxis with the specified base |
Method Summary | |
---|---|
String |
format(double in)
Given the specified number, return the text that should be placed against the tooth at that position. |
void |
setLabel(String text,
TextStyle style)
Set a label to be displayed next to the axis. |
void |
setMaxValue(double val)
Set the maximum value to be plotted on the Axis. |
void |
setMinValue(double val)
Set the minimum value to be plotted on the Axis. |
void |
setSpineStyle(Style style)
Set the style used to draw the spine of the axis. |
void |
setToothLength(double toothlength)
Set the length of the teeth that come off the spine of the axis. |
void |
setToothTextStyle(TextStyle style)
Set the style used to draw the labels on the teeth. |
void |
setWallPaint(Paint paint)
Set the paint to be used on the wall next to this axis. |
void |
setZeroIntersection(boolean zero)
Whether this axis should cross it's adjacent axis where that axis is zero. |
double[] |
steps(double min,
double max)
The steps method controls where the teeth are placed on the spine. |
Methods inherited from class org.faceless.graph2.Axis |
---|
setWallPaint, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LogAxis(Axis axis)
axis
- the axis to wrappublic LogAxis(Axis axis, double base)
axis
- the axis to wrapbase
- the base to use - must be > 0 but not 1Method Detail |
---|
public void setZeroIntersection(boolean zero)
Axis
setZeroIntersection
in class Axis
zero
- whether to cross the adjacent axis at zero. The default is falsepublic void setToothLength(double toothlength)
Axis
setToothLength
in class Axis
toothlength
- the length of the teeth as a proportion of the width of the graph. The default is 0.01public void setSpineStyle(Style style)
Axis
setSpineStyle
in class Axis
style
- the style to draw the spine and teeth in - the default is a solid black line.public void setToothTextStyle(TextStyle style)
Axis
setPadding...
methods can be used to increase the space between the teeth and their text,
and the TextStyle.setAlign(int)
method used to control the position of the
text relative to the teeth.
setToothTextStyle
in class Axis
style
- the style to display the teeth labels in.public void setWallPaint(Paint paint)
Axis
X-Rotation
or Y-Rotation
these walls would be invisible.
setWallPaint
in class Axis
paint
- the Paint to use on the wall running into the graph from
this axis, or null
to not paint the wallAxesGraph.setBackWallPaint(Paint)
public void setLabel(String text, TextStyle style)
Axis
TextStyle.setPaddingBottom(double)
and TextStyle.setPaddingTop(double)
settings
of the style to control the distance between the label and the axis.
setLabel
in class Axis
text
- the text to displaystyle
- the style to draw the text inpublic final double[] steps(double min, double max)
Axis
The steps
method controls where the teeth are placed on the spine.
Each subclass of Axis has a different strategy - for instance, the
DateAxis
will try and place ticks on the 1st of the month, the
NumericAxis
will try and place them evenly across the range and so on.
The returned array should consist of a range of numbers, ordered from low to high,
which mark the locations of the teeth on the spine. min
and max
are the minimum and maximum values of the data to plot, and these values will usually
be the first and last values in the returned array.
Those wanting to create their own custom axis will typically override this method and
Axis.format(double)
.
steps
in class Axis
min
- the minimum value of the data to plotmax
- the maximum value of the data to plot
public 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 setMaxValue(double val)
Axis
setMaxValue
in class Axis
val
- the maximum value to plot on this axispublic void setMinValue(double val)
Axis
Axis.setMaxValue(double)
this value will be expanded if required to fit the values
from the various series.
setMinValue
in class Axis
val
- the minimum value to plot on this axis
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |