vis.beans.plotter
Class PlotViewport

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--vis.beans.plotter.Viewport
                          |
                          +--vis.beans.plotter.PlotViewport
All Implemented Interfaces:
java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextServiceRevokedListener, java.beans.beancontext.BeanContextServicesListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Printable, java.io.Serializable
Direct Known Subclasses:
MultiHistogram, MultiXYPlot

public abstract class PlotViewport
extends Viewport
implements java.awt.print.Printable

PlotViewport is the base class for all the types of plots. It defines common properties and methods. Except for pie chart, a plot has two axes: X and Y. An axis has a title and a number of big ticks. A big tick can have a label. Some plots can have small ticks two etween two big ticks. The inputs ( X and Y axis values) for the drawing methods are of type Object which can be an array of Java primitive data types. Only one plot can be drawn at a time on the plot viewport. A graph is defined to be a trace of Y values Vs X values. A plot can have many graphs. There is only one title for a plot. When there are more that one graph, the plot viewport can turn on the legend. Each legend displays the corresponding graph title.

Version:
1.0 10 July 2000
Author:
Larry Rodrigues
See Also:
Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
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 int AUTO
           
protected  java.awt.Point border
           
protected  int[] borderULHC
          Upper left hand corner coordinate of the border.
protected  java.lang.Class customizerClass
           
protected  boolean enableDraw
          Flag that indicates whether to redraw the plot.
protected  java.awt.Font font
          Font.
protected  int fontSize
          Font size.
protected  java.awt.Color graphColor
          Current graph color.
 java.awt.Color[] graphColors
           
protected  int graphHt
          Width and height of the graph.
protected  int graphNum
          Current graph number.
protected  java.lang.String graphTitle
          Graph title.
protected  int graphWid
          Width and height of the graph.
protected  int headerHt
          Hieght of the header.
protected  java.awt.Point headerPt
          Position of the title.
protected  int legBoxSize
          Size of the legend box.
protected  java.util.Vector legendColor
           
protected  int legendGap
          The legend gap.
protected  int legendGapIncr
          Legend gap increment.
protected  boolean legendOn
          Legend on or off.
protected  int[] legendPos
          Legend position.
protected  int legendPosXIncr
          Legend position increment in X direction.
protected  int legendPosYIncr
          Legend position increment in Y direction.
protected  java.util.Vector legendString
           
protected  java.awt.Point legPt
          Absolute legend position, i.e.; legendPos+incr.
protected  int maxGraphs
          Maximum number of graphs.
protected  int numSmallXTicks
          Number of small x ticks.
protected  int numSmallYTicks
          Number of small y ticks.
protected  int numXTicks
          Number of x ticks.
protected  int numYTicks
          Number of y ticks.
protected  java.awt.Point orig
          Origin of the graph
protected  int originXIncr
          Origin increment in X direction.
protected  int originYIncr
          Origin increment in Y direction.
protected  java.awt.FontMetrics pFont
          Font metrics.
protected  double tickGap
          Gap between X axis ticks in pixels.
protected  int tickLen
          Tick length.
protected  java.lang.String titleString
          Plot title.
protected  java.lang.Object x
          Object that holds an array of X axis values.
protected  java.awt.Point xLabel
          Position of the X axis title.
protected  int xLabelsPerTick
          Interval between two X axis labels in terms of nummer of big X ticks.
protected  java.lang.String xLabelString
          X axis title.
protected  int[] xMinmax
          Range of X values as an array of int.
protected  double xRange
          X axis range of values i.e.; max - min.
protected  double xScale
          X axis scale factor.
protected  double xSizeRatio
          X axis size ratio, i.e.; (X axis width in pixels)/256.
protected  java.lang.String[] xTextValues
          X axis string values.
protected  int[] xTickPt
          Array that holds the values corresponding to the X axis ticks(big).
protected  java.lang.Object y
          Object that holds an array of Y axis values.
protected  java.awt.Point yLabel
          Position of the Y axis title.
protected  int yLabelsPerTick
          Interval between two Y axis labels in terms of nummer of big Y ticks.
protected  java.lang.String yLabelString
          Y axis title.
protected  int[] yMinmax
          Range of Y values as an array of int.
protected  double yRange
          Y axis range.
protected  double yScale
          Y axis scale factor.
protected  double ySizeRatio
          Y axis size ratio, i.e.; (Y axis width in pixels)/256.
 
