Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## uchicago.src.sim.analysis.plot
Class OpenGraph

    java.lang.Object
      uchicago.src.sim.analysis.plot.OpenGraph

All Implemented Interfaces:
  ZoomListener, MediaProducer

Direct Known Subclasses:
  Histogram, OpenHistogram, OpenSequenceGraph, Plot

    public abstract class OpenGraph

extends java.lang.Object
implements ZoomListener, MediaProducer

The base class for the Ptolemy based open source charting components: OpenSequenceGraph and OpenHistogram. OpenGraph encapsulates a RepastPlot object, provides some reasonable defaults. It also implements ZoomListener, and adds a KeyListener to the plot in order to correctly undo a zoom with the 'r' key.

Version:
  $Revision: 1.19 $ $Date: 2004/11/03 19:51:02 $
Author:
  Nick Collier (Modified by Michael J. North)

Field Summary
`static int` | `CIRCLE`
`static int` | `CROSS`
`static int` | `DIAMOND`
`protected java.lang.String` | `fileName`
`static int` | `FILLED_CIRCLE`
`static int` | `FILLED_DIAMOND`
`static int` | `FILLED_SQUARE`
`static int` | `FILLED_TRIANGLE`
`protected javax.swing.JFrame` | `frame`
`static int` | `HISTOGRAM`
`protected boolean` | `inNormalState`
`protected java.awt.Point` | `location`
`protected SimModel` | `model`
`protected MovieMaker` | `movieMaker`
`protected RepastPlot` | `plot`
`static int` | `PLUS_SIGN`
`static int` | `SEQUENCE`
`static int` | `SQUARE`
`protected java.lang.String` | `title`
`static int` | `TRIANGLE`
`protected double` | `xIncr`
`protected double` | `xMax`
`protected double` | `xMin`
`protected double` | `yIncr`
`protected double` | `yMax`
`protected double` | `yMin`

Fields inherited from interface uchicago.src.sim.gui.MediaProducer
`MPEG, QUICK_TIME`

Constructor Summary
`OpenGraph(java.lang.String title)` Creates an OpenGraph with the specified title and sets up some reasonable defaults.

Method Summary
`void` | `addMovieFrame()` Adds the currently displayed image as frame to a movie. setMovieName must be called before this method is called.
`void` | `closeMovie()` Closes the movie, writing any remaining frames to the file.
`protected BinDataSource` | `createBinDataSource(java.lang.Object target, java.lang.String methodName)` Dynamically creates a BinDataSource wrapping the method call to the specified methodName on the specified target in BinDataSource.getBinValue(Object obj).
`protected BinDataSource` | `createListBinDataSource(java.lang.Object listObj, java.lang.String listObjMethodName)`
`protected Sequence` | `createSequence(java.lang.Object feedFrom, java.lang.String methodName)` Creates a Sequence, wrapping a call of specified methodName on the feedFrom object in Sequence.getSValue().
`void` | `display()` Displays this graph.
`void` | `dispose()` Dispose of this graph.
`java.lang.String[]` | `getAxisTitles()` Returns the axis titles as a String[] where the first element is x-axis label and the second is the y-axis label.
`java.awt.Dimension` | `getSize()` Gets the size of the plot.
`java.lang.String` | `getTitle()` Returns the title of this graph.
`double` | `getXIncrement()` Get the the amount to increase or decrease the x-axis scale when a x value is out of the range of the current scale.
`double[]` | `getXRange()` Returns the range of the x-axis as a double[] where the min is the 0th elements and the max the 1st.
`double` | `getYIncrement()` Get the the amount to increase or decrease the y-axis scale when a y value is out of the range of the current scale.
`double[]` | `getYRange()` Gets the range of the y-axis as a double[] where the min is the 0th elements and the max the 1st.
`abstract void` | `record()`
`void` | `setAxisTitles(java.lang.String xAxis, java.lang.String yAxis)` Sets the axis titles.
`void` | `setBars(double width, double offset)` Sets the width and offset of the bars.
`void` | `setLocation(int x, int y)` Sets the screen location for this OpenGraph.
`void` | `setMovieName(java.lang.String fileName, java.lang.String movieType)` Sets the name and type of a movie.
`void` | `setSize(int width, int height)` Sets the size of the plot.
`void` | `setSnapshotFileName(java.lang.String name)`
`void` | `setXIncrement(double incr)` Sets the amount to increase or decrease the x-axis scale when a x value is out of the range of the current scale.
`void` | `setXRange(double min, double max)` Sets the initial range of the X-axis.
`void` | `setXTick(double position, java.lang.String label)` Associates a label with a particular x-axis tick.
`void` | `setYIncrement(double incr)` Sets the amount to increase or decrease the y-axis scale when a y value is out of the range of the current scale.
`void` | `setYRange(double min, double max)` Sets the initial range of the y-axis.
`void` | `step()` Records and updates the graph display.
`void` | `takeSnapshot()`
`abstract void` | `updateGraph()`
`void` | `updateXTick(double position, java.lang.String label, int index)` Updates an x-axis tick label with a new one.
`void` | `zoom(int x, int y)` Zoom listener interface.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### SEQUENCE

    public static final int SEQUENCE

