net.sourceforge.chart2d
Class LLChart2D

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--net.sourceforge.chart2d.Chart2D
                          |
                          +--net.sourceforge.chart2d.GraphChart2D
                                |
                                +--net.sourceforge.chart2d.LLChart2D
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class LLChart2D
extends GraphChart2D

One of Chart2D's three general chart types. An LLChart2D is a graph chart, with axes. The "LL" in LLChart2D stands for "Labels Left". "Labels Left" means that the category labels of the chart are along the left of the chart (ie the y axis). LLChart2D extends JComponent. It can be added to a content pane or it can be used to return a BufferedImage of a chart. Use setMaximumSize to specify the maximum preferred size of the chart. Use setMinimumSize to specify the minimum preferred size of the chart. Use setPreferredSize to specify a preferred size of the chart; otherwise a preferred size will be calculated for the chart. The preferred size is the size at which all the chart's components are at their "model size" (ie no magnification at this size). So, if you have multiple charts in your GUI, and you want them to all have similar magnification ratios, then you should set all the charts to a common custom preferred size.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent, javax.swing.JComponent.ActionStandin, javax.swing.JComponent.IntVector, javax.swing.JComponent.KeyboardState
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock
 
Field Summary
static java.awt.Dimension MAX_SIZE_DEFAULT
          The default is Dimension (1024, 768).
static java.awt.Dimension MIN_SIZE_DEFAULT
          The default is Dimension (188, 250).
 
Fields inherited from class javax.swing.JComponent
_bounds, accessibleContext, listenerList, paintingChild, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Container
component, containerListener, layoutMgr, listeningBoundsChildren, listeningChildren, ncomponents
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListener, componentListenerK, componentOrientation, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
LLChart2D()
          Creates a default LLChart2D object with a default GraphChart2DProperties object.
LLChart2D(GraphChart2DProperties graphChart2DProps)
          Creates a default LLChart2D object with the given GraphChart2DProperties object.
 
Method Summary
(package private)  ChartArea getChartArea()
          Returns the ChartArea of this LLChart2D.
 GraphChart2DProperties getGraphChart2DProperties()
          Returns the GraphChart2DProperties of this chart.
(package private)  GraphChartArea getGraphChartArea()
          Returns the GraphChartArea of this LLChart2D.
 java.awt.image.BufferedImage getImage()
          Returns a buffered image of the chart.
 float getNumbersAxisRangeHigh()
          Returns the value of the high label of the numbers axis.
 float getNumbersAxisRangeLow()
          Returns the value of the low label of the numbers axis.
 java.awt.Dimension getPreferredSize()
          Returns the preferred size of the chart.
 void pack()
          Causes the chart to set itself to its preferred size.
 void paintComponent(java.awt.Graphics g)
          Paints the chart.
 void setGraphChart2DProperties(GraphChart2DProperties graphChart2DProps)
          Specifies the new GraphChart2DProperties for the chart.
 void setPreferredSize(java.awt.Dimension size)
          Specifies a custom preferred size for the chart.
 
Methods inherited from class javax.swing.JComponent
_paintImmediately, , addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, alwaysOnTop, checkIfChildObscuredBySibling, componentInputMapChanged, computeVisibleRect, computeVisibleRect, compWriteObjectNotify, contains, createToolTip, disable, enable, enableSerialization, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getCreatedDoubleBuffer, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyBindings, processKeyBindingsForAllComponents, processKeyEvent, processMouseMotionEvent, putClientProperty, rectangleIsObscured, rectangleIsObscuredBySibling, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setCreatedDoubleBuffer, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPaintingChild, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, shouldDebugGraphics, superProcessMouseMotionEvent, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, adjustListeningChildren, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getLayout, getMouseEventTarget, getWindow, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, nextFocus, numListening, paintComponents, paintHeavyweightComponents, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, printComponents, printHeavyweightComponents, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, remove, remove, removeAll, removeContainerListener, setFocusOwner, setLayout, transferFocus, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, constructComponentName, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getToolkit, getToolkitImpl, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isEnabledImpl, isLightweight, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resetGC, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_SIZE_DEFAULT

