All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.eou.swingchart.Chart

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----javax.swing.JComponent
                           |
                           +----com.ibm.eou.swingchart.Chart

public abstract class Chart
extends JComponent
implements MouseMotionListener
This is the base class for all charts. To draw a chart, create an instance of BarChart, ParallelChart, PieChart, PlotChart, ScatterChart, or SurfaceChart

See Also:
ParallelChart, PieChart, PlotChart, ScatterChart, StackChart, SurfaceChart

Variable Index

 o PARALLEL
Parallel chart.
 o PIE
Pie chart.
 o PLOT
Plot chart.
 o SCATTER
Scatter chart.
 o STACK
Stacked bar chart.
 o SURFACE
Surface chart.

Constructor Index

 o Chart()
Constructor

Method Index

 o copyright()
IBM Copyright
 o getColors()
Return colors used to draw chart bars, lines, areas, and points.
 o getColors(int)
Return single color used to draw chart bars, lines, areas, and points.
 o getLabelInterval()
Return the interval for X axis labels.
 o getLabelList()
Get labels list property.
 o getLabels()
Get labels property.
 o getLabels(int)
Return a single label identified by an index.
 o getLegendList()
Get legends list property.
 o getLegends()
Get legends.
 o getLegends(int)
Return a single legend identified by an index.
 o getMinimumSize()
 o getPreferredSize()
 o getShowGridLines()
Return option for displaying the grid lines in the chart
 o getShowYAxisValues()
Return option for displaying values on Y axis
 o getValueGrid()
Return the values as a DoubleGrid object.
 o getValues()
Return the set of values displayed by chart
 o getValues(int, int)
Return a specific chart value identified by a row and column index.
 o getYScaleAuto()
Return y-axis automatic scaling
 o getYScaleMaximum()
Return maximum value for y-axis
 o getYScaleMinimum()
Return mimimum value for y-axis
 o mouseDragged(MouseEvent)
 o mouseMoved(MouseEvent)
 o paintChart(Graphics, ChartData, ChartMetrics)
Overridden by subclasses to paint type specific chart using metrics supplied in metrics and data supplied in chartData.
 o paintComponent(Graphics)
 o setColors(Color[])
Set colors for drawing chart bars, lines, areas, and points.
 o setColors(int, Color)
Set a single color used to draw chart bars, lines, areas, and points.
 o setLabelInterval(int)
Set the interval for x axis labels.
 o setLabelList(StringList)
Set labels list property.
 o setLabels(int, String)
Set a single label.
 o setLabels(String[])
Set labels property.
 o setLegendList(StringList)
Set legends list property.
 o setLegends(int, String)
Set a single legend.
 o setLegends(String[])
Set legends property.
 o setShowGridLines(boolean)
Set option for displaying the grid lines in the chart
 o setShowYAxisValues(boolean)
Set option for displaying values on Y axis
 o setValueGrid(DoubleGrid)
Sets the values as a DoubleGrid object.
 o setValues(double[][])
Set a group of values to be displayed by the chart.
 o setValues(int, int, double)
Set a single value to be displayed by the chart, identified by row and column index numbers.
 o setYScaleAuto(boolean)
Set y-axis automatic scaling
 o setYScaleMaximum(double)
Set maximum value for y-axis scale if automatic scaling is set off.
 o setYScaleMinimum(double)
Set minimum value for y-axis if automatic scaling is set off.

Variables

 o STACK
 public static final int STACK
Stacked bar chart. Shows a bar for each range for each x value. Bars are stacked vertically.

 o SCATTER
 public static final int SCATTER
Scatter chart. Shows a point for each range for each x value.

 o PLOT
 public static final int PLOT
Plot chart. Plots a line for each range for each x value.

 o SURFACE
 public static final int SURFACE
Surface chart. Plots a line for each range for each x value. Lines are plotted cumulatively and the area between the lines is filled.

 o PIE
 public static final int PIE
Pie chart.

 o PARALLEL
 public static final int PARALLEL
Parallel chart. Shows a bar for each range for each x value. Bars are abutted horizontally.

Constructors

 o Chart
 public Chart()
Constructor

Methods

 o copyright
 public static String copyright()
