com.metsci.glimpse.axis.painter.label
Class GridAxisLabelHandler

java.lang.Object
  extended by com.metsci.glimpse.axis.painter.label.GridAxisLabelHandler
All Implemented Interfaces:
AxisLabelHandler
Direct Known Subclasses:
GridAxisExponentLabelHandler, GridAxisLabelHandlerSimpleUnits, LatLonAxisLabelHandler

public class GridAxisLabelHandler
extends java.lang.Object
implements AxisLabelHandler

The default AxisLabelHandler implementation. Provides a uniformly spaced grid of axis tick marks based on the set tickSpacing. If axis values become very large or very small, they are shifted and a magnitude indicator is added to the axis label.

For example, an axis with min and max values of 0.001 and 0.006 might have tick values displayed as "1.0" or "6.0" with "(x 1,000)" specified in the axis label.

Author:
ulman

Constructor Summary
GridAxisLabelHandler()
           
 
Method Summary
 java.lang.String getAxisLabel(Axis1D axis)
           
 AxisUnitConverter getAxisUnitConverter()
           
 double[] getMinorTickPositions(double[] tickPositions)
          Provides the positions of minor tick marks.
 java.lang.String[] getTickLabels(Axis1D axis, double[] tickPositions)
           
 double[] getTickPositions(Axis1D axis)
           
 void setAxisLabel(java.lang.String label)
           
 void setAxisUnitConverter(AxisUnitConverter converter)
           
 void setAxisUnits(java.lang.String units, boolean abbreviated)
           
 void setAxisUnits(java.lang.String milliUnits, java.lang.String units, java.lang.String kiloUnits)
           
 void setMinorTickCount(int count)
           
 void setTickSpacing(int spacing)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GridAxisLabelHandler

public GridAxisLabelHandler()
Method Detail

getAxisUnitConverter

public AxisUnitConverter getAxisUnitConverter()
Specified by:
getAxisUnitConverter in interface AxisLabelHandler
Returns:
the current AxisUnitConverter (used to determine values returned by getTickPositions() and getTickLabels()

setAxisUnitConverter

public void setAxisUnitConverter(AxisUnitConverter converter)
Specified by:
setAxisUnitConverter in interface AxisLabelHandler
Parameters:
converter - sets a new AxisUnitConverter

getTickPositions

public double[] getTickPositions(Axis1D axis)
Specified by:
getTickPositions in interface AxisLabelHandler
Returns:
an array containing positions of tick marks in axis coordinates (transformed by any AxisUnitConverter).

getTickLabels

public java.lang.String[] getTickLabels(Axis1D axis,
                                        double[] tickPositions)
Specified by:
getTickLabels in interface AxisLabelHandler
tickPositions - the output from getTickPositions( ).
Returns:
an array of string labels for the tick marks provided by getTickPositions( ).

getMinorTickPositions

public double[] getMinorTickPositions(double[] tickPositions)
Description copied from interface: AxisLabelHandler
Provides the positions of minor tick marks. How these are rendered differently from regular tick marks can vary, but they will usually be smaller and will not have labels. The positions of the major ticks are provided as input, since the minor tick positions are usually based on these. However, implementations of AxisLabelHandler are free to ignore this argument.

Specified by:
getMinorTickPositions in interface AxisLabelHandler
Returns:
an array containing positions of minor tick marks in axis coordinates (transformed by any AxisUnitConverter).

getAxisLabel

public java.lang.String getAxisLabel(Axis1D axis)
Specified by:
getAxisLabel in interface AxisLabelHandler
Returns:
a text label describing the axis (the type of data displayed, the units, etc...)

setTickSpacing

public void setTickSpacing(int spacing)

setMinorTickCount

public void setMinorTickCount(int count)

setAxisLabel

public void setAxisLabel(java.lang.String label)
Specified by:
setAxisLabel in interface AxisLabelHandler
Parameters:
label - provides a hint regarding what label information to display

setAxisUnits

public void setAxisUnits(java.lang.String units,
                         boolean abbreviated)

setAxisUnits

public void setAxisUnits(java.lang.String milliUnits,
                         java.lang.String units,
                         java.lang.String kiloUnits)


Copyright © 2012 Metron, Inc.. All Rights Reserved.