com.elj.chart.chart2d
Class Chart2D

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--com.elj.chart.chart2d.Chart2D
All Implemented Interfaces:
javax.accessibility.Accessible, java.io.Externalizable, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class Chart2D
extends java.awt.Panel
implements java.io.Externalizable

This class implements the 2 dimensional series charting that allows the data to be displayed in a line, bar or a pie shape. Visual tools like these allow the data to be piped in through other tools like SQL Result Set or a user defined data set.

See Also:
Serialized Form

Inner classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
static java.lang.String BAR_CHART
          Chart type for the Chart2D
static java.lang.String CENTERED_LINE
          Line style for the Chart2D
static java.lang.String DASHED_LINE
          Line style for the Chart2D
static java.lang.String LINE_CHART
          Chart type for the Chart2D
static java.lang.String PIE_CHART
          Chart type for the Chart2D
static java.lang.String STRAIGHT_LINE
          Line style for the Chart2D
 
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
Chart2D()
          Constructs the Chart2D
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          Adds the property change listener
 void doLayout()
           
 void firePropertyChange(java.lang.String property, java.lang.Object oldValue, java.lang.Object newValue)
          Fires the property change
 java.awt.Color getAxisColor()
          Returns the axis color of the chart
 java.awt.Font getAxisLabelFont()
          Returns the axis label font
 java.awt.Color getBackground()
          Returns the background
 java.lang.String getChartType()
          Returns the chart type
 java.awt.Font getFont()
          Returns the font of the chart
 java.awt.Color getForeground()
          Returns the foreground
 int getGapBetweenBars()
          Returns the gap between bars
 java.awt.Color getGraphBackground()
          Returns the graph background
 java.awt.Color getGridColor()
          Returns the grid color of the chart
 java.lang.String getInputValues()
          Returns the input values
 java.lang.String getLineStyle()
          Returns the line style
 java.util.Locale getLocale()
          Method which returns the locale of the Chart2D
 java.awt.Dimension getMinimumSize()
          Returns the minimum size
 java.util.Vector getPieColors()
          Returns the pie colors
 java.awt.Dimension getPreferredSize()
          Returns the preferred size
 int getSelectedPie()
          Gets the current selected pie slice.
 java.util.Vector getSQLData()
          Returns the SQL data
 java.awt.Color getTextColor()
          Returns the text color of the chart
 java.lang.String getTitle()
          Returns the title of the Chart2D
 java.awt.Color getTitleColor()
          Returns the title color of the chart
 java.awt.Font getTitleFont()
          Returns the title font of the chart
 java.lang.String getXAxisLabel()
          Returns the label of the x axis
 java.lang.String getXLabel()
          Gets the text labels for the data items to be displayed
 java.lang.String getYAxisLabel()
          Returns the label of the y axis
 java.util.Vector parseString(java.lang.String string, java.lang.String delimiter)
          Parses the string
 void readExternal(java.io.ObjectInput in)
          Implementation of the Externalizable
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
          Removes the property change listener
 void setAxisColor(java.awt.Color axisColor)
          Sets the axis color of the chart
 void setAxisLabelFont(java.awt.Font font)
          Sets the axis label font
 void setBackground(java.awt.Color background)
          Sets the background
 void setBounds(int x, int y, int width, int height)
          Method which sets the bounds of the Chart2D
 void setChartType(java.lang.String chartType)
          Sets the chart type
 void setCursor(java.awt.Cursor cursor)
          Method which sets the cursor for the Chart2D
 void setEnabled(boolean bEnabled)
          Method which sets the enability of the Chart2D
 void setFont(java.awt.Font font)
          Sets the font for the chart
 void setForeground(java.awt.Color foreground)
          Sets the foreground
 void setGapBetweenBars(int gap)
          Sets the gap between the bars of the bar chart
 void setGraphBackground(java.awt.Color background)
          Sets the graph background
 void setGridColor(java.awt.Color gridColor)
          Sets the grid color of the chart
 void setInputValues(java.lang.String inputValues)
          Sets the input values specified by the string
 void setLineStyle(java.lang.String lineStyle)
          Sets the LineStyle of the Line chart Three Line styles are supported straight, dashed and centered
 void setLocale(java.util.Locale locale)
          Method which sets the locale for the Chart2D
 void setPieColors(java.lang.String[] pieColors)
          Sets the pie colors
 void setPieColors(java.util.Vector pieColors)
          Sets the PieColors from Vector, All the elements of the Vector must be of type Color
 void setSelectedPie(int i)
          Sets the SelectedPie index of the Pie chart.
 void setSQLData(java.lang.String[][] data)
          Sets the SQL data
 void setSQLData(java.util.Vector data)
          Sets the SQL data
 void setTextColor(java.awt.Color textColor)
          Sets the text color for the chart
 void setTitle(java.lang.String title)
          Sets the title of the Chart2D
 void setTitleColor(java.awt.Color color)
          Sets the title color for the chart
 void setTitleFont(java.awt.Font font)
          Sets the title font for the chart
 void setVisible(boolean bVisible)
          Method which sets the visibility for the Chart2D
 void setXAxisLabel(java.lang.String label)
          Sets the x axis label
 void setXLabel(java.lang.String XLabels)
          Sets the XLabels for the data items to be displayed
 void setYAxisLabel(java.lang.String label)
          Sets the y axis label
 void writeExternal(java.io.ObjectOutput out)
          Implementation of the Externalizable
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setLayout, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFontMetrics, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, 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, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBounds, setComponentOrientation, setDropTarget, 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

