org.jscience.chemistry.vapor.util.chart
Class Chart

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 org.jscience.chemistry.vapor.util.chart.Chart
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class Chart
extends javax.swing.JPanel

Basic X-Y Plot charting tool.

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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int AXIS_BOTTOM
          DOCUMENT ME!
static int AXIS_LEFT
          DOCUMENT ME!
static int AXIS_NONE
          DOCUMENT ME!
static int AXIS_RIGHT
          DOCUMENT ME!
static int AXIS_TOP
          DOCUMENT ME!
static int HALIGN_CENTER
          DOCUMENT ME!
static int HALIGN_LEFT
          DOCUMENT ME!
static int HALIGN_RIGHT
          DOCUMENT ME!
static int VALIGN_ABOVE
          DOCUMENT ME!
static int VALIGN_BELOW
          DOCUMENT ME!
static int VALIGN_MIDDLE
          DOCUMENT ME!
 
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
Chart()
          Default Constructor.
 
Method Summary
 void addDataset(Dataset dataset)
          Adds the given dataset to the current list of datasets
 java.awt.Color getAxisLabelColor()
          Returns the Axes label color
 java.awt.Font getAxisLabelFont()
          Returns the Axes label font
 java.awt.Color getBGColor()
          Returns the current background color
 java.awt.Color getBorderColor()
          Returns the current border color
 java.awt.image.BufferedImage getChartImage()
          Returns a buffered image of the current chart.
 java.util.ArrayList getDatasets()
          Returns the current list of datasets
 java.lang.String getSubTitle()
          Returns the sub-title text
 java.awt.Color getSubTitleColor()
          Returns the sub-title font color
 java.awt.Font getSubTitleFont()
          Returns the sub-title font
 java.lang.String getTitle()
          Returns the main title text
 java.awt.Color getTitleColor()
          Returns the main title font color
 java.awt.Font getTitleFont()
          Returns the main title font
 java.lang.String getXAxisLabel()
          Returns the X-Axis label text
 double getXGridSpacing()
          Returns the grid spacing for X-Axis.
 java.lang.String getYAxisLabel()
          Returns the Y-Axis label text
 double getYGridSpacing()
          Returns the grid spacing for Y-Axis.
 void hilitePoint(java.awt.geom.Point2D.Double point, int xAxis, int yAxis)
          Highlights the given point by means of adding dashed line projections on the given axes.
 boolean isAutoXGridSpacing()
          Returns whether grid spacing for X-Axis is automatic.
 boolean isAutoYGridSpacing()
          Returns whether grid spacing for Y-Axis is automatic.
 boolean isShowGrid()
          Returns whether grid is displayed.
 void setAutoXGridSpacing(boolean autoXSpacing)
          Sets automatic grid spacing for X-Axis
 void setAutoYGridSpacing(boolean autoYSpacing)
          Sets automatic grid spacing for Y-Axis
 void setAxisLabelColor(java.awt.Color axisLabelColor)
          Sets the Axes label color
 void setAxisLabelFont(java.awt.Font axisLabelFont)
          Sets the Axes label font
 void setBGColor(java.awt.Color bgColor)
          Sets the current background color
 void setBorderColor(java.awt.Color borderColor)
          Sets the current border color
 void setShowGrid(boolean showGrid)
          Sets whether grid is displayed.
 void setSubTitle(java.lang.String subTitle)
          Sets the sub-title text
 void setSubTitleColor(java.awt.Color subTitleColor)
          Sets the sub-title font color
 void setSubTitleFont(java.awt.Font subTitleFont)
          Sets the sub-title font
 void setTitle(java.lang.String title)
          Sets the main title text
 void setTitleColor(java.awt.Color titleColor)
          Sets the main title font color
 void setTitleFont(java.awt.Font titleFont)
          Sets the main title font
 void setXAxisLabel(java.lang.String xLabel)
          Sets the X-Axis label text
 void setXGridSpacing(double xSpacing)
          Sets the grid spacing for X-Axis.
 void setYAxisLabel(java.lang.String yLabel)
          Sets the Y-Axis label text
 void setYGridSpacing(double ySpacing)
          Sets the grid spacing for Y-Axis.
 
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, getBaseline, getBaselineResizeBehavior, 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, isPaintingForPrint, 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
 

Field Detail

AXIS_TOP

public static final int AXIS_TOP
DOCUMENT ME!

See Also:
Constant Field Values

AXIS_BOTTOM

public static final int AXIS_BOTTOM
DOCUMENT ME!

See Also:
Constant Field Values

AXIS_LEFT

public static final int AXIS_LEFT
DOCUMENT ME!

See Also:
Constant Field Values

AXIS_RIGHT

public static final int AXIS_RIGHT
DOCUMENT ME!

See Also:
Constant Field Values

AXIS_NONE

public static final int AXIS_NONE
DOCUMENT ME!

See Also:
Constant Field Values

VALIGN_ABOVE

public static final int VALIGN_ABOVE
DOCUMENT ME!

See Also:
Constant Field Values

VALIGN_MIDDLE

public static final int VALIGN_MIDDLE
DOCUMENT ME!

See Also:
Constant Field Values

VALIGN_BELOW

public static final int VALIGN_BELOW
DOCUMENT ME!

See Also:
Constant Field Values

HALIGN_LEFT

public static final int HALIGN_LEFT
DOCUMENT ME!

See Also:
Constant Field Values

HALIGN_CENTER

public static final int HALIGN_CENTER
DOCUMENT ME!

See Also:
Constant Field Values

HALIGN_RIGHT

public static final int HALIGN_RIGHT
DOCUMENT ME!

See Also:
Constant Field Values
Constructor Detail

Chart

public Chart()
Default Constructor. This initializes the panel to display the charting area.

Method Detail

isShowGrid

public boolean isShowGrid()
Returns whether grid is displayed.

Returns:
boolean

setShowGrid

public void setShowGrid(boolean showGrid)
Sets whether grid is displayed.

Parameters:
showGrid -

isAutoXGridSpacing

public boolean isAutoXGridSpacing()
Returns whether grid spacing for X-Axis is automatic.

Returns:
boolean

setAutoXGridSpacing

public void setAutoXGridSpacing(boolean autoXSpacing)
Sets automatic grid spacing for X-Axis

Parameters:
autoXSpacing -

isAutoYGridSpacing

public boolean isAutoYGridSpacing()
Returns whether grid spacing for Y-Axis is automatic.

Returns:
boolean

setAutoYGridSpacing

public void setAutoYGridSpacing(boolean autoYSpacing)
Sets automatic grid spacing for Y-Axis

Parameters:
autoYSpacing -

getXGridSpacing

public double getXGridSpacing()
Returns the grid spacing for X-Axis.

Returns:
double

setXGridSpacing

public void setXGridSpacing(double xSpacing)
Sets the grid spacing for X-Axis.

Parameters:
xSpacing -

getYGridSpacing

public double getYGridSpacing()
Returns the grid spacing for Y-Axis.

Returns:
double

setYGridSpacing

public void setYGridSpacing(double ySpacing)
Sets the grid spacing for Y-Axis.

Parameters:
ySpacing -

getBGColor

public java.awt.Color getBGColor()
Returns the current background color

Returns:
bgColor

setBGColor

public void setBGColor(java.awt.Color bgColor)
Sets the current background color

Parameters:
bgColor -

getBorderColor

public java.awt.Color getBorderColor()
Returns the current border color

Returns:
borderColor

setBorderColor

public void setBorderColor(java.awt.Color borderColor)
Sets the current border color

Parameters:
borderColor -

getTitle

public java.lang.String getTitle()
Returns the main title text

Returns:
String

setTitle

public void setTitle(java.lang.String title)
Sets the main title text

Parameters:
title -

getSubTitle

public java.lang.String getSubTitle()
Returns the sub-title text

Returns:
String

setSubTitle

public void setSubTitle(java.lang.String subTitle)
Sets the sub-title text

Parameters:
subTitle -

getTitleColor

public java.awt.Color getTitleColor()
Returns the main title font color

Returns:
color

setTitleColor

public void setTitleColor(java.awt.Color titleColor)
Sets the main title font color

Parameters:
titleColor -

getSubTitleColor

public java.awt.Color getSubTitleColor()
Returns the sub-title font color

Returns:
color

setSubTitleColor

public void setSubTitleColor(java.awt.Color subTitleColor)
Sets the sub-title font color

Parameters:
subTitleColor -

getTitleFont

public java.awt.Font getTitleFont()
Returns the main title font

Returns:
font

setTitleFont

public void setTitleFont(java.awt.Font titleFont)
Sets the main title font

Parameters:
titleFont -

getSubTitleFont

public java.awt.Font getSubTitleFont()
Returns the sub-title font

Returns:
font

setSubTitleFont

public void setSubTitleFont(java.awt.Font subTitleFont)
Sets the sub-title font

Parameters:
subTitleFont -

getXAxisLabel

public java.lang.String getXAxisLabel()
Returns the X-Axis label text

Returns:
String

setXAxisLabel

public void setXAxisLabel(java.lang.String xLabel)
Sets the X-Axis label text

Parameters:
xLabel -

getYAxisLabel

public java.lang.String getYAxisLabel()
Returns the Y-Axis label text

Returns:
String

setYAxisLabel

public void setYAxisLabel(java.lang.String yLabel)
Sets the Y-Axis label text

Parameters:
yLabel -

getAxisLabelColor

public java.awt.Color getAxisLabelColor()
Returns the Axes label color

Returns:
Color

setAxisLabelColor

public void setAxisLabelColor(java.awt.Color axisLabelColor)
Sets the Axes label color

Parameters:
axisLabelColor -

getAxisLabelFont

public java.awt.Font getAxisLabelFont()
Returns the Axes label font

Returns:
font

setAxisLabelFont

public void setAxisLabelFont(java.awt.Font axisLabelFont)
Sets the Axes label font

Parameters:
axisLabelFont -

getDatasets

public java.util.ArrayList getDatasets()
Returns the current list of datasets

Returns:
ArrayList

addDataset

public void addDataset(Dataset dataset)
Adds the given dataset to the current list of datasets

Parameters:
dataset -

hilitePoint

public void hilitePoint(java.awt.geom.Point2D.Double point,
                        int xAxis,
                        int yAxis)
Highlights the given point by means of adding dashed line projections on the given axes.

Parameters:
point - - the point to be highlighted
xAxis - - can be AXIS_TOP, AXIS_BOTTOM or AXIS_NONE
yAxis - - can be AXIS_LEFT, AXIS_RIGHT or AXIS_NONE

getChartImage

public java.awt.image.BufferedImage getChartImage()
Returns a buffered image of the current chart.

Returns:
DOCUMENT ME!