org.haldean.simplegraph
Class StaticGraphComponent<E extends java.lang.Number>

java.lang.Object
  extended by java.awt.Component
      extended by org.haldean.simplegraph.StaticGraphComponent<E>
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class StaticGraphComponent<E extends java.lang.Number>
extends java.awt.Component

A component which draws a graph when provided with a list of precomputed values. The graph automatically scales along the X and Y axes.

Author:
Will Brown (will.h.brown@gmail.com)
See Also:
Serialized Form

Nested Class Summary
 
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
 
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
StaticGraphComponent()
          Create a new StaticGraphComponent with the default GraphConfiguration.
StaticGraphComponent(GraphConfiguration gc)
          Create a new StaticGraphComponent with the specified GraphConfiguration.
 
Method Summary
 void addValue(E value)
          Add a value to the data series and refresh the graph.
 void addValueList(java.util.List<E> values)
          Add a list of values to the data series.
 GraphConfiguration getGraphConfiguration()
          Get the GraphConfiguration of this component.
 void paint(java.awt.Graphics canvas)
          Paints the graph onto the provided graphics object
 void setGraphConfiguration(GraphConfiguration gc)
          Set the GraphConfiguration of the graph.
 void setMaximum(double max)
          Manually set the maximum.
 void setMinimum(double min)
          Manually set the minimum.
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, 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, getAccessibleContext, 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, 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, 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, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StaticGraphComponent

public StaticGraphComponent()
Create a new StaticGraphComponent with the default GraphConfiguration.


StaticGraphComponent

public StaticGraphComponent(GraphConfiguration gc)
Create a new StaticGraphComponent with the specified GraphConfiguration.

Parameters:
gc - The GraphConfiguration to use.
Method Detail

setMaximum

public void setMaximum(double max)
Manually set the maximum. Note that if a data point larger than this maximum is added, the graph will automatically scale. This sets a lower bound on the actual maximum of the graph.

Parameters:
max - The lower bound for the maximum

setMinimum

public void setMinimum(double min)
Manually set the minimum. Note that if a data point smaller than this minimum is added, the graph will automatically scale. This sets an upper bound on the actual minimum of the graph.

Parameters:
min - The upper bound for the minimum

setGraphConfiguration

public void setGraphConfiguration(GraphConfiguration gc)
Set the GraphConfiguration of the graph.

Parameters:
gc - The configuration to assign.

getGraphConfiguration

public GraphConfiguration getGraphConfiguration()
Get the GraphConfiguration of this component.


addValue

public void addValue(E value)
Add a value to the data series and refresh the graph.

Parameters:
value - The value to add

addValueList

public void addValueList(java.util.List<E> values)
Add a list of values to the data series.

Parameters:
values - The values to add.

paint

public void paint(java.awt.Graphics canvas)
Paints the graph onto the provided graphics object

Overrides:
paint in class java.awt.Component
Parameters:
canvas - The graphics object to paint onto