Fields inherited from class vis.beans.plotter.Viewport
destGc, destImage, height, offScrGc, offScrImage, pixImage, plBeanContext, width, xMagFac, xScaleFac, yMagFac, yScaleFac
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PlotViewport()
           
PlotViewport(int wd, int hgt)
          If this class is used as a class library, you can use this constructor.
 
Method Summary
protected abstract  void addGraph(java.lang.Object x, java.lang.Object y)
          This method adds a graph.
 void addLegend(java.awt.Color col, java.lang.String str)
          Adds a legend.
 void createPlotTemplate()
          Creates the plot template.
 void draw()
          This method does the actual drawing.
protected  void drawAxis(java.lang.String xMaxStr, java.lang.String yMaxStr)
          Draws the X and Y axis.
 void drawLegends()
           
 void drawPlot(java.lang.Object x, java.lang.Object y)
          Draws the plot.
protected  void drawXLabel()
          Draws the X axis title.
protected  void drawXTicks(java.lang.Object minmax)
          Draws X ticks.
protected  void drawYLabel(java.lang.String yMaxStr)
          Draws the Y axis title.
protected  void drawYTicks(java.lang.Object minmax)
          Draws Y ticks.
 int[] getBorderULHC()
           
 int getBorderULHC(int index)
           
 java.lang.Class getCustomizerClass()
           
 java.awt.Color getGraphColor()
           
 java.awt.Color getGraphColors(int i)
           
 java.lang.String getGraphTitle()
           
 int getLegendGapIncr()
           
 boolean getLegendOn()
           
 int[] getLegendPos()
           
 int getLegendPos(int index)
           
 int getLegendPosXIncr()
           
 int getLegendPosYIncr()
           
 int getMaxGraphs()
           
 java.awt.Dimension getMinimumSize()
           
 int getNumSmallXTicks()
           
 int getNumSmallYTicks()
           
 int getNumXTicks()
           
 int getNumYTicks()
           
 int getOriginXIncr()
           
 int getOriginYIncr()
           
 java.lang.String getTitleString()
           
 int getXLabelsPerTick()
           
 java.lang.String getXLabelString()
           
 int[] getXMinmax()
           
 java.lang.Object getXMinmaxObj()
           
 int getYLabelsPerTick()
           
 java.lang.String getYLabelString()
           
 int[] getYMinmax()
           
 java.lang.Object getYMinmaxObj()
           
protected  void launchCustomizer(java.lang.Class cl)
           
static java.lang.String launchFileDialog()
           
abstract  void paintGraphs()
          Paints all the graphs.
protected  void popupMenu(int x, int y)
           
 int print(java.awt.Graphics g, java.awt.print.PageFormat f, int pageIndex)
           
protected  void printPlot()
           
protected  void processMouseEvent(java.awt.event.MouseEvent e)
           
 void resetPlotViewport()
          Resets the plot viewport.
static java.lang.String saveAsJPEG(java.awt.image.BufferedImage bi)
           
 void setBackground(java.awt.Color clr)
          Sets the background color.
 void setBorderULHC(int[] br)
          Sets the upper left hand corner coordinate(ULHC) of the plot border.
 void setBorderULHC(int index, int xy)
          Sets one of the border ULHC coordinate which is an indexed property.
 void setCustomizerClass(java.lang.Class cl)
          Sets the customizer class.
 void setFont(java.awt.Font fnt)
          Sets the font.
 void setForeground(java.awt.Color clr)
          Sets the foreground color.
 void setGraphColor(java.awt.Color col)
          Sets the graph color.
 void setGraphColors(java.awt.Color col, int i)
           
 void setGraphTitle(java.lang.String grTitle)
          Sets the graph title.
 void setLegendGapIncr(int incr)
          Sets the legend gap increment.
 void setLegendOn(boolean onOff)
          Sets the legend visibility on or of.
 void setLegendPos(int[] pt)
          Sets the legend position which is an indexed property.
 void setLegendPos(int index, int xy)
          Sets the legend position which is an indexed property.
 void setLegendPosXIncr(int incr)
          Sets the legend position increment in the X direction.
 void setLegendPosYIncr(int num)
          Sets the legend position increment in the Y direction.
 void setMaxGraphs(int num)
          Sets the max number of graphs
 void setNumSmallXTicks(int num)
          Sets the number of small X axis ticks.
 void setNumSmallYTicks(int num)
          Sets the number of small Y ticks between two big ticks.
 void setNumXTicks(int num)
          Sets the number of big X axis ticks.
 void setNumYTicks(int num)
          Sets the number of big Y axis ticks.
 void setOriginXIncr(int incr)
          Sets the origin increment in the X direction.
 void setOriginYIncr(int num)
          Sets the origin increment in the Y direction.
