multigraph
Class TimeSeriesPlotter

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Canvas
          extended bymultigraph.DoubleBufferedCanvas
              extended bymultigraph.Plotter
                  extended bymultigraph.StretchPlotter
                      extended bymultigraph.TimeSeriesPlotter
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
Direct Known Subclasses:
MultiPlotter

public class TimeSeriesPlotter
extends StretchPlotter

A Plotter that provides for drawing graphs of time series data. TimeSeriesPlotter takes care of things common to any interactive graph of time series data in which time is on the horizontal axis. In particular, it provides the following additional functionality over and above Plotter:

Version:
$Id: TimeSeriesPlotter.java,v 1.1.1.1 2004/11/30 22:30:41 mphillips Exp $
Author:
Mark Phillips
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class multigraph.StretchPlotter
StretchPlotter.DragAxis, StretchPlotter.DragType
 
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  java.util.Calendar cal
           
protected  java.util.Date d0
           
protected  java.util.Date d1
           
protected  javax.swing.Timer keyTimer
           
protected  int keyTimerDefaultDelayMillis
           
protected  long keyTimerT0
           
protected static int minLabelPixelDistance
           
static long oneDayInMillis
           
static long oneHourInMillis
           
static long oneMonthInMillis
           
static long oneYearInMillis
           
 
Fields inherited from class multigraph.StretchPlotter
bottomOffset, buttonOffset, buttons, currentHorizFrame, dragAxis, dragType, graphStatusRectangle, horizAxisFrame, labelLine1Height, labelLine2Height, labelLine3Height, leftOffset, paintTimeInMillis, rightOffset, statusMessage, statusTimer, tickHeight, topOffset
 
Fields inherited from class multigraph.Plotter
bottomMargin, devicePixelFrame, lastMouseX, lastMouseY, leftMargin, marginFrame, mouseBaseX, mouseBaseY, pixelFrame, rightMargin, topMargin
 
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
TimeSeriesPlotter(int pixelWidth, int pixelHeight, ImageGetter imageGetter, java.lang.String first, java.lang.String last, java.util.TimeZone timeZone, boolean isConfigEnabled)
           
 
Method Summary
protected  void computeHorizFrame()
           
 boolean dataLoadNeeded(java.util.Date d0, java.util.Date d1)
           
static java.util.Date downRound(java.util.Date d, long dt)
           
 void drawHorizAxisLabel(java.awt.Graphics g, java.util.Date x, java.lang.String label)
           
 void drawHorizAxisTick(java.awt.Graphics g, java.util.Date x)
           
 PlotFrame getTimeFrame()
           
protected  void horizZoom(double dTime, int baseX)
           
 void keyTyped(int modifiers, char key)
          Process a keyTyped event; the Plotter's handler calls this whenever a keyTyped event occurs.
protected  void leftStep()
           
 boolean loadData(java.util.Date d0, java.util.Date d1)
           
 void mouseDragged(int modifiers, int x, int y)
          Process a mouseDragged event; the Plotter's handler calls this whenever a mouseDragged event occurs.
 void mouseReleased(int modifiers, int x, int y)
          Process a mouseReleased event; the Plotter's handler calls this whenever a mouseReleased event occurs.
 void paint(java.awt.Graphics g)
          Erase the background to white (unless renderClear has been called since the last call to paint), and draw a light grey rectangle around the Plotter.marginFrame.
protected  void rightStep()
           
 void setFirst(java.util.Date d0)
           
 void setLast(java.util.Date d1)
           
 void setTimeFrame(int calendarTimePeriod)
           
 void setTimes(java.util.Date d0, java.util.Date d1)
           
 void setTimeZone(java.util.TimeZone timeZone)
           
static java.util.Date upRound(java.util.Date d, long dt)
           
 
Methods inherited from class multigraph.StretchPlotter
buttonsMouseMoved, buttonsMousePressed, buttonsMouseReleased, computeFrames, getButtons, getCurrentHorizFrame, getHorizAxisFrame, getPixelFrame, mouseMoved, mousePressed, setCurrentHorizFrame, setLabelFont, setPixelOffsets, setStatusMessage, setStatusMessage, vertDrag
 
Methods inherited from class multigraph.Plotter
drawLine, drawRect, drawRect, drawRect, drawString, fillArc, fillCircle, fillPolygon, fillQuad, fillRect, fillRect, fillRect, fillRectDefinite, fillRectLLDefinite, keyReleased, renderClear, setMargins
 
