public class ScatterPlot extends Graph implements java.awt.event.MouseMotionListener, java.io.Serializable
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
ABOVE, BELOW, HORIZONTAL, LEFT, RIGHT, showModelDistribution, VERTICAL
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
ScatterPlot()
This default constructor creates a new scatterplot with common domain
[0, 1] and default names "x" and "y"
|
ScatterPlot(Domain d)
This special constructor creates a new scatterplot with a specified common
domain and default names "x" and "y".
|
ScatterPlot(Domain d1,
Domain d2)
This special constructor creates a new scatterplot with specified domains and
default names "x" and "y".
|
ScatterPlot(Domain d1,
java.lang.String n1,
Domain d2,
java.lang.String n2)
This general constructor creates a new scatterplot with specified domains
and names.
|
ScatterPlot(Domain d,
java.lang.String n1,
java.lang.String n2)
This special constructor creates a new scatterplot with a specified common x and y
domain and specified names.
|
Modifier and Type | Method and Description |
---|---|
void |
addPoint()
This method adds a random data point of default color red to the dataset.
|
void |
addPoint(java.awt.Color c)
This method adds a random data point of a specified color to the dataset.
|
void |
addPoint(double x,
double y)
This method adds a specified data point of default color red to the dataset.
|
void |
addPoint(double x,
double y,
java.awt.Color c)
This method adds a specified data point of a specified color to the dataset.
|
java.awt.Color |
getBoxColor()
This method returns the box color.
|
java.awt.Color |
getColor(int i)
This method gets the color of the point with a specified index.
|
java.util.Vector |
getColors()
This method returns the vector of colors.
|
int |
getDataSize()
This method returns the number of data points.
|
double |
getX(int i)
This method gets the x-coordinate of the point with a specified index.
|
java.awt.Color |
getXAxisColor()
This method returns the x-axix color.
|
java.util.Vector |
getXCoordinates()
This method returns the vector of x coordinates.
|
Domain |
getXDomain()
This method returns the domain of the x variable.
|
java.lang.String |
getXName()
This method returns the name of the x variable.
|
double |
getY(int i)
This method gets the y-coordinate of the point with a specified index.
|
java.awt.Color |
getYAxisColor()
This method returns the y-axis color.
|
java.util.Vector |
getYCoordinates()
This method returns the vector of y coordinates.
|
Domain |
getYDomain()
This method returns the domain of the y variable.
|
java.lang.String |
getYName()
This method returns the name of the y variable.
|
void |
mouseDragged(java.awt.event.MouseEvent event) |
void |
mouseMoved(java.awt.event.MouseEvent e)
This method handles the mouse move event.
|
void |
paintComponent(java.awt.Graphics g)
This method paints the scatterplots, including the x and y axes and the boundary
box.
|
void |
reset()
This method resets the scatterplot by clearing the data and redrawing.
|
void |
resetData()
This method resets the data by clearing the vectors of x coordinates,
y coordinates, and colors.
|
void |
setBoxColor(java.awt.Color c)
This method sets the box color.
|
void |
setDomain(Domain d)
This method sets the common domain for x and y.
|
void |
setDomains(Domain d1,
Domain d2)
This method sets the domains.
|
void |
setNames(java.lang.String n1,
java.lang.String n2)
This method sets the names of the varaibles.
|
void |
setXAxisColor(java.awt.Color c)
This method sets the x-axis color.
|
void |
setXDomain(Domain d)
This method sets the domain of the x variable.
|
void |
setXName(java.lang.String n)
This method sets the name of the x variable.
|
void |
setYAxisColor(java.awt.Color c)
This method sets the y-axis color.
|
void |
setYDomain(Domain d)
This method sets the domain of the y variable.
|
void |
setYName(java.lang.String n)
This method sets the name of the y variable
|
drawAxis, drawAxis, drawAxis, drawBox, drawBox, drawBoxPlot, drawBoxPlot, drawCircle, drawLabel, drawLine, drawPoint, drawTick, drawTick, fillBox, fillBox, fillBoxPlot, fillBoxPlot, fillCircle, format, getBottomMargin, getLeftMargin, getPointSize, getRightMargin, getTopMargin, getXGraph, getXMax, getXMin, getXPixels, getXScale, getYGraph, getYMax, getYMin, getYPixels, getYScale, setMargins, setPointSize, setScale, setShowModelDistribution
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public ScatterPlot(Domain d1, java.lang.String n1, Domain d2, java.lang.String n2)
d1
- the domain of the x variablen1
- the name of the x variabled2
- the domain of the y variablen2
- the name of the y variablepublic ScatterPlot(Domain d1, Domain d2)
d1
- the domain of the x variabled2
- the domain of the y variablepublic ScatterPlot(Domain d, java.lang.String n1, java.lang.String n2)
d
- the common domain of the x and y variablesn1
- the name of the x variablen2
- the name of the y variablepublic ScatterPlot(Domain d)
d
- the common domain of the x and y variablespublic ScatterPlot()
public void setDomains(Domain d1, Domain d2)
d1
- the domain of the x variabled2
- the domain of the y variablepublic void setDomain(Domain d)
d
- the common domain of the x and y variablespublic void setXDomain(Domain d)
d
- the domain of the x variable.public Domain getXDomain()
public void setYDomain(Domain d)
d
- the domain of the y variablepublic Domain getYDomain()
public void setNames(java.lang.String n1, java.lang.String n2)
n1
- the name of the x variablen2
- the name of the y variablepublic void setXName(java.lang.String n)
n
- the name of the x variablepublic java.lang.String getXName()
public void setYName(java.lang.String n)
n
- the name of the y variablepublic java.lang.String getYName()
public void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
g
- the graphics contextpublic void addPoint(double x, double y, java.awt.Color c)
x
- the x coordinate of the pointy
- the y coordiante of the pointpublic void addPoint(double x, double y)
x
- the x coordinate of the pointy
- the y coordiante of the pointpublic void addPoint(java.awt.Color c)
public void addPoint()
public double getX(int i)
i
- the index of the pointpublic java.util.Vector getXCoordinates()
public double getY(int i)
i
- the index of the pointpublic java.util.Vector getYCoordinates()
public java.awt.Color getColor(int i)
i
- the index of the pointpublic java.util.Vector getColors()
public void resetData()
public void reset()
public int getDataSize()
public void setXAxisColor(java.awt.Color c)
c
- the x-axis colorpublic java.awt.Color getXAxisColor()
public void setYAxisColor(java.awt.Color c)
c
- the y-axis colorpublic java.awt.Color getYAxisColor()
public void setBoxColor(java.awt.Color c)
c
- the box colorpublic java.awt.Color getBoxColor()
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
e
- the mouse eventpublic void mouseDragged(java.awt.event.MouseEvent event)
mouseDragged
in interface java.awt.event.MouseMotionListener