See Also:
  Constant Field Values

### HISTOGRAM

    public static final int HISTOGRAM

See Also:
  Constant Field Values

### FILLED_CIRCLE

    public static final int FILLED_CIRCLE

See Also:
  Constant Field Values

### CROSS

    public static final int CROSS

See Also:
  Constant Field Values

### SQUARE

    public static final int SQUARE

See Also:
  Constant Field Values

### FILLED_TRIANGLE

    public static final int FILLED_TRIANGLE

See Also:
  Constant Field Values

### DIAMOND

    public static final int DIAMOND

See Also:
  Constant Field Values

### CIRCLE

    public static final int CIRCLE

See Also:
  Constant Field Values

### PLUS_SIGN

    public static final int PLUS_SIGN

See Also:
  Constant Field Values

### FILLED_SQUARE

    public static final int FILLED_SQUARE

See Also:
  Constant Field Values

### TRIANGLE

    public static final int TRIANGLE

See Also:
  Constant Field Values

### FILLED_DIAMOND

    public static final int FILLED_DIAMOND

See Also:
  Constant Field Values

### frame

    protected javax.swing.JFrame frame

### inNormalState

    protected boolean inNormalState

### xMin

    protected double xMin

### xMax

    protected double xMax

### yMin

    protected double yMin

### yMax

    protected double yMax

### xIncr

    protected double xIncr

### yIncr

    protected double yIncr

### plot

    protected RepastPlot plot

### model

    protected SimModel model

### location

    protected java.awt.Point location

### movieMaker

    protected MovieMaker movieMaker

### title

    protected java.lang.String title

### fileName

    protected java.lang.String fileName

Constructor Detail

### OpenGraph

    public OpenGraph(java.lang.String title)

  Creates an OpenGraph with the specified title and sets up some reasonable defaults.

Method Detail

### setXRange

    public void setXRange(double min,
                          double max)

  Sets the initial range of the X-axis. This range sill change if subsequenly plotted points are outside of the initial range.

  Parameters:
    `min` - the minimum value of the range
    `max` - the maximum value of the range

### getXRange

    public double[] getXRange()

  Returns the range of the x-axis as a double[] where the min is the 0th elements and the max the 1st.

### setYRange

    public void setYRange(double min,
                          double max)

  Sets the initial range of the y-axis. This range will change if any subsequently plotted points are outside of the initial range.

  Parameters:
    `min` - the minimum value of the range
    `max` - the maximum value of the range

### getYRange

    public double[] getYRange()

  Gets the range of the y-axis as a double[] where the min is the 0th elements and the max the 1st.

### setSize

    public void setSize(int width,
                        int height)

  Sets the size of the plot.

  Parameters:
    `width` - the width of the plot
    `height` - the height of the plot

### getSize

    public java.awt.Dimension getSize()

  Gets the size of the plot.

### setLocation

    public void setLocation(int x,
                            int y)

  Sets the screen location for this OpenGraph.

  Parameters:
    `x` - the x screen coordinate
    `y` - the y screen coordinate

### getTitle

    public java.lang.String getTitle()

  Returns the title of this graph.

  Returns:
    the title of this graph

