|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--org.omegahat.Graphics.Primitives.GraphicalObject
|
+--org.omegahat.Graphics.Primitives.RGO
|
+--org.omegahat.Graphics.Primitives.GraphicalContainer
|
+--org.omegahat.Graphics.Plots.Axis
the class for creating plot axes, with tick marks and labels.
Will choose suitable ``pretty'' locations for the ticks and generate corresponding text labels.
Currently only linear axes are implemented; that is, the tick positions will be equally spaced (linearly) over the scale of the axis. However, you can use the constructor that takes tick positions and labels to generate custom axes, or you can reset the tick locations to the transformed values after generating the axis. Just get the tick locations, modify them, and call makeAxis((Scale)null).
| Field Summary | |
protected GraphicalObject |
axisLabel
The label for the entire axis. |
static int |
DEFAULT_NTICKS
the default suggestion for number of ticks (5). |
protected int |
nTicks
the suggested number of ticks and labels |
protected java.lang.String[] |
tickLabel
the labels for the tick marks. |
protected double[] |
tickLocn
the locations of the tick marks and tick labels. |
protected java.util.Vector |
ticks
The vector of tick objects. |
| Fields inherited from class org.omegahat.Graphics.Primitives.GraphicalContainer |
allocator, children, origin, parent, scaleX, scaleY |
| Fields inherited from class org.omegahat.Graphics.Primitives.RGO |
region |
| Fields inherited from class org.omegahat.Graphics.Primitives.GraphicalObject |
ACTIVE, fontSize, lastDevice, lastHeightCM, lastRegion, lastWidthCM, parents, status, VISIBLE |
| Fields inherited from interface org.omegahat.Environment.DataStructures.MathOperable |
DIVIDE, MINUS, MULTIPLY, PLUS |
| Constructor Summary | |
Axis()
|
|
Axis(ScaleInt s,
double[] tickLocn,
java.lang.String[] tickLabel,
java.lang.String axisLabel)
a constructor when you want to do it all yourself. |
|
Axis(ScaleInt s,
java.lang.String label)
use the given scale, choosing pretty tick locations with the default number of ticks, and generating tick labels from the corresponding numbers. |
|
Axis(ScaleInt s,
java.lang.String label,
int nTicks)
use the given scale, using the specified number of ticks to generate labels and positions for the tick marks. |
|
| Method Summary | |
void |
create(ScaleInt s,
java.lang.String label,
AxisRangeInt sr)
|
protected void |
createTickData(AxisRangeInt sr)
Populate the internal information about the tick marks and labels computed from the range information. |
abstract void |
editScale(double min,
double max)
Change the scale to the given minimum and maximum. |
GraphicalObject |
getAxisLabel()
Accessor for axisLabel field |
int |
getNTicks()
get the |
abstract ScaleInt |
getScale()
Get the scale object for this axis |
java.lang.String[] |
getTickLabels()
the tick labels. |
double[] |
getTickLocations()
the tick locations. |
void |
makeAxis(ScaleInt s,
double[] tickLocn,
java.lang.String[] tickLabel,
java.lang.String label)
remake the axis (e.g, after transforming the tick locations). |
abstract void |
makeContainer(ScaleInt s)
|
abstract void |
makeLabel(java.lang.String label)
Make this string the label for the entire axis. |
abstract void |
makeMajor()
|
abstract void |
makeTicks(ScaleInt s,
double[] tickLocn,
java.lang.String[] tickLabel)
|
void |
removeTicks()
|
GraphicalObject |
setAxisLabel(GraphicalObject value)
Accessor for setting axisLabel field |
void |
setNTicks(int n)
set the |
void |
setTickLabels(java.lang.String[] labels)
set the tick labels, but leave the location alone. |
void |
setTickLocations(double[] locations)
set the tick locations, but leave the labels alone. |
| Methods inherited from class org.omegahat.Graphics.Primitives.GraphicalContainer |
add, addGraphicalObject, addGraphicalObject, addGraphicalObject, addGraphicalObject, addGraphicalObject, addGraphicalObject, addGraphicalObject, addGraphicalObject, addGraphicalObject, addGraphicalObject, addValue, copy, copy, draw, drawChildren, get, getChild, getChildCount, getChildren, getDevice, getOrigin, getRegionAllocator, getXScale, getYScale, parent, parent, remove, removeGraphicalObject, removeGraphicalObject, setOrigin, setRegionAllocator, setXScale, setYScale, subset, subset, transform, transform |
| Methods inherited from class org.omegahat.Graphics.Primitives.RGO |
center, centre, createRegionDescription, createRegionDescription, getRegion, height, height, setHJust, setRegion, setVJust, width, width, x, x, y, y |
| Methods inherited from class org.omegahat.Graphics.Primitives.GraphicalObject |
cacheSize, getFontSize, getFontSize, getParameters, getParents, getStatus, isActive, isVisible, lastHeightCM, lastRegion, lastWidthCM, parents, setActive, setParameters, setParents, setVisible |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.omegahat.Graphics.Primitives.ScaledComponentInt |
getXScale, getYScale, setXScale, setYScale |
| Methods inherited from interface org.omegahat.Graphics.Primitives.GraphicalComponentInt |
draw, getParameters, getRegion, isActive, isVisible, parent, parent, parents, setActive, setParameters, setRegion, setVisible |
| Field Detail |
public static final int DEFAULT_NTICKS
protected int nTicks
protected double[] tickLocn
protected java.lang.String[] tickLabel
protected java.util.Vector ticks
protected GraphicalObject axisLabel
| Constructor Detail |
public Axis()
public Axis(ScaleInt s,
double[] tickLocn,
java.lang.String[] tickLabel,
java.lang.String axisLabel)
public Axis(ScaleInt s,
java.lang.String label)
public Axis(ScaleInt s,
java.lang.String label,
int nTicks)
| Method Detail |
public GraphicalObject getAxisLabel()
axisLabel fieldpublic GraphicalObject setAxisLabel(GraphicalObject value)
axisLabel fieldpublic abstract ScaleInt getScale()
AxisIntgetScale in interface AxisIntpublic int getNTicks()
public double[] getTickLocations()
public void setTickLocations(double[] locations)
public java.lang.String[] getTickLabels()
public void setTickLabels(java.lang.String[] labels)
public void setNTicks(int n)
0 is allowed, but a negative number resets the number of tick marks to the default.
public void create(ScaleInt s,
java.lang.String label,
AxisRangeInt sr)
protected void createTickData(AxisRangeInt sr)
public void makeAxis(ScaleInt s,
double[] tickLocn,
java.lang.String[] tickLabel,
java.lang.String label)
If the scale provided is null, the scale will be recomputed from the current tick locations.
public abstract void makeContainer(ScaleInt s)
public abstract void makeMajor()
public abstract void makeTicks(ScaleInt s,
double[] tickLocn,
java.lang.String[] tickLabel)
public abstract void makeLabel(java.lang.String label)
AxisIntmakeLabel in interface AxisIntpublic void removeTicks()
public abstract void editScale(double min,
double max)
The bottom axis and left axis define this to recreate the suitable ticks, etc.
editScale in interface AxisInt
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||