lejos.pc.charting
Class CustomChartPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by lejos.pc.charting.CustomChartPanel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ChangeListener, org.jfree.chart.event.AxisChangeListener, org.jfree.chart.event.ChartChangeListener, org.jfree.chart.event.ChartProgressListener

public class CustomChartPanel
extends javax.swing.JPanel
implements javax.swing.event.ChangeListener, org.jfree.chart.event.AxisChangeListener, org.jfree.chart.event.ChartProgressListener, org.jfree.chart.event.ChartChangeListener

JPanel acting as a container for the LoggingChart ChartPanel, domain slider, x-y label, and rowcount label. Use SpringLayout to position components but JPanel width must be adjusted if used in other classes.

Author:
Kirk P. Thompson
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces 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
CustomChartPanel()
           
 
Method Summary
 void addCommentMarker(double xVal, java.lang.String comment)
          Add a comment marker to the chart at specified domain position.
 void addDataPoints(double[] seriesData)
          Add series data to the dataset.
 void axisChanged(org.jfree.chart.event.AxisChangeEvent event)
           
 void chartChanged(org.jfree.chart.event.ChartChangeEvent event)
           
 void chartProgress(org.jfree.chart.event.ChartProgressEvent event)
           
 void copyChart()
           
protected  lejos.pc.charting.LoggingChart getLoggingChartPanel()
           
 void setCommentsVisible(boolean visible)
          Control the visibility of any comment markers defined for the chart.
 void setDomainScale(int domainWidth)
          Set the width of the x-axis (domain) scale centered around current midpoint of domain scale.
 int setSeries(java.lang.String[] seriesNames)
          Set the passed series/header definitions as new XYseries in the dataset.
 void stateChanged(javax.swing.event.ChangeEvent e)
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, 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

CustomChartPanel

public CustomChartPanel()
Method Detail

getLoggingChartPanel

protected lejos.pc.charting.LoggingChart getLoggingChartPanel()

axisChanged

public void axisChanged(org.jfree.chart.event.AxisChangeEvent event)
Specified by:
axisChanged in interface org.jfree.chart.event.AxisChangeListener

chartProgress

public void chartProgress(org.jfree.chart.event.ChartProgressEvent event)
Specified by:
chartProgress in interface org.jfree.chart.event.ChartProgressListener

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
Specified by:
stateChanged in interface javax.swing.event.ChangeListener

chartChanged

public void chartChanged(org.jfree.chart.event.ChartChangeEvent event)
Specified by:
chartChanged in interface org.jfree.chart.event.ChartChangeListener

setDomainScale

public void setDomainScale(int domainWidth)
Set the width of the x-axis (domain) scale centered around current midpoint of domain scale. Uses a scaled integer 1-1000 (meaning 0.1-100.0). Values outside this range will cause the method to immediately exit without doing any changes. Existing domain extents (min, max X values) define the total range.

Parameters:
domainWidth - The [scaled integer] width in % (1-1000) of range of x domain extents

addDataPoints

public void addDataPoints(double[] seriesData)
Add series data to the dataset. Pass an array of double series values that all share the same domain value defined in element 0. The number of values must match the header count in setSeries().

Element 0 is the domain (X) series and should be a timestamp.

Parameters:
seriesData - the series data as doubles
See Also:
setSeries(java.lang.String[])

addCommentMarker

public void addCommentMarker(double xVal,
                             java.lang.String comment)
Add a comment marker to the chart at specified domain position.

Parameters:
xVal - Domain value
comment - The comment text
See Also:
setCommentsVisible(boolean)

setCommentsVisible

public void setCommentsVisible(boolean visible)
Control the visibility of any comment markers defined for the chart.

Parameters:
visible - true to show, false to hide
See Also:
addCommentMarker(double, java.lang.String)

setSeries

public int setSeries(java.lang.String[] seriesNames)
Set the passed series/header definitions as new XYseries in the dataset. Existing series and comment markers are wiped. Must be at least two items in the array or any existing series is left intact and method exits with 0. First item (series 0) is set as domain label and should be system time in milliseconds, and is always axis 0 for multi-axis charts.

The string format/structure of each string field is:
[name]:[axis ID 1-4]
i.e.

"MySeries:1"

Parameters:
seriesNames - Array of series names
Returns:
The number of series created
See Also:
addDataPoints(double[])

copyChart

public void copyChart()