Methods inherited from class multigraph.DoubleBufferedCanvas
getMaximumSize, getMinimumSize, getPreferredSize, 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, 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, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, 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, 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
 

Field Detail

d0

protected java.util.Date d0

d1

protected java.util.Date d1

cal

protected java.util.Calendar cal

oneHourInMillis

public static final long oneHourInMillis
See Also:
Constant Field Values

oneDayInMillis

public static final long oneDayInMillis
See Also:
Constant Field Values

oneMonthInMillis

public static final long oneMonthInMillis
See Also:
Constant Field Values

oneYearInMillis

public static final long oneYearInMillis
See Also:
Constant Field Values

minLabelPixelDistance

protected static int minLabelPixelDistance

keyTimer

protected javax.swing.Timer keyTimer

keyTimerDefaultDelayMillis

protected int keyTimerDefaultDelayMillis

keyTimerT0

protected long keyTimerT0
Constructor Detail

TimeSeriesPlotter

public TimeSeriesPlotter(int pixelWidth,
                         int pixelHeight,
                         ImageGetter imageGetter,
                         java.lang.String first,
                         java.lang.String last,
                         java.util.TimeZone timeZone,
                         boolean isConfigEnabled)
Method Detail

getTimeFrame

public PlotFrame getTimeFrame()

downRound

public static java.util.Date downRound(java.util.Date d,
                                       long dt)

upRound

public static java.util.Date upRound(java.util.Date d,
                                     long dt)

drawHorizAxisTick

public void drawHorizAxisTick(java.awt.Graphics g,
                              java.util.Date x)

drawHorizAxisLabel

public void drawHorizAxisLabel(java.awt.Graphics g,
                               java.util.Date x,
                               java.lang.String label)

loadData

public boolean loadData(java.util.Date d0,
                        java.util.Date d1)

dataLoadNeeded

public boolean dataLoadNeeded(java.util.Date d0,
                              java.util.Date d1)

setTimeZone

public void setTimeZone(java.util.TimeZone timeZone)

setFirst

public void setFirst(java.util.Date d0)

setLast

public void setLast(java.util.Date d1)

setTimes

public void setTimes(java.util.Date d0,
                     java.util.Date d1)

computeHorizFrame

protected void computeHorizFrame()
Specified by:
computeHorizFrame in class StretchPlotter

horizZoom

protected void horizZoom(double dTime,
                         int baseX)
Specified by:
horizZoom in class StretchPlotter

setTimeFrame

public void setTimeFrame(int calendarTimePeriod)

leftStep

protected void leftStep()
Specified by:
leftStep in class StretchPlotter

rightStep

protected void rightStep()
Specified by:
rightStep in class StretchPlotter

paint

public void paint(java.awt.Graphics g)
Description copied from class: Plotter
Erase the background to white (unless renderClear has been called since the last call to paint), and draw a light grey rectangle around the Plotter.marginFrame. Subclasses can override this method to provide their own rendering.

Overrides:
paint in class StretchPlotter

mouseDragged

public void mouseDragged(int modifiers,
                         int x,
                         int y)
Description copied from class: Plotter
Process a mouseDragged event; the Plotter's handler calls this whenever a mouseDragged event occurs.

Overrides:
mouseDragged in class Plotter
Parameters:
modifiers - The event modifier mask returned by java.awt.event.InputEvent.getModifiers()
x - The x coordinate (in Plotter.devicePixelFrame space) of the event.
y - The y coordinate (in Plotter.devicePixelFrame space) of the event.

mouseReleased

public void mouseReleased(int modifiers,
                          int x,
                          int y)
Description copied from class: Plotter
Process a mouseReleased event; the Plotter's handler calls this whenever a mouseReleased event occurs.

Overrides:
mouseReleased in class Plotter
Parameters:
modifiers - The event modifier mask returned by java.awt.event.InputEvent.getModifiers()
x - The x coordinate (in Plotter.devicePixelFrame space) of the event.
y - The y coordinate (in Plotter.devicePixelFrame space) of the event.

keyTyped

public void keyTyped(int modifiers,
                     char key)
Description copied from class: Plotter
Process a keyTyped event; the Plotter's handler calls this whenever a keyTyped event occurs.

Overrides:
keyTyped in class Plotter
Parameters:
modifiers - The event modifier mask returned by java.awt.event.InputEvent.getModifiers()
key - The key that was typed.