protected  void setParams()
          Sets the drawing parameters.
 void setTitleString(java.lang.String title)
          Sets the plot title.
 void setWidHt(int wd, int hgt)
          Sets width and height.
 void setXLabelsPerTick(int num)
          Sets the number of big X axis ticks between labels.
 void setXLabelString(java.lang.String xlab)
          Sets the X axis title.
 void setXMinmax(int[] minmax)
          Sets the range of X axis values.
 void setXMinmaxObj(java.lang.Object xmin)
          Sets the X axis min and max values.
 void setYLabelsPerTick(int num)
          Sets the number of big Y axis ticks between labels.
 void setYLabelString(java.lang.String ylab)
          Sets Y axis title.
 void setYMinmax(int[] minmax)
          Sets the Y range.
 void setYMinmaxObj(java.lang.Object ymin)
          Sets the Y axis min and max values.
 
Methods inherited from class vis.beans.plotter.Viewport
addPropertyChangeListener, addVetoableChangeListener, createOffScrImage, getBeanContext, imagePaint, invokePrinterService, invokeSaveImageService, paintComponent, removePropertyChangeListener, removeVetoableChangeListener, serviceAvailable, serviceRevoked, setBeanContext, setOffScrGc
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, 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

AUTO

public static final int AUTO

border

protected java.awt.Point border

orig

protected java.awt.Point orig
Origin of the graph

headerPt

protected java.awt.Point headerPt
Position of the title.

headerHt

protected int headerHt
Hieght of the header.

xScale

protected double xScale
X axis scale factor.

yScale

protected double yScale
Y axis scale factor.

xRange

protected double xRange
X axis range of values i.e.; max - min.

yRange

protected double yRange
Y axis range.

legBoxSize

protected int legBoxSize
Size of the legend box.

legPt

protected java.awt.Point legPt
Absolute legend position, i.e.; legendPos+incr.

x

protected java.lang.Object x
Object that holds an array of X axis values. The array type can be of any Java primitive type or String.

y

protected java.lang.Object y
Object that holds an array of Y axis values. The array type can be of any Java primitive type.

enableDraw

protected boolean enableDraw
Flag that indicates whether to redraw the plot.

tickGap

protected double tickGap
Gap between X axis ticks in pixels.

xTickPt

protected int[] xTickPt
Array that holds the values corresponding to the X axis ticks(big).

titleString

protected java.lang.String titleString
Plot title.

xLabelString

protected java.lang.String xLabelString
X axis title.

yLabelString

protected java.lang.String yLabelString
Y axis title.

xLabel

protected java.awt.Point xLabel
Position of the X axis title.

yLabel

protected java.awt.Point yLabel
Position of the Y axis title.

maxGraphs

protected int maxGraphs
Maximum number of graphs.

graphColor

protected java.awt.Color graphColor
Current graph color.

xMinmax

protected int[] xMinmax
Range of X values as an array of int.

yMinmax

protected int[] yMinmax
Range of Y values as an array of int.

font

protected java.awt.Font font
Font.

pFont

protected java.awt.FontMetrics pFont
Font metrics.

fontSize

protected int fontSize
Font size.

xSizeRatio

protected double xSizeRatio
X axis size ratio, i.e.; (X axis width in pixels)/256.

ySizeRatio

protected double ySizeRatio
Y axis size ratio, i.e.; (Y axis width in pixels)/256.

graphWid

protected int graphWid
Width and height of the graph.

graphHt

protected int graphHt
Width and height of the graph.

graphNum

protected int graphNum
Current graph number.

numXTicks

protected int numXTicks
Number of x ticks.

numYTicks

protected int numYTicks
Number of y ticks.

numSmallXTicks

protected int numSmallXTicks
Number of small x ticks.

numSmallYTicks

protected int numSmallYTicks
Number of small y ticks.

tickLen

protected int tickLen
Tick length.

graphTitle

protected java.lang.String graphTitle
Graph title.

xTextValues

protected java.lang.String[] xTextValues
X axis string values.

legendOn

