org.apache.excalibur.instrument.client
Class LineChart

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byorg.apache.excalibur.instrument.client.LineChart
All Implemented Interfaces:
java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable

public class LineChart
extends javax.swing.JComponent
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener

Draws a nice pretty chart given a set of data.

Author:
Avalon Development Team
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
LineChart(int lineSampleInterval, long sampleInterval, java.lang.String format, java.lang.String detailFormat, int averageWindow, boolean antialias)
           
 
Method Summary
 void mouseClicked(java.awt.event.MouseEvent event)
          Called when the mouse is clicked ont the component.
 void mouseDragged(java.awt.event.MouseEvent event)
          Called when the mouse is dragged over the component.
 void mouseEntered(java.awt.event.MouseEvent event)
          Called when the mouse is enters the component.
 void mouseExited(java.awt.event.MouseEvent event)
          Called when the mouse is exits the component.
 void mouseMoved(java.awt.event.MouseEvent event)
          Called when the mouse is moved over the component.
 void mousePressed(java.awt.event.MouseEvent event)
          Called when the mouse is pressed ont the component.
 void mouseReleased(java.awt.event.MouseEvent event)
          Called when the mouse is released ont the component.
 void paintComponent(java.awt.Graphics g)
          Paints the component.
 void setAntialias(boolean antialias)
          Sets the antialias flag to control whether or not antialiasing will be used when rendering the component.
 void setValues(int[] values, long time)
          Sets the data samples to be displayed by the line chart.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LineChart

public LineChart(int lineSampleInterval,
                 long sampleInterval,
                 java.lang.String format,
                 java.lang.String detailFormat,
                 int averageWindow,
                 boolean antialias)
Parameters:
lineSampleInterval - The interval in data points at which to place vertical lines and labels along the x (time) axis.
sampleInterval - The number of milliseconds represented by each data sample.
format - Format of the text which is displayed along the x (time) axis of the chart. The text will display the time of the line chart at a particular interval. The text should take the format "{0}/{1}/{2} {3}:{4}:{5}.{6}" where {0} is replaced by the year, {1} by the month, {2} by the day, {3} by the hour, {4} by the minute, {5} by the second, and {6} by the hundereths of a second.
detailFormat - Format of the text which is displayed over the component as the user moves the mouse over the line chart. The text will display the exact value of the line chart at a particular point. The text should take the format "{0}/{1}/{2} {3}:{4}:{5}.{6}" where {0} is replaced by the year, {1} by the month, {2} by the day, {3} by the hour, {4} by the minute, {5} by the second, and {6} by the hundereths of a second.
averageWindow - Number of data points to do a moving average over when the mouse is pressed on the component.
antialias - True if Antialiasing should be used when rendering the chart.
Method Detail

setAntialias

public void setAntialias(boolean antialias)
Sets the antialias flag to control whether or not antialiasing will be used when rendering the component.

Parameters:
antialias - True to use antialiasing.

setValues

public void setValues(int[] values,
                      long time)
Sets the data samples to be displayed by the line chart.

Parameters:
values - Array of data samples.
time - The time of the start of the last sample point.

paintComponent

public void paintComponent(java.awt.Graphics g)
Paints the component.

Parameters:
g - Graphics to paint the chart onto.

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent event)
Called when the mouse is clicked ont the component.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
event - Event which describes the action.

mousePressed

public void mousePressed(java.awt.event.MouseEvent event)
Called when the mouse is pressed ont the component.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
event - Event which describes the action.

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent event)
Called when the mouse is released ont the component.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
event - Event which describes the action.

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent event)
Called when the mouse is enters the component.

Specified by:
mouseEntered in interface java.awt.event.MouseListener
Parameters:
event - Event which describes the action.

mouseExited

public void mouseExited(java.awt.event.MouseEvent event)
Called when the mouse is exits the component.

Specified by:
mouseExited in interface java.awt.event.MouseListener
Parameters:
event - Event which describes the action.

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent event)
Called when the mouse is dragged over the component.

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Parameters:
event - Event which describes the motion.

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent event)
Called when the mouse is moved over the component.

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Parameters:
event - Event which describes the motion.


Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.