public static java.awt.Dimension MAX_SIZE_DEFAULT
The default is Dimension (1024, 768).

MIN_SIZE_DEFAULT

public static java.awt.Dimension MIN_SIZE_DEFAULT
The default is Dimension (188, 250).
Constructor Detail

LLChart2D

public LLChart2D()
Creates a default LLChart2D object with a default GraphChart2DProperties object.

LLChart2D

public LLChart2D(GraphChart2DProperties graphChart2DProps)
Creates a default LLChart2D object with the given GraphChart2DProperties object.
Parameters:
graphChart2DProps - The GraphChart2DProperties for this chart.
Method Detail

setPreferredSize

public void setPreferredSize(java.awt.Dimension size)
Specifies a custom preferred size for the chart. This custom size will override the preferred size calculations that normally occurr. If null is passed, the preferred size calculations will be reinstated.
Overrides:
setPreferredSize in class Chart2D
Parameters:
size - The custom preferred size for this chart.

setGraphChart2DProperties

public void setGraphChart2DProperties(GraphChart2DProperties graphChart2DProps)
Specifies the new GraphChart2DProperties for the chart.
Overrides:
setGraphChart2DProperties in class GraphChart2D
Parameters:
graphChart2DProps - The new GraphChart2DProperties.

getGraphChart2DProperties

public GraphChart2DProperties getGraphChart2DProperties()
Returns the GraphChart2DProperties of this chart.
Overrides:
getGraphChart2DProperties in class GraphChart2D
Returns:
The chart's GraphChart2DProperties.

getImage

public java.awt.image.BufferedImage getImage()
Returns a buffered image of the chart. There should be no performance hit in calling this method..
Overrides:
getImage in class Chart2D
Returns:
An image of this chart

getPreferredSize

public java.awt.Dimension getPreferredSize()
Returns the preferred size of the chart. This method is maily written for the layout manager. The layout manager should call this method automatically to determine how much space to allocate the chart. The maximum size of the chart will be less than the maximum size set by the setMaximumSize(Dimension) method.
Overrides:
getPreferredSize in class Chart2D
Returns:
The preferred minimum size of the chart.

getNumbersAxisRangeHigh

public float getNumbersAxisRangeHigh()
Returns the value of the high label of the numbers axis. The chart is updated before returning, if it needs it. Make sure the size of the chart has been set to width and height greater than zero. WARNING: This method may be changed or removed.
Overrides:
getNumbersAxisRangeHigh in class GraphChart2D
Returns:
The value of the high label of the numbers axis.

getNumbersAxisRangeLow

public float getNumbersAxisRangeLow()
Returns the value of the low label of the numbers axis. The chart is updated before returning, if it needs it. Make sure the size of the chart has been set to width and height greater than zero. WARNING: This method may be changed or removed.
Overrides:
getNumbersAxisRangeLow in class GraphChart2D
Returns:
The value of the low label of the numbers axis.

pack

public void pack()
Causes the chart to set itself to its preferred size. Recalculates the preferred size if the preferred size wasn't ever set.
Overrides:
pack in class Chart2D

paintComponent

public void paintComponent(java.awt.Graphics g)
Paints the chart. This is provided for the layout manager to call. The first time the chart is painted, massive computation must be made, and a delay will be noticed. After the first painting, no delay should be noticed. The chart is buffered, and should be painted immediately.
Overrides:
paintComponent in class javax.swing.JComponent
Parameters:
g - The graphics context for calculations and painting.

getChartArea

ChartArea getChartArea()
Returns the ChartArea of this LLChart2D.
Overrides:
getChartArea in class Chart2D

getGraphChartArea

GraphChartArea getGraphChartArea()
Returns the GraphChartArea of this LLChart2D.
Overrides:
getGraphChartArea in class GraphChart2D