protected boolean legendOn
Legend on or off. The default value is false.

xLabelsPerTick

protected int xLabelsPerTick
Interval between two X axis labels in terms of nummer of big X ticks. The default value is set to 1.

yLabelsPerTick

protected int yLabelsPerTick
Interval between two Y axis labels in terms of nummer of big Y ticks. The default value is set to 1.

borderULHC

protected int[] borderULHC
Upper left hand corner coordinate of the border.

legendPos

protected int[] legendPos
Legend position.

legendPosXIncr

protected int legendPosXIncr
Legend position increment in X direction.

legendPosYIncr

protected int legendPosYIncr
Legend position increment in Y direction.

legendGap

protected int legendGap
The legend gap.

legendGapIncr

protected int legendGapIncr
Legend gap increment.

legendColor

protected java.util.Vector legendColor

legendString

protected java.util.Vector legendString

originXIncr

protected int originXIncr
Origin increment in X direction.

originYIncr

protected int originYIncr
Origin increment in Y direction.

customizerClass

protected java.lang.Class customizerClass

graphColors

public java.awt.Color[] graphColors
Constructor Detail

PlotViewport

public PlotViewport()

PlotViewport

public PlotViewport(int wd,
                    int hgt)
If this class is used as a class library, you can use this constructor.
Parameters:
wd - the width.
hgt - the height.
Method Detail

setWidHt

public void setWidHt(int wd,
                     int hgt)
Sets width and height.
Overrides:
setWidHt in class Viewport
Following copied from class: vis.beans.plotter.Viewport
Parameters:
wd - the width of the viewport.
ht - the height of the viewport.

setParams

protected void setParams()
Sets the drawing parameters.

createPlotTemplate

public void createPlotTemplate()
Creates the plot template. This includes drawing the border and the plot title.

setBackground

public void setBackground(java.awt.Color clr)
Sets the background color.
Overrides:
setBackground in class javax.swing.JComponent
Parameters:
clr - the color.

setForeground

public void setForeground(java.awt.Color clr)
Sets the foreground color.
Overrides:
setForeground in class javax.swing.JComponent
Parameters:
clr - the color.

setTitleString

public void setTitleString(java.lang.String title)
Sets the plot title.
Parameters:
title - the plot title.

getTitleString

public java.lang.String getTitleString()
Returns:
the plot title.

setXLabelString

public void setXLabelString(java.lang.String xlab)
Sets the X axis title.
Parameters:
xlab - the X axis title.

getXLabelString

public java.lang.String getXLabelString()
Returns:
the X axis title.

setYLabelString

public void setYLabelString(java.lang.String ylab)
Sets Y axis title.
Parameters:
y - axis title.

getYLabelString

public java.lang.String getYLabelString()
Returns:
the Y axis title.

setNumYTicks

public void setNumYTicks(int num)
Sets the number of big Y axis ticks.
Parameters:
num - the number of big Y axis ticks.

getNumYTicks

public int getNumYTicks()
Returns:
the number of big Y axis ticks.

setNumSmallYTicks

public void setNumSmallYTicks(int num)
Sets the number of small Y ticks between two big ticks.
Parameters:
num - number of small y ticks.

getNumSmallYTicks

public int getNumSmallYTicks()
Returns:
the number of small Y axis ticks.

setNumXTicks

public void setNumXTicks(int num)
Sets the number of big X axis ticks.
Parameters:
num - the number of big X axis ticks.

getNumXTicks

public int getNumXTicks()
Returns:
the number of big X axis ticks.

setNumSmallXTicks

public void setNumSmallXTicks(int num)
Sets the number of small X axis ticks.
Parameters:
num - the number of small x axis ticks between two big ticks.

getNumSmallXTicks

public int getNumSmallXTicks()
Returns:
the number of small X ticks.

setGraphTitle

public void setGraphTitle(java.lang.String grTitle)
Sets the graph title.
Parameters:
grTitle - the graph title.

getGraphTitle

public java.lang.String getGraphTitle()
Returns:
the graph title.

setLegendOn

public void setLegendOn(boolean onOff)
Sets the legend visibility on or of.
Parameters:
onOff - the legend is on or off.

getLegendOn

public boolean getLegendOn()
Returns:
the legend on property.

setFont

public void setFont(java.awt.Font fnt)
Sets the font.
Overrides:
setFont in class javax.swing.JComponent
Parameters:
fnt - the font.

