org.faceless.graph2
Class LogAxis

java.lang.Object
  extended by org.faceless.graph2.Axis
      extended by org.faceless.graph2.LogAxis

public class LogAxis
extends Axis

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

LogAxis

public LogAxis(Axis axis)
Create a new LogAxis with a base of 10

Parameters:
axis - the axis to wrap

LogAxis

public LogAxis(Axis axis,
               double base)
Create a new LogAxis with the specified base

Parameters:
axis - the axis to wrap
base - the base to use - must be > 0 but not 1
Method Detail

setZeroIntersection

public void setZeroIntersection(boolean zero)
Description copied from class: Axis
Whether this axis should cross it's adjacent axis where that axis is zero. Unless you're plotting negative values on the graph, this setting won't have any effect.

Overrides:
setZeroIntersection in class Axis
Parameters:
zero - whether to cross the adjacent axis at zero. The default is false

setToothLength

public void setToothLength(double toothlength)
Description copied from class: Axis
Set the length of the teeth that come off the spine of the axis. The toothlength is a fraction of the width of the whole graph (as a guide, the default is 0.01) so a value between 0 (for no teeth) and 0.02 would be typical.

Overrides:
setToothLength in class Axis
Parameters:
toothlength - the length of the teeth as a proportion of the width of the graph. The default is 0.01

setSpineStyle

public void setSpineStyle(Style style)
Description copied from class: Axis
Set the style used to draw the spine of the axis.

Overrides:
setSpineStyle in class Axis
Parameters:
style - the style to draw the spine and teeth in - the default is a solid black line.

setToothTextStyle

public void setToothTextStyle(TextStyle style)
Description copied from class: Axis
Set the style used to draw the labels on the teeth. The default is Black 10pt text in the Default font. Remember the 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.

Overrides:
setToothTextStyle in class Axis
Parameters:
style - the style to display the teeth labels in.

setWallPaint

public void setWallPaint(Paint paint)
Description copied from class: Axis
Set the paint to be used on the wall next to this axis. These walls run "into" the graph, so for graphs displayed only in 2D (ie. with no X-Rotation or Y-Rotation these walls would be invisible.

Overrides:
setWallPaint in class Axis
Parameters:
paint - the Paint to use on the wall running into the graph from this axis, or null to not paint the wall
See Also:
AxesGraph.setBackWallPaint(Paint)

setLabel

public void setLabel(String text,
                     TextStyle style)
Description copied from class: Axis
Set a label to be displayed next to the axis. Users may want to play with the TextStyle.setPaddingBottom(double) and TextStyle.setPaddingTop(double) settings of the style to control the distance between the label and the axis.

Overrides:
setLabel in class Axis
Parameters:
text - the text to display
style - the style to draw the text in

steps

public final double[] steps(double min,
                            double max)
Description copied from class: 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).

Specified by:
steps in class Axis
Parameters:
min - the minimum value of the data to plot
max - the maximum value of the data to plot
Returns:
an array of doubles representing the positions to place teeth on this axis

format

public String format(double in)
Description copied from class: 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).

Specified by:
format in class Axis
Parameters:
in - the value to format
Returns:
the value formatted as a String

setMaxValue

public void setMaxValue(double val)
Description copied from class: Axis
Set the maximum value to be plotted on the Axis. If not set, this will default to the maximum value of all the Series plotted against this axis. If this value is too small to fit the values from the series, it will be expanded - for example, if your series plots values from 0 to 10 and this is set to 5, it will be silently increased to 10 to accomodate the required range of values.

Overrides:
setMaxValue in class Axis
Parameters:
val - the maximum value to plot on this axis

setMinValue

public void setMinValue(double val)
Description copied from class: Axis
Set the minimum value to be plotted on the Axis. If not set, this will default to the minimum value of all the Series plotted against this axis. Like Axis.setMaxValue(double) this value will be expanded if required to fit the values from the various series.

Overrides:
setMinValue in class Axis
Parameters:
val - the minimum value to plot on this axis


Copyright © 2001-2011 Big Faceless Organization