Class Axis
java.lang.Object
uk.ac.starlink.ttools.plot2.Axis
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble[]dataPan(double d0, double d1) Returns the data bounds that result from performing an axis pan between two given data positions.doubledataToGraphics(double d) Converts a data coordinate to the graphics position on this axis.double[]dataZoom(double d0, double factor) Returns the data bounds that result from performing an axis zoom about a given data position.voiddrawLabels(Tick[] ticks, String title, Captioner captioner, TickLook tickLook, Orientation orient, boolean invert, Graphics g) Draws an axis title and supplied tickmarks.booleandouble[]Returns the axis data bounds.int[]Returns the axis graphics bounds.getLabelBounds(Tick[] ticks, String title, Captioner captioner, Orientation orient, boolean invert) Determines the bounds for axis and tickmark annotations.getScale()Returns the scale used by this axis.doublegraphicsToData(double g) Converts a graphics position on this axis to a data coordinate.inthashCode()booleanisFlip()Indicates whether this axis has the scaling reversed.
-
Constructor Details
-
Axis
Constructor.- Parameters:
glo- minimum graphics coordinateghi- maximum graphics coordinatedlo- minimum data coordinatedhi- maximum data coordinatescale- scaling functionflip- true if the data coordinates should run in the opposite sense to the graphics coordinates
-
-
Method Details
-
dataToGraphics
public double dataToGraphics(double d) Converts a data coordinate to the graphics position on this axis.- Parameters:
d- data coordinate- Returns:
- graphics coordinate
-
graphicsToData
public double graphicsToData(double g) Converts a graphics position on this axis to a data coordinate.- Parameters:
g- graphics coordinate- Returns:
- data coordinate
-
dataZoom
public double[] dataZoom(double d0, double factor) Returns the data bounds that result from performing an axis zoom about a given data position.- Parameters:
d0- data reference position for zoomfactor- amount to zoom- Returns:
- 2-element array giving new new data min/max coordinates
-
dataPan
public double[] dataPan(double d0, double d1) Returns the data bounds that result from performing an axis pan between two given data positions.- Parameters:
d0- source data positiond1- destination data position- Returns:
- 2-element array giving new new data min/max coordinates
-
getGraphicsLimits
public int[] getGraphicsLimits()Returns the axis graphics bounds. The first element of the result (glo) is always strictly less than the second (ghi).- Returns:
- 2-element array giving the graphics min/max coordinates
-
getDataLimits
public double[] getDataLimits()Returns the axis data bounds. The first element of the result (dlo) is always strictly less than the second (dhi).- Returns:
- 2-element array giving the data min/max coordinates
-
getScale
-
isFlip
public boolean isFlip()Indicates whether this axis has the scaling reversed.- Returns:
- true iff graphics and data coordinates increase in opposite directions
-
drawLabels
public void drawLabels(Tick[] ticks, String title, Captioner captioner, TickLook tickLook, Orientation orient, boolean invert, Graphics g) Draws an axis title and supplied tickmarks.- Parameters:
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 context
-
getLabelBounds
public Rectangle getLabelBounds(Tick[] ticks, String title, Captioner captioner, Orientation orient, boolean invert) Determines the bounds for axis and tickmark annotations. The returned value is a bounding box for everything that would be drawn by a corresponding call todrawLabels(Tick[], String, Captioner, TickLook, Orientation, boolean, Graphics).- Parameters:
ticks- tickmark arraytitle- axis label text, may be nullcaptioner- text positioning objectorient- axis orientation codeinvert- whether to reverse sense of axis- Returns:
- bounding box for all annotations
-
hashCode
-
equals
-