khartzToolz
Interface KhartzChart

All Known Implementing Classes:
KhartzElectionBar, khartzToolz.KhartzPie

public interface KhartzChart

The common interface that all chart objects must implement.

Since:
30/12/2002
Version:
Alpha 1.0
Author:
Austin Warren

Method Summary
 boolean contains(java.awt.Point p)
          Scans the available segments within the chart in sequence, to see if the Point p is contained within the area of one of those segments.
 java.awt.Rectangle getChartSize()
           
 java.awt.Font getFont()
          Returns the current chart font
 java.lang.String getLabel(int i)
          Fetches a text label from the the array of labels held by the chart
 double getRelativeTextSize()
          Gets the current text size setting for the chart.
 java.awt.Dimension getSize()
          Deprecated. Now replaced by getArea()
 double getValue(int i)
          Fetches a value from the array of values contained within the chart.
 void mouseMoved(java.awt.event.MouseEvent e)
          Used to send a mouse event to the chart for action when a mouse is moved
 void mouseReleased(java.awt.event.MouseEvent e)
          An action that is performed by the chart when the mouse button is released within the applet window.
 void paint(java.awt.Graphics g)
          The paint() method takes a Graphics instance which represents the screen area (or an off screen area if double buffering is used.
 void setColorArray(java.awt.Color[] colorArray)
          Sets the current range of values associated with the segments in the Chart
 void setFont(java.awt.Font f)
          Sets the font for the current chart
 void setRelativeTextSize(double size)
          Sets the relative size of the text to be displayed on the chart.
 java.lang.String toString()
          Returns a string representation of the chart containing key information.
 

Method Detail

paint

public void paint(java.awt.Graphics g)
The paint() method takes a Graphics instance which represents the screen area (or an off screen area if double buffering is used. This is passed to the individual chart segments to enable them to draw themselves.
Parameters:
g - A Graphics instance for the current screen display (or an offscreen buffer if double buffering is used).
Since:
30/12/2002

contains

public boolean contains(java.awt.Point p)
Scans the available segments within the chart in sequence, to see if the Point p is contained within the area of one of those segments.
Parameters:
p - A point within the chart area
Returns:
boolean - Returns true if the point is contained within one of the chart segments.
Since:
30/12/2002

getSize

public java.awt.Dimension getSize()
Deprecated. Now replaced by getArea()

Returns:
java.awt.Dimension
Since:
30/12/2002

toString

public java.lang.String toString()
Returns a string representation of the chart containing key information.
Overrides:
toString in class java.lang.Object
Returns:
String
Since:
30/12/2002

getValue

public double getValue(int i)
Fetches a value from the array of values contained within the chart.
Parameters:
i - An integer indicating which value to return from the array of values held by the chart.
Returns:
A double representing a chart value.
Throws:
java.lang.IndexOutOfBoundsException -  
Since:
30/12/2002

getLabel

public java.lang.String getLabel(int i)
Fetches a text label from the the array of labels held by the chart
Parameters:
i - An integer representing the position within the chart's label array
Returns:
A String that holds the selected text label.
Since:
30/12/2002

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Used to send a mouse event to the chart for action when a mouse is moved
Parameters:
e - A MouseEvent containing information about the current mouse action.
Since:
30/12/2002

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
An action that is performed by the chart when the mouse button is released within the applet window.
Parameters:
e - A MouseEvent holding information about the current mouse action.
Since:
30/12/2002

setRelativeTextSize

public void setRelativeTextSize(double size)
Sets the relative size of the text to be displayed on the chart. Font sizes are set by the chart relative to it's width and height in pixels. This gives the additional control required where very large or small charts are being used.
Parameters:
size - The default setting is 1 which represents a scale of 100%. 0.5 would be 50% and 2 would be 200%.
Since:
30/12/2002

getRelativeTextSize

public double getRelativeTextSize()
Gets the current text size setting for the chart. 1 is the default.
Returns:
The default setting is 1 which represents a scale of 100%. 0.5 would be 50% and 2 would be 200%.
Since:
30/12/2002

getFont

public java.awt.Font getFont()
Returns the current chart font
Returns:
The current chart Font
Since:
30/12/2002

setFont

public void setFont(java.awt.Font f)
Sets the font for the current chart
Parameters:
f - The required font
Since:
30/12/2002

getChartSize

public java.awt.Rectangle getChartSize()
Returns:
java.awt.Rectangle
Since:
30/12/2002

setColorArray

public void setColorArray(java.awt.Color[] colorArray)
Sets the current range of values associated with the segments in the Chart
Parameters:
colorArray[] -  
Since:
30/12/2002