setMaxGraphs

public void setMaxGraphs(int num)
Sets the max number of graphs
Parameters:
num - the maximum number of graphs.

getMaxGraphs

public int getMaxGraphs()
Returns:
the maximum number of graphs.

setGraphColor

public void setGraphColor(java.awt.Color col)
Sets the graph color.
Parameters:
col - the graph color.

getGraphColor

public java.awt.Color getGraphColor()
Returns:
the graph color.

setXMinmax

public void setXMinmax(int[] minmax)
Sets the range of X axis values.
Parameters:
minmax - an array of size 2. minmax[0] holds minimum value. minmax[1] holds maximum value.

getXMinmax

public int[] getXMinmax()
Returns:
the range of x axis values.

setYMinmax

public void setYMinmax(int[] minmax)
Sets the Y range.
Parameters:
minmax - an array of size 2. minmax[0] holds minimum value. minmax[1] holds maximum value.

getYMinmax

public int[] getYMinmax()
Returns:
the range of Y axis values.

setXMinmaxObj

public void setXMinmaxObj(java.lang.Object xmin)
Sets the X axis min and max values.
Parameters:
xmin - an array of of size two that holds X axis min and max values. The type of these values can be any of the Java primitive data type or String.

getXMinmaxObj

public java.lang.Object getXMinmaxObj()
Returns:
an array of X axis min and max values.

setYMinmaxObj

public void setYMinmaxObj(java.lang.Object ymin)
Sets the Y axis min and max values.
Parameters:
xmin - an array of of size two that holds Y axis min and max values. The type of these values can be any of the Java primitive data type or String.

getYMinmaxObj

public java.lang.Object getYMinmaxObj()
Returns:
an array of Y axis min and max values.

setXLabelsPerTick

public void setXLabelsPerTick(int num)
Sets the number of big X axis ticks between labels. If the tick lables overlap or too far apart, users can modify this property to display labels at certain intervals.
Parameters:
num - the number of big ticks between labels.

getXLabelsPerTick

public int getXLabelsPerTick()
Returns:
the big X axis ticks between labels.

setYLabelsPerTick

public void setYLabelsPerTick(int num)
Sets the number of big Y axis ticks between labels. If the tick lables overlap or too far apart, users can modify this property to display labels at certain intervals.
Parameters:
num - the number of big ticks between labels.

getYLabelsPerTick

public int getYLabelsPerTick()
Returns:
the big Y axis ticks between labels.

setBorderULHC

public void setBorderULHC(int[] br)
Sets the upper left hand corner coordinate(ULHC) of the plot border. This is an indexed property.
Parameters:
br - an array of size two that holds the x and y coordinates of upper left hand corner of the border.

getBorderULHC

public int[] getBorderULHC()
Returns:
the upper left hand coordinate of the plot border.

setBorderULHC

public void setBorderULHC(int index,
                          int xy)
Sets one of the border ULHC coordinate which is an indexed property.
Parameters:
index - the index of the borderULHC index property.
xy - the value corresponding to the index.

getBorderULHC

public int getBorderULHC(int index)
Parameters:
index - the index of the borderULHC property. It can be 0 or 1.
Returns:
the value at a given index.

setLegendPos

public void setLegendPos(int[] pt)
Sets the legend position which is an indexed property.
Parameters:
br - an array of size two that holds the x and y coordinates of upper left hand corner of the border.

setLegendPos

public void setLegendPos(int index,
                         int xy)
Sets the legend position which is an indexed property.
Parameters:
index - the index of the borderULHC index property.
xy - the value corresponding to the index.

getLegendPos

public int[] getLegendPos()
Returns:
an array of int which is hold the X and Y coordinates of the legend position.

getLegendPos

public int getLegendPos(int index)
Parameters:
index - the index of the array.
Returns:
an element of the legend position index property.

setLegendPosXIncr

public void setLegendPosXIncr(int incr)
Sets the legend position increment in the X direction.
Parameters:
incr - the increment.

getLegendPosXIncr

public int getLegendPosXIncr()
Returns:
the legend position x increment.

setLegendPosYIncr

public void setLegendPosYIncr(int num)
Sets the legend position increment in the Y direction.
Parameters:
incr - the increment.

getLegendPosYIncr

public int getLegendPosYIncr()
Returns:
the legend position y increment.

setOriginXIncr