LINE_CHART

public static java.lang.String LINE_CHART
Chart type for the Chart2D

PIE_CHART

public static java.lang.String PIE_CHART
Chart type for the Chart2D

BAR_CHART

public static java.lang.String BAR_CHART
Chart type for the Chart2D

STRAIGHT_LINE

public static java.lang.String STRAIGHT_LINE
Line style for the Chart2D

DASHED_LINE

public static java.lang.String DASHED_LINE
Line style for the Chart2D

CENTERED_LINE

public static java.lang.String CENTERED_LINE
Line style for the Chart2D
Constructor Detail

Chart2D

public Chart2D()
Constructs the Chart2D
Method Detail

setTitle

public void setTitle(java.lang.String title)
Sets the title of the Chart2D
Parameters:
title - The title of the Chart2D

getTitle

public java.lang.String getTitle()
Returns the title of the Chart2D
Returns:
The title of the Chart2D

setChartType

public void setChartType(java.lang.String chartType)
Sets the chart type
Parameters:
chartType - The chart type

getChartType

public java.lang.String getChartType()
Returns the chart type
Returns:
The chart type

setInputValues

public void setInputValues(java.lang.String inputValues)
Sets the input values specified by the string
Parameters:
inputValues - The input values specified by the string

getInputValues

public java.lang.String getInputValues()
Returns the input values
Returns:
The input values

setXLabel

public void setXLabel(java.lang.String XLabels)
Sets the XLabels for the data items to be displayed
Parameters:
XLabels - The specified string

getXLabel

public java.lang.String getXLabel()
Gets the text labels for the data items to be displayed
Returns:
String value specifies the data string

setGapBetweenBars

public void setGapBetweenBars(int gap)
Sets the gap between the bars of the bar chart
Parameters:
gap - The gap between the bars

getGapBetweenBars

public int getGapBetweenBars()
Returns the gap between bars
Returns:
The gap between bars

parseString

public java.util.Vector parseString(java.lang.String string,
                                    java.lang.String delimiter)
Parses the string
Parameters:
string - The specified string
delimiter - The delimiter char
Returns:
vector containing the tokens after parse

setSQLData

public void setSQLData(java.util.Vector data)
Sets the SQL data
Parameters:
data - The SQL data the format of the data vector is --- for adding the single record to the data vector Vector data = new Vector(); Vector temp = new Vector(); --- contains the first record temp.addElement("AAA"); temp.addElement("1"); data.addElement(temp);

setSQLData

public void setSQLData(java.lang.String[][] data)
Sets the SQL data
Parameters:
data - The two dimensional array containing the SQL data

getSQLData

public java.util.Vector getSQLData()
Returns the SQL data
Returns:
The SQL data

setBackground

public void setBackground(java.awt.Color background)
Sets the background
Overrides:
setBackground in class java.awt.Component
Parameters:
background - The specified background

getBackground

public java.awt.Color getBackground()
Returns the background
Overrides:
getBackground in class java.awt.Component
Returns:
The background

setForeground

public void setForeground(java.awt.Color foreground)
Sets the foreground
Overrides:
setForeground in class java.awt.Component
Parameters:
The - specified foreground

getForeground

public java.awt.Color getForeground()
Returns the foreground
Overrides:
getForeground in class java.awt.Component
Returns:
The foreground

setPieColors

public void setPieColors(java.util.Vector pieColors)
Sets the PieColors from Vector, All the elements of the Vector must be of type Color
Parameters:
pieColors - Vector value specified in the Vector

setPieColors

public void setPieColors(java.lang.String[] pieColors)
Sets the pie colors
Parameters:
pieColors - The array contains the pie colors

getPieColors

public java.util.Vector getPieColors()
Returns the pie colors
Returns:
The pie colors

setGraphBackground

public void setGraphBackground(java.awt.Color background)
Sets the graph background
Parameters:
background - The graph background

getGraphBackground

public java.awt.Color getGraphBackground()
Returns the graph background
Returns:
The graph background

setLineStyle

public void setLineStyle(java.lang.String lineStyle)
Sets the LineStyle of the Line chart Three Line styles are supported straight, dashed and centered
Parameters:
lineStyle - The specified line style

getLineStyle

public java.lang.String getLineStyle()
Returns the line style

setSelectedPie

public void setSelectedPie(int i)
Sets the SelectedPie index of the Pie chart. User this index to set color of the Pie slice.
Parameters:
int - value specifies the Pie slice.