### setYIncrement

    public void setYIncrement(double incr)

  Sets the amount to increase or decrease the y-axis scale when a y value is out of the range of the current scale. The new scale is calculated to include the out of range point plus or minus the increment. Note that this only works with an OpenSequenceGraph and not with an OpenHistogram.

### getYIncrement

    public double getYIncrement()

  Get the the amount to increase or decrease the y-axis scale when a y value is out of the range of the current scale.

### setXIncrement

    public void setXIncrement(double incr)

  Sets the amount to increase or decrease the x-axis scale when a x value is out of the range of the current scale. The new scale is calculated to include the out of range point plus or minus the increment.Note that this only works with an OpenSequenceGraph and not with an OpenHistogram.

### getXIncrement

    public double getXIncrement()

  Get the the amount to increase or decrease the x-axis scale when a x value is out of the range of the current scale.

### setAxisTitles

    public void setAxisTitles(java.lang.String xAxis,
                              java.lang.String yAxis)

  Sets the axis titles.

  Parameters:
    `xAxis` - the title for the xAxis
    `yAxis` - the title for the yAxis

### getAxisTitles

    public java.lang.String[] getAxisTitles()

  Returns the axis titles as a String[] where the first element is x-axis label and the second is the y-axis label.

### setXTick

    public void setXTick(double position,
                         java.lang.String label)

  Associates a label with a particular x-axis tick.

  Parameters:
    `position` - the position of the tick
    `label` - the label for that tick

### updateXTick

    public void updateXTick(double position,
                            java.lang.String label,
                            int index)

  Updates an x-axis tick label with a new one.

### setBars

    public void setBars(double width,
                        double offset)

  Sets the width and offset of the bars. Width and offset are in terms of the x-axis scale and not in pixels.

### step

    public void step()

  Records and updates the graph display.

### record

    public abstract void record()

### updateGraph

    public abstract void updateGraph()

### zoom

    public void zoom(int x,
                     int y)

  Zoom listener interface. Called whenever a user zooms in or out on the graph.

  Specified by:
    `zoom` in interface `ZoomListener`

### display

    public void display()

  Displays this graph.

### dispose

    public void dispose()

  Dispose of this graph.

### createBinDataSource

    protected BinDataSource createBinDataSource(java.lang.Object target,
                                                java.lang.String methodName)

  Dynamically creates a BinDataSource wrapping the method call to the specified methodName on the specified target in BinDataSource.getBinValue(Object obj).

  Parameters:
    `target` - the target of the method call
    `methodName` - the name of the method to call
  Returns:
    a BinDataSource object
  See Also:
    `BinDataSource`

### createListBinDataSource

    protected BinDataSource createListBinDataSource(java.lang.Object listObj,
                                                    java.lang.String listObjMethodName)

### createSequence

    protected Sequence createSequence(java.lang.Object feedFrom,
                                      java.lang.String methodName)

  Creates a Sequence, wrapping a call of specified methodName on the feedFrom object in Sequence.getSValue().

  Parameters:
    `feedFrom` - the target of the method call
    `methodName` - the name of the method to call
  Returns:
    a Sequence object
  See Also:
    `Sequence`

### takeSnapshot

    public void takeSnapshot()

  Specified by:
    `takeSnapshot` in interface `MediaProducer`

### setSnapshotFileName

    public void setSnapshotFileName(java.lang.String name)

  Specified by:
    `setSnapshotFileName` in interface `MediaProducer`

### setMovieName

    public void setMovieName(java.lang.String fileName,
                             java.lang.String movieType)

  Sets the name and type of a movie. Currently type can only be DisplaySurface.QUICK_TIME.

  Specified by:
    `setMovieName` in interface `MediaProducer`
  Parameters:
    `fileName` - the name of the movie
    `movieType` - the type of movie (e.g. DisplaySurface.QUICK_TIME)

### addMovieFrame

    public void addMovieFrame()

  Adds the currently displayed image as frame to a movie. setMovieName must be called before this method is called.

  Specified by:
    `addMovieFrame` in interface `MediaProducer`

### closeMovie

    public void closeMovie()

  Closes the movie, writing any remaining frames to the file. This must be called if making a movie.

  Specified by:
    `closeMovie` in interface `MediaProducer`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD