|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjava.awt.Component
java.awt.Canvas
org.mbari.siam.moos.utils.chart.graph.Graph2D
public class Graph2D
This is the main plotting class. It partitions the canvas to contain the specified axes with the remaining space taken with the plotting region. Axes are packed against the walls of the canvas. The paint and update methods of this class handle all the drawing operations of the graph. This means that independent components like Axis and DataSets must be registered with this class to be incorporated into the plot.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.awt.Canvas |
|---|
java.awt.Canvas.AccessibleAWTCanvas |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected java.util.Vector |
axis
A vector list of All the axes attached |
int |
borderBottom
The width of the border at the bottom of the canvas. |
int |
borderLeft
The width of the border at the left of the canvas. |
int |
borderRight
The width of the border at the right of the canvas. |
int |
borderTop
The width of the border at the top of the canvas. |
boolean |
clearAll
If set true (the default) the canvas will be set to the background color (erasing the plot) when the update method is called. |
protected java.awt.Color |
DataBackground
The background color for the data window |
java.awt.Rectangle |
datarect
The rectangle that the data will be plotted within. |
protected java.util.Vector |
dataset
A vector list of All the DataSets attached |
boolean |
drawgrid
If set true (the default) a grid will be drawn over the data window. |
boolean |
drawzero
If set true (the default) a grid line will be drawn across the data window at the zeros of the innermost axes. |
boolean |
frame
If set true a frame will be drawn around the data window. |
java.awt.Color |
framecolor
The color of the frame to be drawn |
java.awt.Color |
gridcolor
The color of the grid to be drawn |
TextLine |
lastText
Text to be painted Last onto the Graph Canvas. |
protected org.mbari.siam.moos.utils.chart.graph.LoadMessage |
load_thread
The blinking "data loading" thread |
int |
loadingData
If this is greater than zero it means that data loading threads are active so the message "loading data" is flashed on the plot canvas. |
protected Markers |
markers
The markers that may have been loaded |
boolean |
paintAll
If set true (the default) everything associated with the plot will be drawn when the update method or paint method are called. |
boolean |
square
Modify the position of the axis and the range of the axis so that the aspect ratio of the major tick marks are 1 and the plot is square on the screen |
java.awt.Color |
zerocolor
The color of the zero grid lines. |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
Graph2D()
|
|
| Method Summary | |
|---|---|
void |
attachAxis(Axis a)
Attach a previously created Axis. |
void |
attachDataSet(DataSet d)
Attach a DataSet to the graph. |
Axis |
createAxis(int position)
Create and attach an Axis to the graph. |
void |
detachAxes()
Detach All attached Axes. |
void |
detachAxis(Axis a)
Detach a previously attached Axis. |
void |
detachDataSet(DataSet d)
Detach the DataSet from the class. |
void |
detachDataSets()
Detach All the DataSets from the class. |
protected java.awt.Rectangle |
drawAxis(java.awt.Graphics g,
java.awt.Rectangle r)
Draw the Axis. |
protected void |
drawFrame(java.awt.Graphics g,
int x,
int y,
int width,
int height)
|
void |
finishedloading()
Decrement the loading Data counter by one. |
protected java.awt.Rectangle |
ForceSquare(java.awt.Graphics g,
java.awt.Rectangle r)
Force the plot to have an aspect ratio of 1 by forcing the axes to have the same range. |
protected java.awt.Rectangle |
getDataRectangle(java.awt.Graphics g,
java.awt.Rectangle r)
Calculate the rectangle occupied by the data |
Markers |
getMarkers()
Get the markers |
double |
getXmax()
Get the Maximum X value of all attached DataSets. |
double |
getXmin()
Get the Minimum X value of all attached DataSets. |
double |
getYmax()
Get the Maximum Y value of all attached DataSets. |
double |
getYmin()
Get the Minimum Y value of all attached DataSets. |
boolean |
keyDown(java.awt.Event e,
int key)
Handle keyDown events. |
DataSet |
loadDataSet(double[] data,
int n)
Load and Attach a DataSet from an array. |
DataSet |
loadFile(java.net.URL file)
Load and Attach a DataSet from a File. |
void |
loadmessage(java.lang.String s)
Change the message to be flashed on the canvas |
void |
paint(java.awt.Graphics g)
This paints the entire plot. |
void |
paintBeforeData(java.awt.Graphics g,
java.awt.Rectangle r)
A hook into the Graph2D.paint method. |
void |
paintFirst(java.awt.Graphics g,
java.awt.Rectangle r)
A hook into the Graph2D.paint method. |
void |
paintLast(java.awt.Graphics g,
java.awt.Rectangle r)
A hook into the Graph2D.paint method. |
void |
setDataBackground(java.awt.Color c)
Set the background color for the data window. |
void |
setGraphBackground(java.awt.Color c)
Set the background color for the entire canvas. |
void |
setMarkers(Markers m)
Set the markers for the plot. |
void |
startedloading()
Calling this method pauses the plot and displays a flashing message on the screen. |
void |
update(java.awt.Graphics g)
This method is called via the Graph2D.repaint() method. |
| Methods inherited from class java.awt.Canvas |
|---|
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy |
| Methods inherited from class java.awt.Component |
|---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.util.Vector axis
attachAxis(Axis a)protected java.util.Vector dataset
attachDataSet(DataSet d),
DataSetprotected Markers markers
setMarkers(Markers m)protected org.mbari.siam.moos.utils.chart.graph.LoadMessage load_thread
startedloading()protected java.awt.Color DataBackground
public int loadingData
public int borderTop
public int borderBottom
public int borderLeft
public int borderRight
public boolean frame
public java.awt.Color framecolor
public boolean drawgrid
public java.awt.Color gridcolor
public boolean drawzero
public java.awt.Color zerocolor
public java.awt.Rectangle datarect
public boolean clearAll
public boolean paintAll
public boolean square
public TextLine lastText
| Constructor Detail |
|---|
public Graph2D()
| Method Detail |
|---|
public DataSet loadFile(java.net.URL file)
file - The URL of the data file to read.
public DataSet loadDataSet(double[] data,
int n)
data - The data to be loaded in the form x,y,x,y,...n - The number of (x,y) data points. This means that the
minimum length of the data array is 2*n.
public void attachDataSet(DataSet d)
public void detachDataSet(DataSet d)
d - The DataSet to detach.public void detachDataSets()
public Axis createAxis(int position)
position - Position of the axis in the drawing window.public void attachAxis(Axis a)
a - The Axis to attach.public void detachAxis(Axis a)
a - The Axis to dettach.public void detachAxes()
public double getXmax()
public double getYmax()
public double getXmin()
public double getYmin()
public void setMarkers(Markers m)
m - Marker class containing the defined markersMarkerspublic Markers getMarkers()
Markerspublic void setGraphBackground(java.awt.Color c)
c - The color to set the canvaspublic void setDataBackground(java.awt.Color c)
c - The color to set the data window.public void paint(java.awt.Graphics g)
paint in class java.awt.Canvasg - Graphics state.
public void paintFirst(java.awt.Graphics g,
java.awt.Rectangle r)
g - Graphics stater - Rectangle containing the graph
public void paintBeforeData(java.awt.Graphics g,
java.awt.Rectangle r)
g - Graphics stater - Rectangle containing the data
public void paintLast(java.awt.Graphics g,
java.awt.Rectangle r)
g - Graphics stater - Rectangle containing the datapublic void update(java.awt.Graphics g)
update in class java.awt.Canvas
public boolean keyDown(java.awt.Event e,
int key)
keyDown in class java.awt.Componentpublic void startedloading()
finishedloading(),
loadmessage(String s)public void finishedloading()
startedloading(),
loadmessage(String s)public void loadmessage(java.lang.String s)
s - String contining the new message.startedloading(),
finishedloading()
protected java.awt.Rectangle ForceSquare(java.awt.Graphics g,
java.awt.Rectangle r)
protected java.awt.Rectangle getDataRectangle(java.awt.Graphics g,
java.awt.Rectangle r)
protected java.awt.Rectangle drawAxis(java.awt.Graphics g,
java.awt.Rectangle r)
protected void drawFrame(java.awt.Graphics g,
int x,
int y,
int width,
int height)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||