Package org.opensourcephysics.tools
Class DataToolTab.DataToolPlotter
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.opensourcephysics.display.DrawingPanel
org.opensourcephysics.display.InteractivePanel
org.opensourcephysics.display.PlottingPanel
org.opensourcephysics.tools.DataToolTab.DataToolPlotter
- All Implemented Interfaces:
ActionListener
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
,InteractiveMouseHandler
,OSPRuntime.Disposable
,Renderable
- Enclosing class:
- DataToolTab
A class to plot datasets, value crossbars, slope lines, areas, and axes.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
An inner class to draw crossbars on the measured point.protected class
An inner class that draws a vertical limit line for areas.protected class
An inner CoordinateStringBuilder class that uses datatable formats.protected class
An inner class for selecting points on this plot.protected class
An inner class to draw a slope line on the measured point.protected class
An inner class that draws coordinate axes on the plot.Nested classes/interfaces inherited from class org.opensourcephysics.display.InteractivePanel
InteractivePanel.IADMouseController
Nested classes/interfaces inherited from class org.opensourcephysics.display.DrawingPanel
DrawingPanel.PopupmenuListener, DrawingPanel.ZoomBox
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
Fields inherited from class org.opensourcephysics.display.PlottingPanel
axes, id, log10, logBase10Function
Fields inherited from class org.opensourcephysics.display.InteractivePanel
containsInteractive, MOUSE_CLICKED, MOUSE_DRAGGED, MOUSE_ENTERED, MOUSE_EXITED, MOUSE_MOVED, MOUSE_PRESSED, MOUSE_RELEASED, mouseAction, mouseEvent
Fields inherited from class org.opensourcephysics.display.DrawingPanel
adjustableGutter, antialiasShapeOn, antialiasTextOn, autoscaleItem, autoscaleMargin, autoscaleX, autoscaleXMax, autoscaleXMin, autoscaleY, autoscaleYMax, autoscaleYMin, bgColor, BOTTOM_LEFT, BOTTOM_RIGHT, bottomGutter, bottomGutterPreferred, clipAtGutter, coordinateStrBuilder, currentTime, customInspector, decimalFormat, dimensionSetter, displayCoordsOnMouseMoved, drawableList, dxmax, dxmin, dymax, dymin, enableZoom, fixedPixelPerUnit, fixedScale, guiChangeListener, imageRatio, isDisposed, isInteractive, lastHeight, lastWidth, leftGutter, leftGutterPreferred, logScaleX, logScaleY, messages, messagesAsJLabels, mouseController, offscreenImage, optionController, paintDrawables, pixelMatrix, pixelTransform, popupmenu, propertiesItem, RECORD_PAINT_TIMES, refreshDelay, refreshTimer, rightGutter, rightGutterPreferred, scaleItem, scientificFormat, showCoordinates, snapshotItem, squareAspect, TOP_LEFT, TOP_RIGHT, topGutter, topGutterPreferred, vidCap, viewRect, workingImage, xceil, xfloor, xLeftMarginPercentage, xmax, xmaxPreferred, xmin, xminPreferred, xPixPerUnit, xRightMarginPercentage, yBottomMarginPercentage, yceil, yfloor, ymax, ymaxPreferred, ymin, yminPreferred, yPixPerUnit, yTopMarginPercentage, zoomBox, zoomCount, zoomDelay, zoomInItem, zoomOutItem, zoomTimer
Fields inherited from class javax.swing.JComponent
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
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Fields inherited from interface org.opensourcephysics.display.OSPRuntime.Disposable
allocated
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected String
Creates a message showing the current coordinates, slope and/or area.protected int
findIndexNearestX
(double x, Dataset data) Returns the index of the data point nearest the specified x on the plot.protected String
format
(double value, double range) Formats a number.Gets the interactive drawable that was accessed by the last mouse event.protected MouseInputAdapter
Gets the mouse controller.boolean
Returns true if an event starts or ends a zoom operation.protected void
lockScale
(boolean lock) Locks the scale so it can be manipulated when shifting the origin.protected void
paintDrawableList
(Graphics g, ArrayList<Drawable> tempList) Paints all the drawable objects in the panel.protected void
Fills the areaDataset with points whose x values are between the limit lines.protected void
Refreshes the decimal separators.protected void
Refreshes the coordinate, slope and area measurements.protected void
Sets axis scales if autoscale is true using the max and min values of the objects in the given list.protected void
setAreaVisible
(boolean visible) Sets the visibility of the area limits and dataset.protected void
setAxisLabels
(String xAxis, String yAxis) Sets the plot axis and related labels.Methods inherited from class org.opensourcephysics.display.PlottingPanel
computeGutters, getAxes, getBottomGutter, getLoader, getTopGutter, initAxes, paintFirst, pixToX, pixToY, setAxes, setAxesVisible, setCartesian, setLogScale, setLogScaleX, setLogScaleY, setPixelScale, setPolar, setTitle, setTitle, setXLabel, setXLabel, setYLabel, setYLabel, xToGraphics, xToPix, yToGraphics, yToPix
Methods inherited from class org.opensourcephysics.display.InteractivePanel
addDrawable, clear, dispose, getCurrentDraggable, getMouseAction, getMouseButton, getMouseClickCount, getMouseIntX, getMouseIntY, getMouseX, getMouseY, handleMouseAction, saveMouseEvent, scaleX, scaleY, setInteractiveMouseHandler, setMouseListeners, setShowCoordinates
Methods inherited from class org.opensourcephysics.display.DrawingPanel
actionPerformed, addDrawableAtIndex, addDrawables, addMessageLabel, addOptionController, buildPopupMenu, checkWorkingImage, displayCoordinates, dref, enableInspector, findViewRect, firePropertyChange, getAspectRatio, getCoordinateStringBuilder, getDimensionSetter, getDrawables, getDrawables, getDrawables, getDrawablesExcept, getDrawablesExcept, getDrawablesNoClone, getFirstDrawable, getGlassPane, getGutters, getHeight, getImageRatio, getLeftGutter, getMaxPixPerUnit, getMeasure, getObjectOfClass, getPixelMatrix, getPixelTransform, getPixelTransform, getPopupMenu, getPreferredXMax, getPreferredXMin, getPreferredYMax, getPreferredYMin, getRightGutter, getScale, getSnapshotItem, getVideoTool, getViewRect, getWidth, getXMax, getXMin, getXPixPerUnit, getYMax, getYMin, getYPixPerUnit, getZoomBox, hasInspector, hideInspector, invalidateImage, isAdjustableGutter, isAntialiasShapeOn, isAntialiasTextOn, isAutoscaleX, isAutoscaleXMax, isAutoscaleXMin, isAutoscaleY, isAutoscaleYMax, isAutoscaleYMin, isBuffered, isClipAtGutter, isFixedScale, isIconified, isLogScaleX, isLogScaleY, isPointInside, isShowCoordinates, isSquareAspect, isValidImage, isZoom, limitAutoscaleX, limitAutoscaleY, measure, paint, paintComponent, paintEverything, paintLast, project, receiveToolReply, recomputeTransform, refreshGUI, removeDrawable, removeDrawables, removeObjectsOfClass, removeOptionController, render, render, repaint, repaint, repaintForZoom, repaintIfNecessary, replaceDrawable, resetGutters, scale, scaleX, scaleY, setAdjustableGutter, setAntialiasShapeOn, setAntialiasTextOn, setAutoscaleMargin, setAutoscaleX, setAutoscaleY, setBounds, setBounds, setBuffered, setClipAtGutter, setCoordinateStringBuilder, setCustomInspector, setFixedScale, setFontFactor, setFontLevel, setGutters, setGutters, setMessage, setMessage, setMouseCursor, setPaintDrawables, setPixelsPerUnit, setPopupMenu, setPreferredGutters, setPreferredMinMax, setPreferredMinMax, setPreferredMinMaxX, setPreferredMinMaxY, setSquareAspect, setVideoTool, setVisible, setXLeftMarginPercentage, setXMarginPercentage, setXMarginPercentage, setXRightMarginPercentage, setYBottomMarginPercentage, setYMarginPercentage, setYMarginPercentage, setYTopMarginPercentage, setZoom, showInspector, snapshot, transformPath, transformShape, validateImage, zoomIn, zoomOut
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
Methods inherited from class javax.swing.JComponent
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, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, 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, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
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
Methods inherited from class java.awt.Component
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, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Constructor Details
-
DataToolPlotter
Constructor- Parameters:
dataset
- the initial dataset to plot
-
-
Method Details
-
isZoomEvent
Description copied from class:DrawingPanel
Returns true if an event starts or ends a zoom operation. Used by OptionController. Method added by D Brown 04 Nov 2011.- Overrides:
isZoomEvent
in classDrawingPanel
- Parameters:
e
- a mouse event- Returns:
- true if a zoom event
-
getInteractive
Description copied from class:PlottingPanel
Gets the interactive drawable that was accessed by the last mouse event. This methods overrides the default implemenation in order to check for draggable axes.- Overrides:
getInteractive
in classPlottingPanel
- Returns:
- the interactive object
-
refreshDecimalSeparators
protected void refreshDecimalSeparators()Description copied from class:DrawingPanel
Refreshes the decimal separators.- Overrides:
refreshDecimalSeparators
in classDrawingPanel
-
lockScale
protected void lockScale(boolean lock) Locks the scale so it can be manipulated when shifting the origin.- Parameters:
lock
- true to lock, false to unlock
-
scale
Description copied from class:DrawingPanel
Sets axis scales if autoscale is true using the max and min values of the objects in the given list.- Overrides:
scale
in classDrawingPanel
-
paintDrawableList
Description copied from class:DrawingPanel
Paints all the drawable objects in the panel.- Overrides:
paintDrawableList
in classDrawingPanel
-
setAreaVisible
protected void setAreaVisible(boolean visible) Sets the visibility of the area limits and dataset.- Parameters:
visible
- true to show the area
-
refreshMeasurements
protected void refreshMeasurements()Refreshes the coordinate, slope and area measurements. -
refreshArea
protected void refreshArea()Fills the areaDataset with points whose x values are between the limit lines. -
findIndexNearestX
Returns the index of the data point nearest the specified x on the plot.- Parameters:
x
- the x-value on the plotdata
- the dataset to search- Returns:
- the index, or -1 if none found
-
createMessage
Creates a message showing the current coordinates, slope and/or area. -
format
Formats a number.- Parameters:
value
- the numberrange
- a min-max range of values- Returns:
- the formatted string
-
setAxisLabels
Sets the plot axis and related labels.- Parameters:
xAxis
- the x-axis labelyAxis
- the y-axis label
-
getMouseController
Gets the mouse controller.- Returns:
- the current mouse controller
-