uk.ac.starlink.ttools.plot2
Class TickCalc

java.lang.Object
  extended by uk.ac.starlink.ttools.plot2.TickCalc
Direct Known Subclasses:
TickCalc.BasicTickCalc

public abstract class TickCalc
extends Object

Defines a rule for generating tick marks to label plot axes. Instances of this class do the work of determining positions and text labels for major ticks and positions of corresponding minor ticks given various provided constraints.

Since:
15 Oct 2013
Author:
Mark Taylor

Nested Class Summary
static class TickCalc.BasicTickCalc
          Abstract TickCalc implementation that deals with fixed-length tick labels.
 
Field Summary
static TickCalc.BasicTickCalc LINEAR
          TickCalc for linear axes.
static TickCalc.BasicTickCalc LOG
          TickCalc for logarithmic axes.
 
Constructor Summary
TickCalc()
           
 
Method Summary
static Tick[] getMajorTicks(Ticker ticker, double dlo, double dhi)
          Use a given ticker to generate major ticks in a given range of coordinates.
static Tick[] getMinorTicks(Ticker ticker, double dlo, double dhi)
          Use a given ticker to generate minor ticks in a given range of coordinates.
abstract  Tick[] getTicks(double dlo, double dhi, boolean withMinor, Captioner captioner, Orientation orient, int npix, double crowding)
          Generates tick marks for labelling a plot axis.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LINEAR

public static final TickCalc.BasicTickCalc LINEAR
TickCalc for linear axes.


LOG

public static final TickCalc.BasicTickCalc LOG
TickCalc for logarithmic axes.

Constructor Detail

TickCalc

public TickCalc()
Method Detail

getTicks

public abstract Tick[] getTicks(double dlo,
                                double dhi,
                                boolean withMinor,
                                Captioner captioner,
                                Orientation orient,
                                int npix,
                                double crowding)
Generates tick marks for labelling a plot axis. Major tick positions should be chosen in a way which is appropriate for the axis length and range, and overlapping axis labels should be avoided.

Parameters:
dlo - minimum axis data value
dhi - maximum axis data value
withMinor - if true minor axes are included, if false only major (labelled) ones are
captioner - caption painter
orient - label orientation
npix - number of pixels along the axis
crowding - 1 for normal tick density on the axis, lower for fewer labels, higher for more
Returns:
tick array

getMajorTicks

public static Tick[] getMajorTicks(Ticker ticker,
                                   double dlo,
                                   double dhi)
Use a given ticker to generate major ticks in a given range of coordinates.

Parameters:
ticker - tick generator
dlo - minimum axis data value
dhi - maximum axis data value
Returns:
array of major ticks

getMinorTicks

public static Tick[] getMinorTicks(Ticker ticker,
                                   double dlo,
                                   double dhi)
Use a given ticker to generate minor ticks in a given range of coordinates.

Parameters:
ticker - tick generator
dlo - minimum axis data value
dhi - maximum axis data value
Returns:
array of minor ticks


Copyright © 2013 Central Laboratory of the Research Councils. All Rights Reserved.