|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--vis.beans.plotter.Viewport | +--vis.beans.plotter.PlotViewport
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.
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 |
public static final int AUTO
protected java.awt.Point border
protected java.awt.Point orig
protected java.awt.Point headerPt
protected int headerHt
protected double xScale
protected double yScale
protected double xRange
protected double yRange
protected int legBoxSize
protected java.awt.Point legPt
protected java.lang.Object x
protected java.lang.Object y
protected boolean enableDraw
protected double tickGap
protected int[] xTickPt
protected java.lang.String titleString
protected java.lang.String xLabelString
protected java.lang.String yLabelString
protected java.awt.Point xLabel
protected java.awt.Point yLabel
protected int maxGraphs
protected java.awt.Color graphColor
protected int[] xMinmax
protected int[] yMinmax
protected java.awt.Font font
protected java.awt.FontMetrics pFont
protected int fontSize
protected double xSizeRatio
protected double ySizeRatio
protected int graphWid
protected int graphHt
protected int graphNum
protected int numXTicks
protected int numYTicks
protected int numSmallXTicks
protected int numSmallYTicks
protected int tickLen
protected java.lang.String graphTitle
protected java.lang.String[] xTextValues
protected boolean legendOn
protected int xLabelsPerTick
protected int yLabelsPerTick
protected int[] borderULHC
protected int[] legendPos
protected int legendPosXIncr
protected int legendPosYIncr
protected int legendGap
protected int legendGapIncr
protected java.util.Vector legendColor
protected java.util.Vector legendString
protected int originXIncr
protected int originYIncr
protected java.lang.Class customizerClass
public java.awt.Color[] graphColors
Constructor Detail |
public PlotViewport()
public PlotViewport(int wd, int hgt)
wd
- the width.hgt
- the height.Method Detail |
public void setWidHt(int wd, int hgt)
setWidHt
in class Viewport
vis.beans.plotter.Viewport
wd
- the width of the viewport.ht
- the height of the viewport.protected void setParams()
public void createPlotTemplate()
public void setBackground(java.awt.Color clr)
setBackground
in class javax.swing.JComponent
clr
- the color.public void setForeground(java.awt.Color clr)
setForeground
in class javax.swing.JComponent
clr
- the color.public void setTitleString(java.lang.String title)
title
- the plot title.public java.lang.String getTitleString()
public void setXLabelString(java.lang.String xlab)
xlab
- the X axis title.public java.lang.String getXLabelString()
public void setYLabelString(java.lang.String ylab)
y
- axis title.public java.lang.String getYLabelString()
public void setNumYTicks(int num)
num
- the number of big Y axis ticks.public int getNumYTicks()
public void setNumSmallYTicks(int num)
num
- number of small y ticks.public int getNumSmallYTicks()
public void setNumXTicks(int num)
num
- the number of big X axis ticks.public int getNumXTicks()
public void setNumSmallXTicks(int num)
num
- the number of small x axis ticks between two big ticks.public int getNumSmallXTicks()
public void setGraphTitle(java.lang.String grTitle)
grTitle
- the graph title.public java.lang.String getGraphTitle()
public void setLegendOn(boolean onOff)
onOff
- the legend is on or off.public boolean getLegendOn()
public void setFont(java.awt.Font fnt)
setFont
in class javax.swing.JComponent
fnt
- the font.public void setMaxGraphs(int num)
num
- the maximum number of graphs.public int getMaxGraphs()
public void setGraphColor(java.awt.Color col)
col
- the graph color.public java.awt.Color getGraphColor()
public void setXMinmax(int[] minmax)
minmax
- an array of size 2. minmax[0] holds minimum value.
minmax[1] holds maximum value.public int[] getXMinmax()
public void setYMinmax(int[] minmax)
minmax
- an array of size 2. minmax[0] holds minimum value.
minmax[1] holds maximum value.public int[] getYMinmax()
public void setXMinmaxObj(java.lang.Object xmin)
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.public java.lang.Object getXMinmaxObj()
public void setYMinmaxObj(java.lang.Object ymin)
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.public java.lang.Object getYMinmaxObj()
public void setXLabelsPerTick(int num)
num
- the number of big ticks between labels.public int getXLabelsPerTick()
public void setYLabelsPerTick(int num)
num
- the number of big ticks between labels.public int getYLabelsPerTick()
public void setBorderULHC(int[] br)
br
- an array of size two that holds
the x and y coordinates of upper left hand corner of the border.public int[] getBorderULHC()
public void setBorderULHC(int index, int xy)
index
- the index of the borderULHC index property.xy
- the value corresponding to the index.public int getBorderULHC(int index)
index
- the index of the borderULHC property. It can be 0 or 1.public void setLegendPos(int[] pt)
br
- an array of size two that holds
the x and y coordinates of upper left hand corner of the border.public void setLegendPos(int index, int xy)
index
- the index of the borderULHC index property.xy
- the value corresponding to the index.public int[] getLegendPos()
public int getLegendPos(int index)
index
- the index of the array.public void setLegendPosXIncr(int incr)
incr
- the increment.public int getLegendPosXIncr()
public void setLegendPosYIncr(int num)
incr
- the increment.public int getLegendPosYIncr()
public void setOriginXIncr(int incr)
incr
- the increment.public int getOriginXIncr()
public void setOriginYIncr(int num)
incr
- the increment.public int getOriginYIncr()
public void setLegendGapIncr(int incr)
incr
- the increment.public int getLegendGapIncr()
public java.awt.Dimension getMinimumSize()
getMinimumSize
in class javax.swing.JComponent
public java.lang.Class getCustomizerClass()
public void setCustomizerClass(java.lang.Class cl)
the
- customizer class.public void setGraphColors(java.awt.Color col, int i)
public java.awt.Color getGraphColors(int i)
protected abstract void addGraph(java.lang.Object x, java.lang.Object y)
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.public abstract void paintGraphs()
public void drawPlot(java.lang.Object x, java.lang.Object y)
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.public void draw()
draw
in class Viewport
protected void drawAxis(java.lang.String xMaxStr, java.lang.String yMaxStr)
xMaxStr
- the X axis tick label on extreme right.yMaxStr
- the longest Y axis tick lable.protected void drawXLabel()
protected void drawYLabel(java.lang.String yMaxStr)
protected void drawXTicks(java.lang.Object minmax)
minmax
- an array of size two that holds the X axis minimun
maximum value.protected void drawYTicks(java.lang.Object minmax)
minmax
- an array of size two that holds the Y axis minimun
maximum value.public void addLegend(java.awt.Color col, java.lang.String str)
col
- the color of the legend box.str
- the legend string.public void drawLegends()
public void resetPlotViewport()
protected void processMouseEvent(java.awt.event.MouseEvent e)
processMouseEvent
in class java.awt.Component
public int print(java.awt.Graphics g, java.awt.print.PageFormat f, int pageIndex)
print
in interface java.awt.print.Printable
protected void popupMenu(int x, int y)
protected void printPlot()
public static java.lang.String saveAsJPEG(java.awt.image.BufferedImage bi)
public static java.lang.String launchFileDialog()
protected void launchCustomizer(java.lang.Class cl) throws java.lang.InstantiationException, java.lang.IllegalAccessException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |