SNMP Stack 4_12

uk.co.westhawk.visual
Class BareGraph

java.lang.Object
  |
  +--java.awt.Component
        |
        +--uk.co.westhawk.visual.BareGraph
All Implemented Interfaces:
java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable

public class BareGraph
extends java.awt.Component
implements java.beans.PropertyChangeListener

The class BareGraph makes a graphical respresentation of a set of integer values. The values are provided by the GraphDataSet class.

The line that this class draws can be set to the 10log() representation of the values.

Version:
$Revision: 1.6 $ $Date: 2002/10/10 15:13:58 $
Author:
Tim Panton
See Also:
Graph, GraphDataSet, Serialized Form

Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
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
BareGraph()
          The default constructor.
BareGraph(GraphDataSet d)
          The constructor with the data set
 
Method Summary
 java.awt.Color getAxisColour()
          Returns the colour of the axes of the graph.
 float getAxisPercent()
          Returns the per cent size of the axes in respect to the graph.
 GraphDataSet getDataSet()
          Returns the data set that the graph displays.
 java.awt.Color getGraphColour()
          Returns the colour of the line of the graph.
 int getMax()
          Returns the maximum value that is displayed in the graph.
 int getMin()
          Returns the minimum value that is displayed in the graph.
 java.awt.Dimension getMinimumSize()
          Returns the minimum size.
 java.awt.Dimension getPreferredSize()
          Returns the preferred size.
 boolean isLog()
          Returns the log mode of the graph.
 void paint(java.awt.Graphics g)
           
 void propertyChange(java.beans.PropertyChangeEvent evt)
          Implements the PropertyChangeListener.
 void setAxes(boolean b)
          Makes the graph draw the axes or not.
 void setAxisColour(java.awt.Color c)
          Sets the colour of the axes of the graph.
 void setAxisPercent(float x)
          Sets the per cent size of the axes in respect to the graph.
 void setDataSet(GraphDataSet d)
          Sets the data set that the graph displays.
 void setGraphColour(java.awt.Color c)
          Sets the colour of the line of the graph.
 void setLog(boolean b)
          Makes the graph draw the 10log() of the values or not.
 void setMax(int m)
          Sets the maximum value that is displayed in the graph.
 void setMin(int m)
          Sets the minimum value that is displayed in the graph.
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BareGraph

public BareGraph()
The default constructor. You need to call setDataSet
See Also:
setDataSet(uk.co.westhawk.visual.GraphDataSet)

BareGraph

public BareGraph(GraphDataSet d)
The constructor with the data set
Parameters:
d - the data set
Method Detail

setLog

public void setLog(boolean b)
Makes the graph draw the 10log() of the values or not. The default is false.
Parameters:
b - set the 10log() version on or not
See Also:
isLog()

isLog

public boolean isLog()
Returns the log mode of the graph.
Returns:
is the graph drawing the 10log() values or not
See Also:
setLog(boolean)

setAxes

public void setAxes(boolean b)
Makes the graph draw the axes or not. The default is true.
Parameters:
b - set the axes or not

getMax

public int getMax()
Returns the maximum value that is displayed in the graph.
Returns:
the maximum value
See Also:
setMax(int)

setMax

public void setMax(int m)
Sets the maximum value that is displayed in the graph.
Parameters:
m - the maximum
See Also:
getMax()

getMin

public int getMin()
Returns the minimum value that is displayed in the graph.
Returns:
the minimum
See Also:
setMin(int)

setMin

public void setMin(int m)
Sets the minimum value that is displayed in the graph.
Parameters:
m - the minimum value
See Also:
getMin()

getAxisColour

public java.awt.Color getAxisColour()
Returns the colour of the axes of the graph.
Returns:
the axes' colour
See Also:
setAxisColour(java.awt.Color)

setAxisColour

public void setAxisColour(java.awt.Color c)
Sets the colour of the axes of the graph. The default is Color.red.
Parameters:
c - the axes' colour
See Also:
getAxisColour()

getGraphColour

public java.awt.Color getGraphColour()
Returns the colour of the line of the graph.
Returns:
the line's colour
See Also:
setGraphColour(java.awt.Color)

setGraphColour

public void setGraphColour(java.awt.Color c)
Sets the colour of the line of the graph. The default is Color.blue.
Parameters:
c - the line's colour
See Also:
getGraphColour()

getAxisPercent

public float getAxisPercent()
Returns the per cent size of the axes in respect to the graph.
Returns:
the size (%) of the axes
See Also:
setAxisPercent(float)

setAxisPercent

public void setAxisPercent(float x)
Sets the per cent size of the axes in respect to the graph. The default is 5.0 %.
Parameters:
c - the size (%) of axes
See Also:
getAxisPercent()

getPreferredSize

public java.awt.Dimension getPreferredSize()
Returns the preferred size.
Overrides:
getPreferredSize in class java.awt.Component
Returns:
the dimensions of the preferred size

getMinimumSize

public java.awt.Dimension getMinimumSize()
Returns the minimum size.
Overrides:
getMinimumSize in class java.awt.Component
Returns:
the dimensions of the minimum size

setDataSet

public void setDataSet(GraphDataSet d)
Sets the data set that the graph displays. Depending on the log mode, the line will represents the values of the 10log() of the values.
Parameters:
d - the data set.
See Also:
getDataSet()

getDataSet

public GraphDataSet getDataSet()
Returns the data set that the graph displays.
Returns:
the data set.
See Also:
setDataSet(uk.co.westhawk.visual.GraphDataSet)

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Implements the PropertyChangeListener. Gets the update of the data.
Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
evt - the property change event
See Also:
PropertyChangeListener

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class java.awt.Component

SNMP Stack 4_12