IBM Copyright

 o getColors
 public Color[] getColors()
Return colors used to draw chart bars, lines, areas, and points.

Returns:
Array of color objects
 o getColors
 public Color getColors(int index)
Return single color used to draw chart bars, lines, areas, and points. The color is identified by an index number.

Parameters:
index - Index of color to return
Returns:
Color
 o getLabelInterval
 public int getLabelInterval()
Return the interval for X axis labels.

See Also:
setLabelInterval
 o getLabelList
 public StringList getLabelList()
Get labels list property.

This method is primarily provided for the benefit of property editors. When wiring beans or using the API, use the alternative method

Returns:
Column names list encapsulated in an instance of StringList
See Also:
getLabels, StringList
 o getLabels
 public String[] getLabels()
Get labels property.

Returns:
Column names as array
See Also:
getLabelList
 o getLabels
 public String getLabels(int index)
Return a single label identified by an index.

Parameters:
index - Index of label to return
Returns:
Label
 o getLegendList
 public StringList getLegendList()
Get legends list property.

This method is primarily provided for the benefit of property editors. When wiring beans or using the API, use the alternative method getLegends.

Returns:
Column names list encapsulated in an instance of StringList
See Also:
getLegends, StringList
 o getLegends
 public String[] getLegends()
Get legends.

Returns:
Column names as array
See Also:
getLegendList
 o getLegends
 public String getLegends(int index)
Return a single legend identified by an index.

Parameters:
index - Index of legend to return
Returns:
Legend
 o getMinimumSize
 public Dimension getMinimumSize()
Overrides:
getMinimumSize in class JComponent
 o getPreferredSize
 public Dimension getPreferredSize()
Overrides:
getPreferredSize in class JComponent
 o getShowGridLines
 public boolean getShowGridLines()
Return option for displaying the grid lines in the chart

Returns:
true-show grid false-do not show grid
 o getShowYAxisValues
 public boolean getShowYAxisValues()
Return option for displaying values on Y axis

Returns:
true-show values false-do not show values
 o getValueGrid
 public DoubleGrid getValueGrid()
Return the values as a DoubleGrid object. This method is provided primarily for property editors. When wiring beans or using the API, use the alternative method getValues.

Returns:
com.ibm.eou.swingchart.DoubleGrid
See Also:
getValues
 o getValues
 public double[][] getValues()
Return the set of values displayed by chart

Returns:
Chart values as a 2D array of doubles
 o getValues
 public double getValues(int rowIndex,
                         int columnIndex)
Return a specific chart value identified by a row and column index.

Parameters:
rowIndex - 0 based row index
columnIndex - 0 based column index
Returns:
value
 o getYScaleAuto
 public boolean getYScaleAuto()
Return y-axis automatic scaling

Returns:
true-y-axis automatic scaling on
 o getYScaleMaximum
 public double getYScaleMaximum()
Return maximum value for y-axis

Returns:
Maximum value
See Also:
getYScaleMinimum
 o getYScaleMinimum
 public double getYScaleMinimum()
Return mimimum value for y-axis

Returns:
Minimum value
See Also:
setYScaleMinimum
 o mouseDragged
 public void mouseDragged(MouseEvent e)
 o mouseMoved
 public void mouseMoved(MouseEvent e)
 o paintChart
 protected void paintChart(Graphics g,
                           ChartData chartData,
                           ChartMetrics metrics)
Overridden by subclasses to paint type specific chart using metrics supplied in metrics and data supplied in chartData. Axes, labels and legends are painted by this class.

 o paintComponent
 public void paintComponent(Graphics g)
Overrides:
paintComponent in class JComponent
 o setColors
 public void setColors(Color colors[])
Set colors for drawing chart bars, lines, areas, and points.

Note that colors are cycled. It is not necessary to specify a color for each row of values.

Parameters:
colors - Array of Color objects
 o setColors
 public void setColors(int index,
                       Color colors)
Set a single color used to draw chart bars, lines, areas, and points. The color number is identified by specifying an index. If the index is larger than the current number of colors, additional colors are inserted and set to gray.

Parameters:
index - Index of color to set
color - Color objects
 o setLabelInterval
 public void setLabelInterval(int interval)
Set the interval for x axis labels.

Parameters:
interval - Display a label every n X axis items. For example, setting interval to 1 displays a label for every X axis value, setting interval to 2 displays a label every 2 X axis values. Tooltips are displayed for all X values.
See Also:
getLabelInterval, setLabels
 o setLabelList
 public void setLabelList(StringList labelList)
Set labels list property. Labels are strings used to describe values on the chart X axis. Labels are displayed both on the x axis and as tooltips.

This method is primarily provided for the benefit of property editors. When wiring beans or using the API, use the alternative method setLabels.

Parameters:
LabelList - Column names list encapsulated in an instance of StringList
See Also:
StringList, setLabelInterval, setLabels
 o setLabels
 public void setLabels(String Labels[])
Set labels property. Labels are strings used to describe values on the chart X axis. Labels are displayed both on the x axis and as tooltips.

Parameters:
names - Column names as array
See Also:
setLabelList, setLabelInterval
 o setLabels
 public void setLabels(int index,
                       String Label)
Set a single label. The label number is identified by specifying an index. Labels are strings used to describe values on the chart X axis. Labels are displayed both on the x axis and as tooltips.

If the index is larger than the current number of labels, additional labels are inserted and set to blank.

Parameters:
index - Index of label to set
Label - Label string
 o setLegendList
 public void setLegendList(StringList LegendList)
Set legends list property. Legends are strings used to describe separate values for an X axis value. Legends are displayed both beside the right y axis and as tooltips.

This method is primarily provided for the benefit of property editors. When wiring beans or using the API, use the alternative method setLegends.

Parameters:
LegendList - Column names list encapsulated in an instance of StringList
See Also:
StringList, setLegends
 o setLegends
 public void setLegends(String legends[])
Set legends property. Legends are strings used to describe separate values for an X axis value. Legends are displayed both beside the right y axis and as tooltips.

Parameters:
names - Column names as array
See Also:
setLegendList
 o setLegends
 public void setLegends(int index,
                        String legend)
Set a single legend. The legend number is identified by specifying an index.

If the index is larger than the current number of legends, additional legends are inserted and set to blank.

Parameters:
index - Index of legend to set
legend - Legend string
 o setShowGridLines
 public void setShowGridLines(boolean show)
Set option for displaying the grid lines in the chart

Parameters:
show - true-show grid false-do not show grid
 o setShowYAxisValues
 public void setShowYAxisValues(boolean showYAxisValues)
Set option for displaying values on Y axis

Parameters:
showYAxisValues - true-show values false-do not show values
 o setValueGrid
 public void setValueGrid(DoubleGrid dg)
Sets the values as a DoubleGrid object. This method is provided primarily to support property editors. When wiring beans or using the API, use the alternative method setValues.

Parameters:
dg - com.ibm.eou.swingchart.DoubleGrid
See Also:
setValues
 o setValues
 public void setValues(double values[][])
Set a group of values to be displayed by the chart.

Parameters:
values - Group of values specified as a 2D array of doubles.
 o setValues
 public void setValues(int rowIndex,
                       int columnIndex,
                       double value)
Set a single value to be displayed by the chart, identified by row and column index numbers.

If the specified row or column index is larger than the number of rows and columns in the current values array, the array is resized by inserting an appropriate number of new values initialized to 0.

Parameters:
rowIndex - 0 based row index
columnIndex - 0 based column index
value - value
 o setYScaleAuto
 public void setYScaleAuto(boolean auto)
Set y-axis automatic scaling

Parameters:
auto - true:auto-scale false: set scale from maximum and minimum values
See Also:
setYScaleMaximum, setYScaleMinimum
 o setYScaleMaximum
 public void setYScaleMaximum(double maximum)
Set maximum value for y-axis scale if automatic scaling is set off.

Parameters:
Maximum - value
See Also:
setYScaleMinimum, setYScaleAuto
 o setYScaleMinimum
 public void setYScaleMinimum(double minimum)
Set minimum value for y-axis if automatic scaling is set off.

Parameters:
Minimum - value
See Also:
setYScaleMaximum, setYScaleAuto

All Packages  Class Hierarchy  This Package  Previous  Next  Index