|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.mbari.siam.moos.utils.chart.graph.Axis
public class Axis
This class controls the look and feel of axes. It is designed to be used in conjunction with the Graph2D class and DataSet class for plotting 2D graphs. To work with the other classes a system of registration is used. The axes have to be attached to the controlling Graph2D class and the DataSet's have to be attached to both the Graph2D class and the Axis class. This way the 3 main classes Graph2D, Axis and DataSet know of each others existence. This does not mean the classes cannot be used independently, they can but in this mode nothing is automated, the user must code everything manually
| Field Summary | |
|---|---|
protected java.awt.Point |
amax
The position in pixels of the maximum point of the axis line |
protected java.awt.Point |
amin
The position in pixels of the minimum point of the axis line |
java.awt.Color |
axiscolor
Color of the Axis. |
static int |
BOTTOM
Constant flagging Axis position on the graph. |
java.awt.Dimension |
data_window
Before the Axis can be positioned correctly and drawn the data window needs to be calculated and passed to the Axis. |
protected java.util.Vector |
dataset
Vector containing a list of attached DataSets |
boolean |
drawgrid
If true draw a grid positioned on major ticks over the graph |
boolean |
drawzero
If true draw a line positioned on the Zero label tick mark. |
protected RTextLine |
exponent
Textline class to hold the label's exponent (if it has one). |
boolean |
force_end_labels
Rescale the axis so that labels fall at the end of the Axis. |
Graph2D |
g2d
The graph canvas this axis is attached to (if it is attached to any) |
java.awt.Color |
gridcolor
Color of the grid |
protected int |
guess_label_number
Initial guess for the number of labels required |
protected RTextLine |
label
Textline class to hold the labels before printing. |
protected int |
label_count
The number of labels required |
protected int |
label_exponent
The label exponent |
protected double |
label_start
The starting value of the labels |
protected double |
label_step
The increment between labels |
protected java.lang.String[] |
label_string
String to contain the labels. |
protected float[] |
label_value
The actual values of the axis labels |
static int |
LEFT
Constant flagging Axis position on the graph. |
int |
major_tic_size
Size in pixels of the major tick marks |
protected boolean |
manualRange
If true the axis range must be manually set by setting the Axis.minimum and Axis.maximum variables. |
protected int |
max_label_width
The width of the maximum label. |
double |
maximum
Maximum data value of the axis. |
double |
minimum
Minimum data value of the axis. |
int |
minor_tic_count
Number of minor tick marks between major tick marks |
int |
minor_tic_size
Size in pixels of the minor tick marks |
protected int |
orientation
The orientation of the axis. |
protected int |
position
The position of the axis. |
boolean |
redraw
Default value true. |
static int |
RIGHT
Constant flagging Axis position on the graph. |
protected RTextLine |
title
Textline class to contain the title of the axis. |
static int |
TOP
Constant flagging Axis position on the graph. |
protected int |
width
The width of the Axis. |
java.awt.Color |
zerocolor
Color of the line at the Zero label |
| Constructor Summary | |
|---|---|
Axis()
Instantiate the class. |
|
Axis(int p)
Instantiate the class. |
|
| Method Summary | |
|---|---|
void |
attachDataSet(DataSet d)
Attach a DataSet for the Axis to manage. |
protected void |
attachXdata(DataSet d)
Attach a DataSet to a Horizontal Axis |
protected void |
attachYdata(DataSet d)
Attach a DataSet to a Vertical Axis |
protected void |
calculateGridLabels()
calculate the labels |
void |
detachAll()
Detach All attached dataSets. |
void |
detachDataSet(DataSet d)
Detach an attached DataSet |
void |
drawAxis(java.awt.Graphics g)
Draw the axis using the passed Graphics context. |
protected void |
drawHAxis(java.awt.Graphics g)
Draw a Horizontal Axis. |
protected void |
drawVAxis(java.awt.Graphics g)
Draw a Vertical Axis. |
int |
getAxisPos()
Return the position of the Axis. |
int |
getAxisWidth(java.awt.Graphics g)
Return the width of the axis. |
double |
getDataMax()
Return the maximum value of All datasets attached to the axis. |
double |
getDataMin()
Return the minimum value of All datasets attached to the axis. |
double |
getDouble(int i)
Return the data value equivalent of the passed pixel position. |
int |
getInteger(double v)
Return the pixel equivalent of the passed data value. |
boolean |
isVertical()
If the Axis is Vertical return true. |
boolean |
positionAxis(int xmin,
int xmax,
int ymin,
int ymax)
Position the axis at the passed coordinates. |
void |
resetRange()
Reset the range of the axis (the minimum and maximum values) to the default data values. |
void |
setExponentColor(java.awt.Color c)
Set the color of the exponent |
void |
setExponentFont(java.awt.Font f)
Set the font of the exponent |
void |
setLabelColor(java.awt.Color c)
Set the color of the labels |
void |
setLabelFont(java.awt.Font f)
Set the font of the labels. |
void |
setManualRange(boolean b)
Is the range of the axis to be set automatically (based on the data) or manually by setting the values Axis.minimum and Axis.maximum? |
void |
setPosition(int p)
Set the axis position. |
void |
setTitleColor(java.awt.Color c)
Set the color of the title |
void |
setTitleFont(java.awt.Font f)
Set the font of the title |
void |
setTitleRotation(int a)
Set the title rotation angle. |
void |
setTitleText(java.lang.String s)
Set the title of the axis |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int LEFT
public static final int RIGHT
public static final int TOP
public static final int BOTTOM
public boolean drawgrid
public boolean drawzero
public java.awt.Color gridcolor
public java.awt.Color zerocolor
public boolean redraw
drawVAxis(Graphics g),
drawHAxis(Graphics g)public boolean force_end_labels
public int major_tic_size
public int minor_tic_size
public int minor_tic_count
public java.awt.Color axiscolor
public double minimum
public double maximum
public java.awt.Dimension data_window
public Graph2D g2d
Graph2Dprotected java.awt.Point amin
protected java.awt.Point amax
protected int orientation
protected int position
protected int width
protected RTextLine title
protected RTextLine label
protected RTextLine exponent
protected int max_label_width
protected java.util.Vector dataset
protected java.lang.String[] label_string
protected float[] label_value
protected double label_start
protected double label_step
protected int label_exponent
protected int label_count
protected int guess_label_number
protected boolean manualRange
| Constructor Detail |
|---|
public Axis()
public Axis(int p)
p - Set the axis position. Must be one of Axis.BOTTOM,
Axis.TOP, Axis.LEFT, Axis.RIGHT, Axis.HORIZONTAL or Axis.VERTICAL.
If one of the latter two are used then Axis.BOTTOM or
Axis.LEFT is assumed.| Method Detail |
|---|
public void setPosition(int p)
p - Must be one of Axis.BOTTOM,
Axis.TOP, Axis.LEFT, Axis.RIGHT, Axis.HORIZONTAL or Axis.VERTICAL.
If one of the latter two are used then Axis.BOTTOM or
Axis.LEFT is assumed.public void attachDataSet(DataSet d)
d - dataSet to attachDataSetpublic void detachDataSet(DataSet d)
d - dataSet to detachDataSetpublic void detachAll()
public double getDataMin()
public double getDataMax()
public int getInteger(double v)
v - data value to convert
getDouble(int i)public double getDouble(int i)
i - pixel value
getInteger(double v)public void resetRange()
public int getAxisPos()
public boolean isVertical()
public int getAxisWidth(java.awt.Graphics g)
g - graphics context.
public boolean positionAxis(int xmin,
int xmax,
int ymin,
int ymax)
xmin - The minimum X pixelxmax - The maximum X pixel. These should be equal if the axis
is verticalymin - The minimum Y pixelymax - The maximum Y pixel. These should be equal if the axis
is horizontal
public void drawAxis(java.awt.Graphics g)
g - Graphics context for drawingpublic void setTitleText(java.lang.String s)
s - string containing text.public void setTitleColor(java.awt.Color c)
c - Color of the title.public void setTitleFont(java.awt.Font f)
f - Title font.public void setTitleRotation(int a)
a - Title rotation angle in degrees.public void setLabelColor(java.awt.Color c)
c - Color of the labels.public void setLabelFont(java.awt.Font f)
f - font.public void setExponentColor(java.awt.Color c)
c - Color.public void setExponentFont(java.awt.Font f)
f - font.public void setManualRange(boolean b)
b - boolean value.protected void drawHAxis(java.awt.Graphics g)
g - Graphics context.protected void drawVAxis(java.awt.Graphics g)
g - Graphics context.protected void attachXdata(DataSet d)
d - dataset to attach.protected void attachYdata(DataSet d)
d - dataset to attach.protected void calculateGridLabels()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||