public class AxisLabeller extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
AxisLabeller.TickStyle
Defines tick mark annotation styles.
|
| Modifier and Type | Field and Description |
|---|---|
static AxisLabeller.TickStyle |
ANTI_Y
Tick style suitable for right-hand-side Y axis labels.
|
static AxisLabeller.TickStyle |
X
Tick style suitable for X axis labels.
|
static AxisLabeller.TickStyle |
Y
Tick style suitable for Y axis labels.
|
| Constructor and Description |
|---|
AxisLabeller(String axisLabel,
double lo,
double hi,
int npix,
boolean log,
boolean flip,
FontMetrics fm,
AxisLabeller.TickStyle tickStyle,
int reqTick,
int loPad,
int hiPad)
Constructs a new labeller giving enough information to determine
where the tickmarks will appear.
|
| Modifier and Type | Method and Description |
|---|---|
void |
annotateAxis(Graphics g)
Draw the axis labels on a given graphics context.
|
void |
drawGridLine(Graphics g,
int y0,
int y1,
double value)
Draws a single grid line on a given graphics context.
|
void |
drawGridLines(Graphics g,
int y0,
int y1)
Draws grid lines on a given graphics context.
|
Rectangle |
getAnnotationBounds()
Returns the bounding box that contains the axis and annotations
drawn that this labeller would like to draw.
|
int |
getHiPad()
Returns the number of pixels above npix available for drawing on.
|
int |
getLoPad()
Returns the number of pixels below 0 available for drawing on.
|
int |
getNpix()
Returns the number of pixels along this axis.
|
void |
setDrawText(boolean drawText)
Sets whether textual labels should be drawn on the axis.
|
void |
setNpix(int npix)
Sets the number of pixels along this axis.
|
void |
setTickStyle(AxisLabeller.TickStyle tickStyle)
Sets the tick mark style to one of the predefined settings.
|
public static final AxisLabeller.TickStyle X
public static final AxisLabeller.TickStyle Y
public static final AxisLabeller.TickStyle ANTI_Y
public AxisLabeller(String axisLabel, double lo, double hi, int npix, boolean log, boolean flip, FontMetrics fm, AxisLabeller.TickStyle tickStyle, int reqTick, int loPad, int hiPad)
axisLabel - text annotation for the axislo - lower bound of the data rangehi - upper bound of the data rangenpix - number of pixels along the length of the axislog - true iff the scale is to be logarithmicflip - true iff the scale is reversed (low to high is
right to left instead of left to right)fm - font metrics used for the texttickStyle - determines positioning of ticksreqTick - suggested number of tick marks on the axis;
the actual number may be greater or smaller according to
axis length, font size etcloPad - number of pixels below 0 available for drawing onhiPad - number of pixels above npix available for drawing onpublic Rectangle getAnnotationBounds()
public int getNpix()
public void setNpix(int npix)
npix - axis length in pixelspublic int getLoPad()
public int getHiPad()
public void annotateAxis(Graphics g)
g - graphics contextpublic void drawGridLines(Graphics g, int y0, int y1)
y0 and y1.
It is the caller's responsibility to set colours and so on.g - graphics contexty0 - y coordinate of one end of the linesy1 - y coordinate of the other end of the linespublic void drawGridLine(Graphics g, int y0, int y1, double value)
y0 and y1.
The horizontal position is given by the value.
If the line is out of range, no action is taken.
It is the caller's responsibility to set colours and so on.g - graphics contexty0 - y coordinate of one end of the linesy1 - y coordinate of the other end of the linesvalue - x position of the line in data coordinatespublic void setTickStyle(AxisLabeller.TickStyle tickStyle)
X and Y are available.tickStyle - stylepublic void setDrawText(boolean drawText)
drawText - true iff you want textual labellingCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.