Class com.symantec.itools.swing.JChart
All Packages Class Hierarchy This Package Previous Next Index
Class com.symantec.itools.swing.JChart
Object
|
+----Component
|
+----Container
|
+----JComponent
|
+----com.symantec.itools.swing.JChart
- public class JChart
- extends JComponent
- implements GraphStyle, TableModelListener
Simple charting component. Creates a chart capable of displaying one or more series
of data in the form of a bar, line, scatter, pie, or area chart.
The chart uses a standard TableModel interface as the data model type. The TableModel can
use several types including: Integer, Double, Long, String, and DataElem
- Version:
- 1.0, July 28, 1998
- Author:
- Michael Hopkins, Symantec
-
AUTO_CALCULATE_MAX
-
-
AUTO_CALCULATE_MIN
-
-
debug
-
-
graphBorder
-
-
graphCols
-
-
graphLower
-
-
graphMax
-
-
graphMin
- internal data members
-
graphStyle
-
-
graphUpper
-
-
gridIncrementH
-
-
gridIncrementV
-
-
gridStepV
-
-
labelYInset
-
-
legendBorder
-
-
model
- component parameters
-
numTicksY
-
-
precision
-
-
showGrid
-
-
showLegend
-
-
title
-
-
titleBorder
-
-
yAxisMax
-
-
yAxisMin
-
-
com.symantec.itools.swing.JChart()
-
-
calcLabelInset(Graphics)
-
-
calcTickInterval()
- Calculates the interval between tick marks on the horizontal axis
-
calibrateGraph()
-
-
drawAreaGraph(Graphics)
-
-
drawAxis(Graphics)
-
-
drawGrid(Graphics)
-
-
drawLegend(Graphics)
- Draws the legend of the graph
-
drawPieGraph(Graphics)
-
-
drawPieSeries(Graphics, int, Rectangle, int, int)
-
-
drawTitle(Graphics)
-
-
drawYAxisTicks(Graphics)
-
-
getDataLabel(int, int)
- gets the label of a data element associated with a given
index of a specific series
-
getGraphBorder()
- gets border insets of the graph
-
getMinimumSize()
- Get the minimum size of the component
-
getModel()
- Gets the current model used by the chart
-
getNumSeries()
- Returns the number of data series that are used in the graph
-
getNumYTicks()
- gets the number of ticks or major subdivisions displayed on the y axis
-
getPrecision()
- gets the precision displayed by the chart.
-
getPreferredSize()
- Get the preferred size of the component
-
getSeriesColor(int)
- gets the default color of a particular series
-
getSeriesColor(int, int)
- gets the color of a particular data element within a series
-
getSeriesName(int)
- gets the name of a series associated with a given index
-
getSeriesSize(int)
- Gets the size (number of elements) of the series referenced by index i
-
getSeriesValue(int, int)
- retrieves a series entry value
-
getShowGrid()
- returns whether or not a grid is displayed as an overlay of the data area
-
getStyle()
- Gets the new graph style.
-
getTitle()
- Gets the title of the graph
-
getYAxisMax()
- gets the maximum on the y axis
-
getYAxisMin()
- gets the minimum or origin value on the y axis
-
isShowGrid()
- returns whether or not a grid is displayed as an overlay of the data area
-
isShowLegend()
- returns whether or not the graph is to display a legend
-
paintComponent(Graphics)
- Draws the contents of the chart component
-
seriesMax()
- finds the highest value (max) in all series
-
seriesMax(int)
- finds the highest value (max) in a series
-
seriesMin()
- finds the lowest value (min) in all series
-
seriesMin(int)
- finds the lowest value (min) in a series
-
seriesSum(int)
- finds the sumation of all data points in a given series
-
seriesSumMax()
- finds the maximum of the summation of all series entries at a given index
-
setBorder(Border)
- Sets the border of the component
-
setGraphBorder(Insets)
- sets the border insets of the graph
-
setModel(TableModel)
- Sets the current model used by the chart.
-
setNumYTicks(int)
- sets the number of ticks or major subdivisions to be displayed on the y axis
-
setPrecision(int)
- sets the precision to be displayed by the chart.
-
setShowGrid(boolean)
- sets whether or not a grid should be displayed as an overlay of the data area
-
setShowLegend(boolean)
- Sets whether the graph is to display a legend or not
-
setStyle(int)
- Sets the new graph style.
-
setTitle(String)
- Sets the title of the graph
-
setYAxisMax(double)
- sets the maximum on the y axis
-
setYAxisMin(double)
- sets the minimum or origin value on the y axis
-
tableChanged(TableModelEvent)
- Responds to notification of changes in the model data
-
truncDataStr(String)
- Graphics utility routines
AUTO_CALCULATE_MAX
public static final double AUTO_CALCULATE_MAX
AUTO_CALCULATE_MIN
public static final double AUTO_CALCULATE_MIN
debug
protected boolean debug
graphBorder
protected java.awt.Insets graphBorder
graphCols
protected int graphCols
graphLower
protected double graphLower
graphMax
protected double graphMax
graphMin
protected double graphMin
- internal data members
graphStyle
protected int graphStyle
graphUpper
protected double graphUpper
gridIncrementH
protected int gridIncrementH
gridIncrementV
protected int gridIncrementV
gridStepV
protected double gridStepV
labelYInset
protected int labelYInset
legendBorder
protected int legendBorder
model
protected com.sun.java.swing.table.TableModel model
- component parameters
numTicksY
protected int numTicksY
precision
protected int precision
showGrid
protected boolean showGrid
showLegend
protected boolean showLegend
title
protected java.lang.String title
titleBorder
protected int titleBorder
yAxisMax
protected double yAxisMax
yAxisMin
protected double yAxisMin
JChart
public JChart()
calcLabelInset
protected void calcLabelInset(Graphics g)
calcTickInterval
protected void calcTickInterval()
- Calculates the interval between tick marks on the horizontal axis
calibrateGraph
protected void calibrateGraph()
drawAreaGraph
protected void drawAreaGraph(Graphics g)
drawAxis
protected void drawAxis(Graphics g)
drawGrid
protected void drawGrid(Graphics g)
drawLegend
protected void drawLegend(Graphics g)
- Draws the legend of the graph
drawPieGraph
protected void drawPieGraph(Graphics g)
drawPieSeries
protected void drawPieSeries(Graphics g,
int seriesNum,
Rectangle frame,
int startAngle,
int vLabel)
drawTitle
protected void drawTitle(Graphics g)
drawYAxisTicks
protected void drawYAxisTicks(Graphics g)
getDataLabel
public java.lang.String getDataLabel(int series,
int index)
- gets the label of a data element associated with a given
index of a specific series
- Parameters:
- series - number of the series to use
- index - of the data element to use
- Returns:
- name of the requested series
- See Also:
- getSeriesName
getGraphBorder
public java.awt.Insets getGraphBorder()
- gets border insets of the graph
- Returns:
- border of the graph
- See Also:
- setGraphBorder
getMinimumSize
public java.awt.Dimension getMinimumSize()
- Get the minimum size of the component
- Returns:
- the minimum dimension of the component
- Overrides:
- getMinimumSize in class JComponent
getModel
public com.sun.java.swing.table.TableModel getModel()
- Gets the current model used by the chart
- Returns:
- the model
- See Also:
- setModel
getNumSeries
public int getNumSeries()
- Returns the number of data series that are used in the graph
- Returns:
- number of series
getNumYTicks
public int getNumYTicks()
- gets the number of ticks or major subdivisions displayed on the y axis
- Returns:
- int the number of major subdivisions of the y axis
- See Also:
- setNumYTicks
getPrecision
public int getPrecision()
- gets the precision displayed by the chart. Precision is defined
as the number of digits after the decimal point that are to be displayed.
specifying zero indicates that the number is to be treated as an integer.
- Returns:
- int the number of places displayed after the decimal
- See Also:
- setPrecision
getPreferredSize
public java.awt.Dimension getPreferredSize()
- Get the preferred size of the component
- Returns:
- the dimension of the component
- Overrides:
- getPreferredSize in class JComponent
getSeriesColor
public java.awt.Color getSeriesColor(int series)
- gets the default color of a particular series
- Parameters:
- series - index of the series to use
- Returns:
- color associated with the requested series
getSeriesColor
public java.awt.Color getSeriesColor(int series,
int index)
- gets the color of a particular data element within a series
- Parameters:
- series - number of the series to use
- index - associated with the data element within the series
- Returns:
- color associated with the requested series
getSeriesName
public java.lang.String getSeriesName(int series)
- gets the name of a series associated with a given index
- Parameters:
- series - index of the series to use
- Returns:
- name of the requested series
getSeriesSize
public int getSeriesSize(int i)
- Gets the size (number of elements) of the series referenced by index i
- Parameters:
- i - the index of the series
- Returns:
- the size of the series
- Throws: ArrayIndexOutOfBoundsException
-
getSeriesValue
public double getSeriesValue(int series,
int index)
- retrieves a series entry value
- Parameters:
- series - the number of the series to edit
- index - the index of the item to edit
- Throws: ArrayIndexOutOfBoundsException
-
getShowGrid
public boolean getShowGrid()
- Note: getShowGrid() is deprecated.
use isShowGrid instead
- returns whether or not a grid is displayed as an overlay of the data area
- Returns:
- true if a grid is displayed
- See Also:
- setShowGrid
getStyle
public int getStyle()
- Gets the new graph style.
- Returns:
- the new border style, one of DEFAULT_STYLE, LINE_STYLE,
BAR_STYLE, PIE_STYLE, AREA_STYLE, or SCATTER_STYLE
- See Also:
- setStyle, DEFAULT_STYLE, LINE_STYLE, BAR_STYLE, PIE_STYLE, AREA_STYLE, SCATTER_STYLE
getTitle
public java.lang.String getTitle()
- Gets the title of the graph
- Returns:
- String title of the graph
- See Also:
- setTitle
getYAxisMax
public double getYAxisMax()
- gets the maximum on the y axis
- Returns:
- the maximum value on the y axis
- See Also:
- setYAxisMax
getYAxisMin
public double getYAxisMin()
- gets the minimum or origin value on the y axis
- Returns:
- the minimum or origin value on the y axis
- See Also:
- setYAxisMin
isShowGrid
public boolean isShowGrid()
- returns whether or not a grid is displayed as an overlay of the data area
- Returns:
- true if a grid is displayed
- See Also:
- getShowGrid
isShowLegend
public boolean isShowLegend()
- returns whether or not the graph is to display a legend
- Returns:
- true if graph displays a legend
- See Also:
- setShowLegend
paintComponent
public void paintComponent(Graphics g)
- Draws the contents of the chart component
- Parameters:
- g - the graphics object to be referenced for drawing
- Overrides:
- paintComponent in class JComponent
seriesMax
protected double seriesMax()
- finds the highest value (max) in all series
- Returns:
- max value in given series
- Throws: ArrayIndexOutOfBoundsException
-
- See Also:
- seriesMax( int num )
seriesMax
protected double seriesMax(int num)
- finds the highest value (max) in a series
- Parameters:
- num - the series in which to find the maximum value
- Returns:
- max value in given series
- Throws: ArrayIndexOutOfBoundsException
-
seriesMin
protected double seriesMin()
- finds the lowest value (min) in all series
- Returns:
- min value in given series
- Throws: ArrayIndexOutOfBoundsException
-
- See Also:
- seriesMin( int num )
seriesMin
protected double seriesMin(int num)
- finds the lowest value (min) in a series
- Parameters:
- num - the series in which to find the minimum value
- Returns:
- min value in given series
- Throws: ArrayIndexOutOfBoundsException
-
seriesSum
protected double seriesSum(int num)
- finds the sumation of all data points in a given series
- Parameters:
- num - the series in which to find the sumation
- Returns:
- sumation of a given series
seriesSumMax
protected double seriesSumMax()
- finds the maximum of the summation of all series entries at a given index
- Returns:
- maximum graph summation
setBorder
public void setBorder(Border border)
- Sets the border of the component
- Overrides:
- setBorder in class JComponent
setGraphBorder
public void setGraphBorder(Insets i)
- sets the border insets of the graph
- Parameters:
- i - graph insets to use
- See Also:
- getGraphBorder
setModel
public void setModel(TableModel newModel)
- Sets the current model used by the chart. The model is a TableModel derrivative, and can
be composed of objects of type Integer, Long, Double, String, or DataElem
- Parameters:
- newModel - the TabelModel to be used by the chart
- Throws: IllegalArgumentException
- if the specified model is null
- See Also:
- getModel
setNumYTicks
public void setNumYTicks(int ticks)
- sets the number of ticks or major subdivisions to be displayed on the y axis
- Parameters:
- ticks - the number of major subdivisions to use for the y axis
- See Also:
- getNumYTicks
setPrecision
public void setPrecision(int places)
- sets the precision to be displayed by the chart. Precision is defined
as the number of digits after the decimal point that are to be displayed.
specifying zero indicates that the number is to be treated as an integer.
- Parameters:
- places - the number of places to display after the decimal
- See Also:
- getPrecision
setShowGrid
public void setShowGrid(boolean show)
- sets whether or not a grid should be displayed as an overlay of the data area
- Parameters:
- show - true if a grid should be displayed
- See Also:
- getShowGrid
setShowLegend
public void setShowLegend(boolean b)
- Sets whether the graph is to display a legend or not
- Parameters:
- b - true if graph should display a legend
- See Also:
- isShowLegend
setStyle
public void setStyle(int style)
- Sets the new graph style.
- Parameters:
- style - the new border style, one of DEFAULT_STYLE, LINE_STYLE,
BAR_STYLE, PIE_STYLE, AREA_STYLE, or SCATTER_STYLE
- See Also:
- getStyle, DEFAULT_STYLE, LINE_STYLE, BAR_STYLE, PIE_STYLE, AREA_STYLE, SCATTER_STYLE
setTitle
public void setTitle(String s)
- Sets the title of the graph
- Parameters:
- s - title of the graph
- See Also:
- getTitle
setYAxisMax
public void setYAxisMax(double max)
- sets the maximum on the y axis
- Parameters:
- max - the maximum value on the y axis
- See Also:
- getYAxisMax
setYAxisMin
public void setYAxisMin(double min)
- sets the minimum or origin value on the y axis
- Parameters:
- min - the minimum or origin value on the y axis
- See Also:
- getYAxisMin
tableChanged
public void tableChanged(TableModelEvent e)
- Responds to notification of changes in the model data
- Parameters:
- e - the event to process
truncDataStr
protected java.lang.String truncDataStr(String s)
- Graphics utility routines
All Packages Class Hierarchy This Package Previous Next Index