getSelectedPie

public int getSelectedPie()
Gets the current selected pie slice. For "ChartType" equals "Pie" the Foreground will return color of the pie slice depending upon this index.

setTextColor

public void setTextColor(java.awt.Color textColor)
Sets the text color for the chart
Parameters:
textColor - The text color for the chart

getTextColor

public java.awt.Color getTextColor()
Returns the text color of the chart
Returns:
The text color of the chart

setGridColor

public void setGridColor(java.awt.Color gridColor)
Sets the grid color of the chart
Parameters:
gridColor - The grid color of the chart

getGridColor

public java.awt.Color getGridColor()
Returns the grid color of the chart
Returns:
The grid color of the chart

setAxisColor

public void setAxisColor(java.awt.Color axisColor)
Sets the axis color of the chart
Parameters:
axisColor - The axis color of the chart

getAxisColor

public java.awt.Color getAxisColor()
Returns the axis color of the chart
Returns:
The axis color of the chart

setFont

public void setFont(java.awt.Font font)
Sets the font for the chart
Overrides:
setFont in class java.awt.Container
Parameters:
font - The specified font for the chart

getFont

public java.awt.Font getFont()
Returns the font of the chart
Overrides:
getFont in class java.awt.Component
Returns:
The font of the chart

setTitleFont

public void setTitleFont(java.awt.Font font)
Sets the title font for the chart
Parameters:
font - The title font for the chart

getTitleFont

public java.awt.Font getTitleFont()
Returns the title font of the chart
Returns:
The title font of the chart

setAxisLabelFont

public void setAxisLabelFont(java.awt.Font font)
Sets the axis label font
Parameters:
font - The axis label font

getAxisLabelFont

public java.awt.Font getAxisLabelFont()
Returns the axis label font
Returns:
The axis label font

setTitleColor

public void setTitleColor(java.awt.Color color)
Sets the title color for the chart
Parameters:
font - The title color for the chart

getTitleColor

public java.awt.Color getTitleColor()
Returns the title color of the chart
Returns:
The title color of the chart

setXAxisLabel

public void setXAxisLabel(java.lang.String label)
Sets the x axis label
Parameters:
label - The x axis label

getXAxisLabel

public java.lang.String getXAxisLabel()
Returns the label of the x axis
Returns:
The label of the x axis

setYAxisLabel

public void setYAxisLabel(java.lang.String label)
Sets the y axis label
Parameters:
label - The y axis label

getYAxisLabel

public java.lang.String getYAxisLabel()
Returns the label of the y axis
Returns:
The label of the y axis

setLocale

public void setLocale(java.util.Locale locale)
Method which sets the locale for the Chart2D
Overrides:
setLocale in class java.awt.Component
Parameters:
locale - The locale for the Chart2D

getLocale

public java.util.Locale getLocale()
Method which returns the locale of the Chart2D
Overrides:
getLocale in class java.awt.Component
Returns:
The locale of the Chart2D

setCursor

public void setCursor(java.awt.Cursor cursor)
Method which sets the cursor for the Chart2D
Overrides:
setCursor in class java.awt.Component
Parameters:
cursor - The cursor for the Chart2D

setVisible

public void setVisible(boolean bVisible)
Method which sets the visibility for the Chart2D
Overrides:
setVisible in class java.awt.Component
Parameters:
bVisible - the visibility for the Chart2D

setEnabled

public void setEnabled(boolean bEnabled)
Method which sets the enability of the Chart2D
Overrides:
setEnabled in class java.awt.Component
Parameters:
bEnabled - the enability of the Chart2D

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Method which sets the bounds of the Chart2D
Overrides:
setBounds in class java.awt.Component
Parameters:
x - The x coordinate of the Chart2D
y - The y coordinate of the Chart2D
width - The width of the of the Chart2D
height - The height of the Chart2D

getPreferredSize

public java.awt.Dimension getPreferredSize()
Returns the preferred size
Overrides:
getPreferredSize in class java.awt.Container

getMinimumSize

public java.awt.Dimension getMinimumSize()
Returns the minimum size
Overrides:
getMinimumSize in class java.awt.Container

doLayout

public void doLayout()
Overrides:
doLayout in class java.awt.Container

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Adds the property change listener
Overrides:
addPropertyChangeListener in class java.awt.Component
Parameters:
l - The property change listener

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Removes the property change listener
Overrides:
removePropertyChangeListener in class java.awt.Component
Parameters:
l - The property change listener

firePropertyChange

public void firePropertyChange(java.lang.String property,
                               java.lang.Object oldValue,
                               java.lang.Object newValue)
Fires the property change
Overrides:
firePropertyChange in class java.awt.Component
Parameters:
property - The name of the property
oldValue - The old value
newValue - The new value

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException,
                          java.awt.IllegalComponentStateException
Implementation of the Externalizable
Specified by:
writeExternal in interface java.io.Externalizable

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Implementation of the Externalizable
Specified by:
readExternal in interface java.io.Externalizable