Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.hartmath.JSci.awt
Class Graph2D  view Graph2D download Graph2D.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Canvas
          extended bycom.hartmath.JSci.awt.DoubleBufferedCanvas
              extended bycom.hartmath.JSci.awt.Graph2D
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, GraphDataListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
Direct Known Subclasses:
LineGraph, ScatterGraph

public abstract class Graph2D
extends DoubleBufferedCanvas
implements GraphDataListener

The Graph2D superclass provides an abstract encapsulation of 2D graphs.

Version:
1.0

Nested Class Summary
 
Nested classes inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  int axisPad
          Padding.
protected  float maxX
          Min and max data points.
protected  float maxY
          Min and max data points.
protected  float minX
          Min and max data points.
protected  float minY
          Min and max data points.
protected  Graph2DModel model
          Data model.
private  boolean numbering
          Axis numbering.
protected  java.awt.Point origin
          Origin.
protected  int scalePad
          Padding.
protected  float xScale
          Axis scaling.
protected  float yScale
          Axis scaling.
 
Fields inherited from class com.hartmath.JSci.awt.DoubleBufferedCanvas
 
Fields inherited from class java.awt.Canvas
 
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(Graph2DModel gm)
          Constructs a 2D graph.
 
Method Summary
protected  java.awt.Point dataToScreen(float x, float y)
          Converts a data point to screen coordinates.
protected  void drawAxes(java.awt.Graphics g)
          Draws the graph axes.
 Graph2DModel getModel()
          Returns the model used by this graph.
protected  void rescale()
          Rescales the Graph2D.
protected  float round(float x)
          Rounds numbers to so many significant figures.
 void setBounds(int x, int y, int width, int height)
          Reshapes the Graph2D to the specified bounding box.
 void setModel(Graph2DModel gm)
          Sets the data plotted by this graph to the specified data.
 void setNumbering(boolean flag)
          Turns axis numbering on/off.
 
Methods inherited from class com.hartmath.JSci.awt.DoubleBufferedCanvas
offscreenPaint, paint, redraw, update
 
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, 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, 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, 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, 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, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, 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
 
Methods inherited from interface com.hartmath.JSci.awt.GraphDataListener
dataChanged
 

Field Detail

model

protected Graph2DModel model
Data model.


numbering

private boolean numbering
Axis numbering.


origin

protected java.awt.Point origin
Origin.


minX

protected float minX
Min and max data points.


minY

protected float minY
Min and max data points.


maxX

protected float maxX
Min and max data points.


maxY

protected float maxY
Min and max data points.


xScale

protected float xScale
Axis scaling.


yScale

protected float yScale
Axis scaling.


scalePad

protected final int scalePad
Padding.

See Also:
Constant Field Values

axisPad

protected final int axisPad
Padding.

See Also:
Constant Field Values
Constructor Detail

Graph2D

public Graph2D(Graph2DModel gm)
Constructs a 2D graph.

Method Detail

setModel

public final void setModel(Graph2DModel gm)
Sets the data plotted by this graph to the specified data.


getModel

public final Graph2DModel getModel()
Returns the model used by this graph.


setNumbering

public final void setNumbering(boolean flag)
Turns axis numbering on/off.


setBounds

public final void setBounds(int x,
                            int y,
                            int width,
                            int height)
Reshapes the Graph2D to the specified bounding box.


rescale

protected final void rescale()
Rescales the Graph2D.


dataToScreen

protected final java.awt.Point dataToScreen(float x,
                                            float y)
Converts a data point to screen coordinates.


drawAxes

protected final void drawAxes(java.awt.Graphics g)
Draws the graph axes.


round

protected final float round(float x)
Rounds numbers to so many significant figures.