# Class PrefixTicker

java.lang.Object
uk.ac.starlink.ttools.plot2.PrefixTicker

All Implemented Interfaces:
  `Ticker`

public abstract class PrefixTicker extends Object implements Ticker
Partial Ticker implementation for major tick labels with prefixes. Prefixes are typically common to several adjacent ticks, but to save space only actually included for one of each class, for instance something like:

       |---------|---------|---------|---------|---------|---------|
     10:00       20        30        40        50      11:00       10

This partial implementation is based on a tick generation rule in the same way as `BasicTicker`.

Since:
  18 Oct 2013
Author:
  Mark Taylor
See Also:
  - `BasicTicker`

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static interface`
`PrefixTicker.Rule`
Defines a specific rule for generating tick marks with prefixes.

## Constructor Summary

Constructors
Constructor
Description
`PrefixTicker(Scale scale)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`abstract PrefixTicker.Rule`
`createRule(double dlo, double dhi, double approxMajorCount, int adjust)`
Returns a new rule for labelling an axis in a given range.
`TickRun`
`getTicks(double dlo, double dhi, boolean withMinor, Captioner captioner, Orientation[] orients, int npix, double crowding)`
Generates tick marks for labelling a plot axis.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### PrefixTicker

public PrefixTicker(Scale scale)
Constructor.

Parameters:
  `scale` - axis scaling

## Method Details

### createRule

public abstract PrefixTicker.Rule createRule(double dlo, double dhi, double approxMajorCount, int adjust)
Returns a new rule for labelling an axis in a given range. The tick density is determined by two parameters, `approxMajorCount`, which gives a baseline value for the number of ticks required over the given range, and `adjust`. Increasing `adjust` will give more major ticks, and decreasing it will give fewer ticks. Each value of adjust should result in a different tick count.

Parameters:
  `dlo` - minimum axis data value
  `dhi` - maximum axis data value
  `approxMajorCount` - guide value for number of major ticks in range
  `adjust` - adjusts density of major ticks, zero is normal

### getTicks

public TickRun getTicks(double dlo, double dhi, boolean withMinor, Captioner captioner, Orientation[] orients, int npix, double crowding)
Description copied from interface: `Ticker`
Generates tick marks for labelling a plot axis.

The supplied list of orientations is attempted in order; if the required crowding can be satisfied by any of them, that orientation will be used. If it can't be supplied by any (because of unavoidable label overlap) a lower crowding value may be used.

Specified by:
  `getTicks` in interface `Ticker`
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
  `orients` - array of label orientations in order of preference, must contain at least one element
  `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 along with orientation actually used