@Equality public abstract class Axis extends Object
createAxis
factory method.Modifier | Constructor and Description |
---|---|
protected |
Axis(int glo,
int ghi,
double dlo,
double dhi)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static Axis |
createAxis(int glo,
int ghi,
double dlo,
double dhi,
boolean log,
boolean flip)
Factory method to create a linear or logarithmic axis.
|
abstract double[] |
dataPan(double d0,
double d1)
Returns the data bounds that result from performing an axis pan
between two given data positions.
|
abstract double |
dataToGraphics(double d)
Converts a data coordinate to the graphics position on this axis.
|
abstract double[] |
dataZoom(double d0,
double factor)
Returns the data bounds that result from performing an axis zoom
about a given data position.
|
void |
drawLabels(Tick[] ticks,
String title,
Captioner captioner,
TickLook tickLook,
Orientation orient,
boolean invert,
Graphics g)
Draws an axis title and supplied tickmarks.
|
double[] |
getDataLimits()
Returns the axis data bounds.
|
int[] |
getGraphicsLimits()
Returns the axis graphics bounds.
|
Rectangle |
getLabelBounds(Tick[] ticks,
String title,
Captioner captioner,
Orientation orient,
boolean invert)
Determines the bounds for axis and tickmark annotations.
|
abstract double |
graphicsToData(double g)
Converts a graphics position on this axis to a data coordinate.
|
abstract boolean |
isLinear()
Indicates whether the scaling on this axis is linear.
|
static double[] |
pan(double dlo,
double dhi,
double d0,
double d1,
boolean isLog)
Utility method for axis panning.
|
static double[] |
zoom(double dlo,
double dhi,
double d0,
double factor,
boolean isLog)
Utility method for axis zooming.
|
protected Axis(int glo, int ghi, double dlo, double dhi)
glo
- minimum graphics coordinateghi
- maximum graphics coordinatedlo
- minimum data coordinatedhi
- maximum data coordinatepublic abstract double dataToGraphics(double d)
d
- data coordinatepublic abstract double graphicsToData(double g)
g
- graphics coordinatepublic abstract double[] dataZoom(double d0, double factor)
d0
- data reference position for zoomfactor
- amount to zoompublic abstract double[] dataPan(double d0, double d1)
d0
- source data positiond1
- destination data positionpublic int[] getGraphicsLimits()
glo
)
is always strictly less than the second (ghi
).public double[] getDataLimits()
dlo
)
is always strictly less than the second (dhi
).public abstract boolean isLinear()
public void drawLabels(Tick[] ticks, String title, Captioner captioner, TickLook tickLook, Orientation orient, boolean invert, Graphics g)
ticks
- tickmark arraytitle
- axis label text, may be nullcaptioner
- text positioning objecttickLook
- tick drawing styleorient
- axis orientation codeinvert
- whether to reverse sense of axisg
- graphics contextpublic Rectangle getLabelBounds(Tick[] ticks, String title, Captioner captioner, Orientation orient, boolean invert)
drawLabels(uk.ac.starlink.ttools.plot2.Tick[], java.lang.String, uk.ac.starlink.ttools.plot2.Captioner, uk.ac.starlink.ttools.plot2.TickLook, uk.ac.starlink.ttools.plot2.Orientation, boolean, java.awt.Graphics)
.ticks
- tickmark arraytitle
- axis label text, may be nullcaptioner
- text positioning objectorient
- axis orientation codeinvert
- whether to reverse sense of axispublic static Axis createAxis(int glo, int ghi, double dlo, double dhi, boolean log, boolean flip)
glo
- minimum graphics coordinateghi
- maximum graphics coordinatedlo
- minimum data coordinatedhi
- maximum data coordinatelog
- true for logarithmic scaling, false for linearflip
- true if the data coordinates should run
in the opposite sense to the graphics coordinatespublic static double[] pan(double dlo, double dhi, double d0, double d1, boolean isLog)
dlo
- initial axis lower bounddhi
- initial axis upper boundd0
- pan gesture start positiond1
- pan gesture end positionisLog
- false for linear axis, true for logarithmicpublic static double[] zoom(double dlo, double dhi, double d0, double factor, boolean isLog)
dlo
- initial axis lower bounddhi
- initial axis upper boundd0
- zoom gesture reference positionfactor
- zoom factorisLog
- false for linear axis, true for logarithmicCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.