com.jinsight.jetchart
Class GaugeGraph

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended bycom.jinsight.jetchart.GradientPanel
                  extended bycom.jinsight.jetchart.GenericGraph
                      extended bycom.jinsight.jetchart.GaugeGraph
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class GaugeGraph
extends GenericGraph

A gauge chart is used to show the progress of a running process using a visual indicator plotted against a predefined range of values. JetChart implements a gauge chart in the form of a circular scale, using a needle to indicate the current state of a process.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
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 com.jinsight.jetchart.GenericGraph
CENTER, TILE, TOP_LEFT
 
Fields inherited from class com.jinsight.jetchart.GradientPanel
BOTTOM_TO_TOP, LEFT_TO_RIGHT, RIGHT_TO_LEFT, TOP_TO_BOTTOM
 
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
GaugeGraph()
          Creates a GaugeGraph object.
 
Method Summary
 void addGaugeZone(GaugeZone gz)
          Adds a new GaugeZone object to the chart context.
 void addScale(GaugeScale scale)
          Adds a new GaugeScale object to the chart context.
protected  void finalize()
           
 GaugeFrame getGaugeFrame()
          Returns a reference to the GaugeFrame object.
 GaugeGraphEventListener getGaugeGraphEventListener()
          Returns a reference to a GaugeGraphEventListener object.
 GaugeZone getGaugeZone(int gaugeZoneIndex)
          Returns a reference to a GaugeZone object, given the order index in which it was added to the chart context.
 int getGaugeZonesCount()
          Returns the number of GaugeZone objects added to the chart context.
 GaugeScale getScale(int scaleIndex)
          Returns a reference to a GaugeScale object, given the order index in which it was added to the chart context.
 int getScalesCount()
          Returns the number of GaugeScale objects added to the chart context.
 void paint(java.awt.Graphics gr)
          Overrides the Component class paint() method to provide gradient effect.
 void readXMLData(java.io.Reader reader)
          Reads chart properties from an xml character stream.
 void removeAllGaugeZones()
          Removes all GaugeZone objects added to the chart context.
 void removeAllScales()
          Removes all GaugeScale objects added to the chart context.
 void removeGaugeZone(GaugeZone gz)
          Removes a GaugeZone object previously added to the chart context.
 void removeScale(GaugeScale scale)
          Removes a GaugeScale object previously added to the chart context.
 void update(java.awt.Graphics gr)
          Overrides the Component class update() method, to avoid flickering.
 
Methods inherited from class com.jinsight.jetchart.GenericGraph
addLegend, addNote, addSerie, addSerieListener, getBottomTitle, getLeftTitle, getLegend, getLegend, getRightTitle, getSeries, getToolTip, isPainted, processMouseEvent, processMouseMotionEvent, refresh, removeAllNotes, removeAllSeries, removeLegend, removeNote, removeSerie, removeSerieListener, set3DEnabled, setBackgroundImage, setBorderColor, setBorderEnabled, setBorderThickness, setBottomMargin, setBufferedImageEnabled, setConnection, setDefaultCursor, setDraggingBoxColor, setDraggingEnabled, setDriver, setLabelsQuery, setLeftMargin, setLegendEnabled, setOffScreenGraphEnabled, setRightMargin, setTitle, setTitleFont, setTitleForeground, setTitleGap, setTopMargin, setValueFormat
 
Methods inherited from class com.jinsight.jetchart.GradientPanel
setGradientColors, setGradientOrientation
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, 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, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GaugeGraph

public GaugeGraph()
Creates a GaugeGraph object. Default constructor.

Method Detail

getGaugeFrame

public GaugeFrame getGaugeFrame()
Returns a reference to the GaugeFrame object.

Returns:
A GaugeFrame object.
See Also:
GaugeFrame

getGaugeZone

public GaugeZone getGaugeZone(int gaugeZoneIndex)
Returns a reference to a GaugeZone object, given the order index in which it was added to the chart context.

Parameters:
gaugeZoneIndex - An integer number.
Returns:
A GaugeZone object.
See Also:
GaugeZone, addGaugeZone(com.jinsight.jetchart.GaugeZone), removeGaugeZone(com.jinsight.jetchart.GaugeZone), removeAllGaugeZones()

getGaugeZonesCount

public int getGaugeZonesCount()
Returns the number of GaugeZone objects added to the chart context.

Returns:
An integer number.
See Also:
GaugeZone, addGaugeZone(com.jinsight.jetchart.GaugeZone), removeGaugeZone(com.jinsight.jetchart.GaugeZone), removeAllGaugeZones()

getScale

public GaugeScale getScale(int scaleIndex)
Returns a reference to a GaugeScale object, given the order index in which it was added to the chart context. GaugeGraph keeps a primary GaugeScale object, against which all GaugeSerie objects not associated with any other scales are painted.
The index of the primary GaugeScale is always 0.

