saaps.util
Class TimeSeriesPlot

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--ptolemy.plot.PlotBox
                          |
                          +--ptolemy.plot.Plot
                                |
                                +--saaps.util.TimeSeriesPlot
Direct Known Subclasses:
ElFluencePlot

public class TimeSeriesPlot
extends ptolemy.plot.Plot

A class to produce a plot of time series data. The class is an extension of the ptolemy.plot.Plot class which in turn extends the java.awt.Panel class.

The constructor takes a saaps.util.TimeSeries object in its argument. It the automatically selects the x-axis to represent time and the y-axis the data in the data fields of the TimeSeries object. The tick marks on the x-axis are set so that the time information becomes clear. E.g., if the data extends over several days then the tick marks are in days, while if it extends over one day or less then the tick marks are in hours. The x-label shows the start date of the plot. The y-label shows the name and unit of the plotted data. If there are several data fields plotted then each line has different colours and the y-label lists all data field names and units. The field name and units are extracted from the TimeSeries object.

See Also:
Plot, Panel, TimeSeries, Serialized Form

Inner classes inherited from class ptolemy.plot.PlotBox
ptolemy.plot.PlotBox.DragListener, ptolemy.plot.PlotBox.ZoomListener
 
Field Summary
static int CAL_TIME
           
static int REL_TIME
           
 
Fields inherited from class ptolemy.plot.Plot
_currentdataset, _marks, _painted, _points
 
Fields inherited from class ptolemy.plot.PlotBox
_background, _bottomPadding, _colors, _documentBase, _foreground, _grid, _height, _leftPadding, _LOG10SCALE, _lrx, _lry, _PADDING, _rangesGivenByZooming, _rightPadding, _topPadding, _ulx, _uly, _usecolor, _width, _wrap, _xBottom, _xhighgiven, _xlog, _xlowgiven, _xMax, _xMin, _xRangeGiven, _xscale, _xTop, _yBottom, _yhighgiven, _ylog, _ylowgiven, _yMax, _yMin, _yRangeGiven, _yscale, _yTop
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
TimeSeriesPlot(TimeSeries ts)
          Create the default time series plot.
TimeSeriesPlot(TimeSeries ts, int xf, int[] yfs, boolean li, boolean po, boolean xL, boolean yL)
           
TimeSeriesPlot(TimeSeries ts, int xf, int[] yfs, boolean li, boolean po, java.lang.String xLabel, java.lang.String[] yLabels, boolean xL, boolean yL)
          Create a custom plot.
 
Method Summary
 boolean getLineState()
           
 boolean getPointState()
           
 void plotData()
          Create the plot.
 void setLineState(boolean l)
           
 void setPointState(boolean p)
           
 void setTimeSeries(TimeSeries ts)
           
 void setZeroTime(java.util.Date d)
           
 void useCalTime()
          Call this method to use calendar time on the x-axis.
 void useRelTime()
          Call this method to use relative time on the x-axis.
 
Methods inherited from class ptolemy.plot.Plot
_checkDatasetIndex, _drawBar, _drawErrorBar, _drawImpulse, _drawLine, _drawPlot, _drawPoint, _parseLine, _write, _writeOldSyntax, addLegend, addPoint, addPointWithErrorBars, clear, clear, erasePoint, fillPlot, getConnected, getImpulses, getMarksStyle, getMaxDataSets, getNumDataSets, parseFile, read, samplePlot, setBars, setBars, setConnected, setConnected, setImpulses, setImpulses, setMarksStyle, setMarksStyle, setNumSets, setPointsPersistence, setReuseDatasets, setSweepsPersistence
 
Methods inherited from class ptolemy.plot.PlotBox
_help, _setButtonsVisibility, addXTick, addYTick, export, getColor, getColorByName, getDataurl, getDocumentBase, getGrid, getLegend, getMinimumSize, getPreferredSize, getTitle, getXLabel, getXLog, getXRange, getXTicks, getYLabel, getYLog, getYRange, getYTicks, init, paint, parseFile, read, setBackground, setBounds, setButtons, setColor, setDataurl, setDocumentBase, setForeground, setGrid, setLabelFont, setSize, setTitle, setTitleFont, setWrap, setXLabel, setXLog, setXRange, setYLabel, setYLog, setYRange, update, write, write, writeOldSyntax, zoom
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setCursor, setFont, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBounds, setComponentOrientation, setDropTarget, setEnabled, setLocale, setLocation, setLocation, setName, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CAL_TIME

public static final int CAL_TIME

REL_TIME

public static final int REL_TIME
Constructor Detail

TimeSeriesPlot

public TimeSeriesPlot(TimeSeries ts)
Create the default time series plot. Plot all data fields as function of calendar time.
Parameters:
ts - The TimeSeries object to be plotted.

TimeSeriesPlot

public TimeSeriesPlot(TimeSeries ts,
                      int xf,
                      int[] yfs,
                      boolean li,
                      boolean po,
                      java.lang.String xLabel,
                      java.lang.String[] yLabels,
                      boolean xL,
                      boolean yL)
Create a custom plot. This is useful for e.g. plotting data fields as a function of another data field.
Parameters:
ts - The TimeSeries object.
xf - An integer pointing to which data field should be used on the x-axis.
yfs - An array of integers pointing to which data fields that should be on the y-axis.
li - A boolean that is true if lines should be used.
po - A boolean that is true if points should be used.
xLabel - A string for the x-axis label.
yLabels - An array of strings for the y-axis labels.
xLog - A boolean that is true of the x-axis should be logarithmic.
yLog - A boolean that is true of the y-axis should be logarithmic.

TimeSeriesPlot

public TimeSeriesPlot(TimeSeries ts,
                      int xf,
                      int[] yfs,
                      boolean li,
                      boolean po,
                      boolean xL,
                      boolean yL)
Method Detail

setTimeSeries

public void setTimeSeries(TimeSeries ts)

getLineState

public boolean getLineState()

setLineState

public void setLineState(boolean l)

getPointState

public boolean getPointState()

setPointState

public void setPointState(boolean p)

plotData

public void plotData()
Create the plot.

useCalTime

public void useCalTime()
Call this method to use calendar time on the x-axis.

useRelTime

public void useRelTime()
Call this method to use relative time on the x-axis.

Relative time is used for TimeSeries objects where the time field represents time reletive to an event. The event time is equal to zero.


setZeroTime

public void setZeroTime(java.util.Date d)