org.das2.graph
Class TickVDescriptor

java.lang.Object
  extended by org.das2.graph.TickVDescriptor

public class TickVDescriptor
extends java.lang.Object

A TickVDescriptor describes the position that ticks should be drawn, so that a fairly generic tick drawing routine can be used for multiple types of axes.


Constructor Summary
protected TickVDescriptor()
          This constructor is to support the use when tickVDescriptor was internal to DasAxis.
  TickVDescriptor(double[] minorTicks, double[] ticks, Units units)
           
 
Method Summary
static TickVDescriptor bestTickVLinear(Datum min, Datum max, int nTicksMin, int nTicksMax, boolean fin)
          return a set of linear ticks, within the given constraints.
static TickVDescriptor bestTickVLogNew(Datum minD, Datum maxD, int nTicksMin, int nTicksMax, boolean fin)
          return a set of log ticks, within the given constraints.
static TickVDescriptor bestTickVTime(Datum minD, Datum maxD, int nTicksMin, int nTicksMax, boolean fin)
           
static TickVDescriptor bestTickVTimeOrdinal(Datum minD, Datum maxD, int nTicksMin, int nTicksMax, boolean fin)
          return a set of ticks counting off ordinal time ranges, such as months, years, days, etc.
 DatumRange enclosingRange(DatumRange dr, boolean minor)
          Defining method for getting the range close to the given range, but containing at least one minor(or major) tick interval.
 Datum findTick(Datum xDatum, double direction, boolean minor)
          Locates the next or previous tick starting at xDatum.
 DatumFormatter getFormatter()
           
 DatumVector getMajorTicks()
           
 DatumVector getMinorTicks()
           
static TickVDescriptor newTickVDescriptor(DatumVector majorTicks, DatumVector minorTicks)
           
static TickVDescriptor newTickVDescriptor(java.util.List majorTicks, java.util.List minorTicks)
          creates descriptor with two Lists containing Datums.
 void setFormatter(DatumFormatter datumFormatter)
           
 java.lang.String toString()
          Returns a String representation of the TickVDescriptor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TickVDescriptor

protected TickVDescriptor()
This constructor is to support the use when tickVDescriptor was internal to DasAxis.


TickVDescriptor

public TickVDescriptor(double[] minorTicks,
                       double[] ticks,
                       Units units)
Method Detail

newTickVDescriptor

public static TickVDescriptor newTickVDescriptor(DatumVector majorTicks,
                                                 DatumVector minorTicks)

newTickVDescriptor

public static TickVDescriptor newTickVDescriptor(java.util.List majorTicks,
                                                 java.util.List minorTicks)
creates descriptor with two Lists containing Datums. java 1.5: List


getMajorTicks

public DatumVector getMajorTicks()

getMinorTicks

public DatumVector getMinorTicks()

getFormatter

public DatumFormatter getFormatter()

findTick

public Datum findTick(Datum xDatum,
                      double direction,
                      boolean minor)
Locates the next or previous tick starting at xDatum.

Parameters:
xDatum - find the tick closest to this.
direction - -1 previous, 1 next, 0 closest
minor - find closest minor tick, major if false.
Returns:
the closest tick. If there is no tick in the given direction, then the behavior is undefined.

enclosingRange

public DatumRange enclosingRange(DatumRange dr,
                                 boolean minor)
Defining method for getting the range close to the given range, but containing at least one minor(or major) tick interval.

Parameters:
minor - find the range from the minor ticks.

setFormatter

public void setFormatter(DatumFormatter datumFormatter)

toString

public java.lang.String toString()
Returns a String representation of the TickVDescriptor.

Overrides:
toString in class java.lang.Object
Returns:
a String representation of the TickVDescriptor.

bestTickVLinear

public static TickVDescriptor bestTickVLinear(Datum min,
                                              Datum max,
                                              int nTicksMin,
                                              int nTicksMax,
                                              boolean fin)
return a set of linear ticks, within the given constraints.


bestTickVLogNew

public static TickVDescriptor bestTickVLogNew(Datum minD,
                                              Datum maxD,
                                              int nTicksMin,
                                              int nTicksMax,
                                              boolean fin)
return a set of log ticks, within the given constraints.


bestTickVTimeOrdinal

public static TickVDescriptor bestTickVTimeOrdinal(Datum minD,
                                                   Datum maxD,
                                                   int nTicksMin,
                                                   int nTicksMax,
                                                   boolean fin)
return a set of ticks counting off ordinal time ranges, such as months, years, days, etc.


bestTickVTime

public static TickVDescriptor bestTickVTime(Datum minD,
                                            Datum maxD,
                                            int nTicksMin,
                                            int nTicksMax,
                                            boolean fin)