Parameters:
scaleIndex - An integer number.
Returns:
A GaugeScale object.
See Also:
GaugeScale, GaugeSerie, addScale(com.jinsight.jetchart.GaugeScale), removeScale(com.jinsight.jetchart.GaugeScale), removeAllScales()

getScalesCount

public int getScalesCount()
Returns the number of GaugeScale objects added to the chart context.

Returns:
An integer number.
See Also:
GaugeScale, addScale(com.jinsight.jetchart.GaugeScale), removeScale(com.jinsight.jetchart.GaugeScale), removeAllScales()

addScale

public void addScale(GaugeScale scale)
Adds a new GaugeScale object to the chart context.

Parameters:
scale - A GaugeScale object.
See Also:
GaugeScale, removeScale(com.jinsight.jetchart.GaugeScale), removeAllScales()

removeScale

public void removeScale(GaugeScale scale)
Removes a GaugeScale object previously added to the chart context.

Parameters:
scale - A GaugeScale object.
See Also:
GaugeScale, addScale(com.jinsight.jetchart.GaugeScale), removeAllScales()

removeAllScales

public void removeAllScales()
Removes all GaugeScale objects added to the chart context.

See Also:
GaugeScale, addScale(com.jinsight.jetchart.GaugeScale), removeScale(com.jinsight.jetchart.GaugeScale)

addGaugeZone

public void addGaugeZone(GaugeZone gz)
Adds a new GaugeZone object to the chart context.

Parameters:
gz - A GaugeZone object.
See Also:
GaugeZone, removeGaugeZone(com.jinsight.jetchart.GaugeZone), removeAllGaugeZones()

removeGaugeZone

public void removeGaugeZone(GaugeZone gz)
Removes a GaugeZone object previously added to the chart context.

Parameters:
gz - A GaugeZone object.
See Also:
GaugeZone, addGaugeZone(com.jinsight.jetchart.GaugeZone), removeAllGaugeZones()

removeAllGaugeZones

public void removeAllGaugeZones()
Removes all GaugeZone objects added to the chart context.

See Also:
GaugeZone, addGaugeZone(com.jinsight.jetchart.GaugeZone), removeGaugeZone(com.jinsight.jetchart.GaugeZone)

getGaugeGraphEventListener

public GaugeGraphEventListener getGaugeGraphEventListener()
Returns a reference to a GaugeGraphEventListener object. This object is created and owned by a GaugeGraph instance, and implements both MouseListener and MouseMotionListener interfaces to handle mouse events fired by the GaugeGraph class.

See Also:
GaugeGraphEventListener

readXMLData

public void readXMLData(java.io.Reader reader)
                 throws java.io.IOException
Description copied from class: GenericGraph
Reads chart properties from an xml character stream. The incoming data must follow some rules regarding the xml elements to be parsed. Currently, only chart labels and series values are supported. Future versions of JetChart will support a complete set of xml elements to specify all chart properties. The structure of the xml character stream is the following:

<chart>
  <labels>
     l1
     l2
     l3
     l4

  </labels>
  <series id="1">
    <values>
       80
       100
       70
       60

    </values>
  </series>
  <series id="2">
    <multiplevalues qty="4" delimiter="|">
       10|20|15|35
       22|38|12|40
       17|50|20|13
       25|14|38|55

    </multiplevalues>
  </series>
</chart>

In the xml sequence above, we can see the following xml elements and attributes:

<chart> - This is the root element, and it must be closed at the end of the xml file.

<labels> - Used to list textual data representing the chart labels.

<series> - Encloses the properties of a series. The id attribute is used to identify the series within the chart context. It is compared with the value returned by the AbstractSerie.getId() method, and if they match, the properties read from this xml file are assigned to the identified series.

<values> - Used to list textual data representing a series values.

<multiplevalues> - Used to set values of series that display data points associated with multiple values, like ohlc series, for example. The qty attribute is mandatory, and it is used to set the exact number of values expected from each line listed within the <multiplevalues> tag. The delimiter attribute is optional. It is used by the xml parser to tokenize values. If not informed, a space character is used.

Every opened xml element must be closed, otherwise the xml parser raises an exception.

Overrides:
readXMLData in class GenericGraph
Parameters:
reader - The reader from which to retrieve the XML data.
Throws:
java.io.IOException - If an error occured while reading the input.
See Also:
AbstractSerie.getId()

update

public void update(java.awt.Graphics gr)
Overrides the Component class update() method, to avoid flickering.

Parameters:
gr - A Graphics object, where painting is done. This object is automatically created by the AWT classes and passed to the update() method, which in turn sends it to the paint() method.
See Also:
paint(java.awt.Graphics)

paint

public void paint(java.awt.Graphics gr)
Description copied from class: GradientPanel
Overrides the Component class paint() method to provide gradient effect.

Overrides:
paint in class GradientPanel
Parameters:
gr - A Graphics object.

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class GenericGraph
Throws:
java.lang.Throwable