public void setOriginXIncr(int incr)
Sets the origin increment in the X direction.
Parameters:
incr - the increment.

getOriginXIncr

public int getOriginXIncr()
Returns:
the origin x increment.

setOriginYIncr

public void setOriginYIncr(int num)
Sets the origin increment in the Y direction.
Parameters:
incr - the increment.

getOriginYIncr

public int getOriginYIncr()
Returns:
the origin y increment.

setLegendGapIncr

public void setLegendGapIncr(int incr)
Sets the legend gap increment.
Parameters:
incr - the increment.

getLegendGapIncr

public int getLegendGapIncr()
Returns:
the legend gap increment.

getMinimumSize

public java.awt.Dimension getMinimumSize()
Overrides:
getMinimumSize in class javax.swing.JComponent

getCustomizerClass

public java.lang.Class getCustomizerClass()
Returns:
the customizer class.

setCustomizerClass

public void setCustomizerClass(java.lang.Class cl)
Sets the customizer class.
Parameters:
the - customizer class.

setGraphColors

public void setGraphColors(java.awt.Color col,
                           int i)

getGraphColors

public java.awt.Color getGraphColors(int i)

addGraph

protected abstract void addGraph(java.lang.Object x,
                                 java.lang.Object y)
This method adds a graph.
Parameters:
x - the x axis values as an array of primitive data types or String.
y - the y axis values as an array of primitive data types.

paintGraphs

public abstract void paintGraphs()
Paints all the graphs. This method is called by draw() to paint the actual plots.

drawPlot

public void drawPlot(java.lang.Object x,
                     java.lang.Object y)
Draws the plot. Currently, only the Auto mode is implemented. This method computes the minimum and maximum values from the x and y inputs. Once these are computed, it calls draw(). Before calling draw(), it sets the enableDraw to true. The enableDraw flag makes sure that the draw() method is called only after the executing drawPlot(). The draw() method is called by many property setter methods to reflect the change.
Parameters:
x - the x axis values as an array of primitive data types or String.
y - the y axis values as an array of primitive data types.

draw

public void draw()
This method does the actual drawing. In addition to being called by drawPlot(), this method is called by many setter methods so as to reflect a change in property. draw() calls methods calls methods to create a new plot temeplate, draw X and Y axes, ticks and lables. Some of these methods are ovverriden by sub classes.
Overrides:
draw in class Viewport

drawAxis

protected void drawAxis(java.lang.String xMaxStr,
                        java.lang.String yMaxStr)
Draws the X and Y axis. The origin is adjusted such that there is enough room for the widest Y axis tick label and last X axis tick label.
Parameters:
xMaxStr - the X axis tick label on extreme right.
yMaxStr - the longest Y axis tick lable.

drawXLabel

protected void drawXLabel()
Draws the X axis title. The title is centered w.r.t the X axis. If the title string width is longer than the X axis, it is truncated.

drawYLabel

protected void drawYLabel(java.lang.String yMaxStr)
Draws the Y axis title. The letters are drawn one below the other. If the lenght exceeds the Y axis, the title is trucated.

drawXTicks

protected void drawXTicks(java.lang.Object minmax)
Draws X ticks.
Parameters:
minmax - an array of size two that holds the X axis minimun maximum value.

drawYTicks

protected void drawYTicks(java.lang.Object minmax)
Draws Y ticks.
Parameters:
minmax - an array of size two that holds the Y axis minimun maximum value.

addLegend

public void addLegend(java.awt.Color col,
                      java.lang.String str)
Adds a legend.
Parameters:
col - the color of the legend box.
str - the legend string.

drawLegends

public void drawLegends()

resetPlotViewport

public void resetPlotViewport()
Resets the plot viewport.

processMouseEvent

protected void processMouseEvent(java.awt.event.MouseEvent e)
Overrides:
processMouseEvent in class java.awt.Component

print

public int print(java.awt.Graphics g,
                 java.awt.print.PageFormat f,
                 int pageIndex)
Specified by:
print in interface java.awt.print.Printable

popupMenu

protected void popupMenu(int x,
                         int y)

printPlot

protected void printPlot()

saveAsJPEG

public static java.lang.String saveAsJPEG(java.awt.image.BufferedImage bi)

launchFileDialog

public static java.lang.String launchFileDialog()

launchCustomizer

protected void launchCustomizer(java.lang.Class cl)
                         throws java.lang.InstantiationException,
                                java.lang.IllegalAccessException