Class LineGraph
Object
UIObject
Widget
Panel
SimplePanel
FocusPanel
AbstractGraph<double[]>
LineGraph
- All Implemented Interfaces:
HasAllDragAndDropHandlers, HasAllFocusHandlers, HasAllGestureHandlers, HasAllKeyHandlers, HasAllMouseHandlers, HasAllTouchHandlers, HasBlurHandlers, HasClickHandlers, HasContextMenuHandlers, HasDoubleClickHandlers, HasDragEndHandlers, HasDragEnterHandlers, HasDragHandlers, HasDragLeaveHandlers, HasDragOverHandlers, HasDragStartHandlers, HasDropHandlers, HasFocusHandlers, HasGestureChangeHandlers, HasGestureEndHandlers, HasGestureStartHandlers, HasKeyDownHandlers, HasKeyPressHandlers, HasKeyUpHandlers, HasMouseDownHandlers, HasMouseMoveHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseUpHandlers, HasMouseWheelHandlers, HasTouchCancelHandlers, HasTouchEndHandlers, HasTouchMoveHandlers, HasTouchStartHandlers, MouseDownHandler, MouseMoveHandler, MouseOutHandler, MouseUpHandler, MouseWheelHandler, TouchEndHandler, TouchMoveHandler, TouchStartHandler, HasAttachHandlers, EventHandler, HasHandlers, EventListener, AcceptsOneWidget, Focusable, HasFocus, HasOneWidget, HasVisibility, HasWidgets, HasWidgets.ForIsWidget, IsWidget, RequiresResize, SourcesClickEvents, SourcesFocusEvents, SourcesKeyboardEvents, SourcesMouseEvents, SourcesMouseWheelEvents, Iterable<Widget>, AbstractGraph.HasLogScaleY, AbstractGraph.Shifter, AbstractGraph.Shifting, AbstractGraph.Zoomer, AbstractGraph.Zooming, BasicTooltipProvider, ContextMenu.Listener, ContextMenu.Provider, Tooltip.Provider
public class LineGraph
extends AbstractGraph<double[]>
implements AbstractGraph.Shifting, AbstractGraph.Zooming, AbstractGraph.HasLogScaleY, BasicTooltipProvider
LineGraph visualizes time series data as one or more line plots inside a
resizable, pannable and zoomable canvas. It extends AbstractGraph<double[]>
and implements interactions for shifting and zooming (Shifting, Zooming),
optional logarithmic y-axis scaling (HasLogScaleY) and provides tooltips
(BasicTooltipProvider).
Concepts and data layout:
- Each element stored in the internal RingBuffer is a double[] whose first element is the time stamp and subsequent elements are the values to plot for each line (index 1..n). Some modules use a specific layout (e.g. mean, mean-sdev, mean+sdev).
- The graph maintains an x-range [xMin, xMax] and a y-range [yMin, yMax] via the Style object. The x-range is expressed in the same time units as the first element of the data arrays. The buffer capacity and style.xIncr determine the maximum historical range available for panning (the absolute bounds are [absMin, absMax] where absMax is hard-coded to 0.0 and absMin = absMax - capacity*xIncr).
- The graph can operate with autoscaling for the y-axis (style.autoscaleY) or with fixed y-limits. When autoscale is enabled, added data updates yMin/yMax to at least cover observed values; ranges are expanded but never shrunk automatically.
- Logarithmic y-scaling is supported (style.logScaleY), but it requires strictly positive values; if negative or zero values are present the graph disables log-scaling and issues a warning. When autoscaling and log-scaling interact, small positive minima are adjusted to a fraction of the maximum to avoid log(0).
Main behaviors and responsibilities:
- Construction: create a LineGraph with a Mean view and a Module that supplies trait names, colors and data semantics.
- Parsing: parse(String args) accepts a comma-separated argument string
(no spaces around commas) and recognizes options:
log,xmin <value>,xmax <value>,ymin <value>,ymax <value>. ymin/ymax disable autoscale when specified. - Data ingestion: addData(double t, double[] data) prepends time and delegates to addData(double[]). addData(double[]) appends the data array into the RingBuffer (the caller must ensure the first element is time and the array is not modified afterwards). addData updates the autoscaled y-range and may disable log-scaling if non-positive values are encountered.
- Resetting/initialization: reset() prepares the buffer, initializes autoscaled y-range and recomputes the number of steps along x relative to the current view. Buffer size is at least DEFAULT_BUFFER_SIZE or the view width, and steps are clamped between 1 and buffer capacity.
- Painting: paint(boolean force) renders the lines, optional markers and axes frame. The method clips drawing to the plotting area, supports linear or log y-scaling, and draws colored lines and markers using the module-provided color scheme. Painting is scheduled on the UI thread using schedulePaint() to coalesce multiple requests.
- Interaction:
- shift(dx, dy) pans the x-range in multiples of style.xIncr. Small mouse/touch deltas that do not exceed a single increment are accumulated until sufficient movement occurs. Shifting respects the absolute data bounds determined by the buffer capacity.
- zoom() resets the view to a default zoom focused on the latest data (xMax = 0.0 and xMin = xMax - max(1, DEFAULT_STEPS*xIncr)).
- zoom(double zoom, double x, double y) zooms around the right-hand end (xMax is treated as the reference) and enforces a minimum number of steps (MIN_STEPS). Zooming also snaps bounds to integer multiples of style.xIncr and clamps to the available history.
- Tooltips: getTooltipAt(int x,int y) converts pixel coordinates to normalized plotting coordinates and delegates to getTooltipAt(double x, double y). The tooltip builder searches the buffer to interpolate the time and values at the requested x position and returns an HTML table with the x-value, y-value and per-trait values (or mean ± sdev when applicable). Tooltips are suppressed while the left mouse button is held and when the point lies outside bounds.
- Context menu: populateContextMenuAt adds a "Clear" action that clears the graph history and triggers an immediate repaint.
Fields of interest (summary):
- steps: number of steps shown along the x-axis (clamped to [1, buffer.capacity]).
- buffer: RingBuffer<double[]> storing historical data arrays (time + values).
- style: visual and interaction configuration (xMin/xMax/yMin/yMax, xIncr, autoscaleY, logScaleY, markerSize, lineWidth, etc.).
- paintScheduled: coalesces deferred paint requests.
- pinchScale / pinch: state used for touch pinch gestures (scale and center).
Important implementation notes and caveats:
- The buffer stores references to the provided double[] objects for performance — callers must not modify arrays after passing them to addData(double[]).
- Log-scaling requires strictly positive y-values. If negative or zero values exist the graph will disable log-scale and emit a warning.
- Painting occurs on the UI thread and is scheduled via GWT Scheduler; callers should avoid heavy synchronous work on the UI thread during paint() to keep the UI responsive.
- Precision: x- and y-axis snapping to style.xIncr is used to keep numeric bounds aligned with the data grid; floating point rounding may occur when snapping or computing steps.
This class is intended for use within the EvoLudo UI framework and relies on the surrounding infrastructure (Style, RingBuffer, Module, Mean view, drawing context MyContext2d and Scheduler). It focuses on correctness of visualization, responsive UI updates via scheduled paints and robust handling of autoscaling and log-scaling edge cases.
Usage example (conceptual):
LineGraph g = new LineGraph(meanView, module);
g.parse("ymin 0.0,ymax 1.0"); // configure
g.addData(t, new double[]{t, v1, v2, ...});
g.zoom(2.0, sx, sy); // zoom in
// tooltips and context menu are integrated into the hosting UI
- Author:
- Christoph Hauert
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractGraph
AbstractGraph.HasLogScaleY, AbstractGraph.HasTrajectory, AbstractGraph.MyContext2d, AbstractGraph.Shifter, AbstractGraph.Shifting, AbstractGraph.ZoomCommand, AbstractGraph.Zoomer, AbstractGraph.ZoomingNested classes/interfaces inherited from class UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabledNested classes/interfaces inherited from interface HasWidgets
HasWidgets.ForIsWidget -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ContextMenuItemThe context menu item to clear the graph.protected static final intThe default number of steps along thex-axis.protected static final intThe minimum number of steps along thex-axis.(package private) intThe number of lines to plot.private booleanThe flag to indicate whether painting is already scheduled.(package private) Point2DThe center of the pinch gesture.(package private) doubleThe field to track the progress of the pinch gesture.(package private) doubleThe default number of (time) steps shown on this graph.(package private) intThe total shift in thex-direction.(package private) intThe total shift in they-direction.Fields inherited from class AbstractGraph
bounds, buffer, canvas, colors, contextMenu, CSS_CURSOR_MOVE_VIEW, CURSOR_GRAB_NODE_CLASS, CURSOR_MOVE_NODE_CLASS, CURSOR_ZOOM_IN_CLASS, CURSOR_ZOOM_OUT_CLASS, DEFAULT_BUFFER_SIZE, doubleClickHandler, element, g, hasMessage, hasZoom, leftMouseButton, logger, logYMenu, markerColors, markers, MIN_BUFFER_SIZE, MIN_MSEC_BETWEEN_UPDATES, module, mouseDownHandler, mouseMoveHandler, mouseOutHandler, mouseUpHandler, mouseWheelHandler, mouseX, mouseY, PIHALF, pinchDist, pinchX, pinchY, scale, shifter, style, tooltip, tooltipProvider, touchEndHandler, touchEndTime, touchMoveHandler, touchStartHandler, updatetime, view, viewCorner, wrapper, zoomer, zoomFactor, zoomInertiaTimer, zoomInMenu, zoomOutMenu, zoomResetMenuFields inherited from class UIObject
DEBUG_ID_PREFIXFields inherited from interface AbstractGraph.Zooming
ZOOM_INCR, ZOOM_MAXFields inherited from interface BasicTooltipProvider
TABLE_CELL_BULLET, TABLE_CELL_NEXT, TABLE_CELL_NEXT_COLOR, TABLE_END, TABLE_ROW_END, TABLE_ROW_START, TABLE_ROW_START_COLOR, TABLE_ROW_START_RIGHT, TABLE_SEPARATOR, TABLE_STYLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddData(double[] data) Add data to the graph.voidaddData(double t, double[] data) Add data to the graph.private voidappendTipContinuous(StringBuilder tip, double[] inter, Color[] colors) Append mean ± sdev row for Continuous modules.private voidappendTipHeader(StringBuilder tip, double mouset, double yval) Build and append the static header rows (label, x and y rows) to the tooltip.private voidappendTipInterpolation(StringBuilder tip, double mouset) Append interpolated values (either Continuous mean±sdev or trait values) to the tooltip builder using the precomputed interpolation result.private voidappendTipTraits(StringBuilder tip, double[] inter, Color[] colors) Append individual trait rows for non-Continuous modules.private intcompareData(double[] o1, double[] o2) Compare two data arrays based on their minimum value (ignoring first entry, time).private double[]computeYScale(double h) Compute y-axis scale info: [ymin, yrange, yScale]private voiddrawLatestMarkers(double start, double[] current, int nLines, double[] yinfo) Draw markers for the newest sample (extracted helper).private voiddrawLines(double width, double[] yinfo, int nLines) Draw the line plots and (suppressed) markers at the newest sample.private voiddrawMarkers(double width, double ymin, int nLines) Draw horizontal marker lines (if any) using the same y transform.private voiddrawSegmentClipped(double start, double end, double[] prev, double[] current, int nLines, double[] yinfo, double width) Draw a historical segment between 'start' and 'end', handling clipping against the visible window (-w ..voidExport the graphical contextctx.private double[]findInterpolationForMouse(double mouset) Scan the buffer and determine the two surrounding samples and the interpolation factor for the supplied mouse time.intGet the number of lines plotted in this graph.doublegetSteps()Get the number of steps along thex-axis.getTooltipAt(double x, double y) Get the tooltip at the scaled coordinates(x,y)with the origin in the lower left corner of the graph.getTooltipAt(int x, int y) Get the tooltip information for the location with coordinates(x, y).private doubleinterpolate(double left, double right, double x) Interpolate linearly betweencurrentandprevatx.private voidnoLogY()Helper method to disable log scale ony-axis and issue warning.protected voidonLoad()booleanpaint(boolean force) Draw the graph.booleanParse the arguments for the graph.private voidParse command line options for the graph.voidpopulateContextMenuAt(ContextMenu menu, int x, int y) Populate context menumenuin listening widget at (relative) position(x,y).voidreset()Reset the graph.protected voidSchedule painting of the graph.voidAssign a list of colors to the graph.(package private) voidsetLogY(boolean logY) Set they-axis to logarithmic scale iflogYistrueand ifyMin ≥ 0.voidsetSteps(double steps) Set the number of steps along thex-axis.voidshift(int dx, int dy) Shift the (zoomed) graph within the view port by(dx, dy).voidzoom()Reset zoom.voidzoom(double zoom, double x, double y) Helper method to adjust zoom level with the zoom center at the scaled coordinates(fx, fy), specified as a fraction of the view port in horizontal and vertical directions, respectively.Methods inherited from class AbstractGraph
activate, addContextMenuHandler, autoscale, calcBounds, calcBounds, clearCanvas, clearGraph, clearHistory, clearMessage, contains, convertToScaledCoordinates, convertToScaledCoordinates, deactivate, displayMessage, doUpdate, drawFrame, drawFrame, fill, fillCircle, fillCircle, fillCircle, fillRect, fillTextVertical, getBuffer, getModule, getStyle, hasHistory, hasMessage, init, onMouseDown, onMouseMove, onMouseOut, onMouseUp, onMouseWheel, onResize, onTouchEnd, onTouchMove, onTouchStart, onUnload, paint, prependTime2Data, resetTransforms, setBufferCapacity, setFont, setMarkers, setMarkers, setStrokeStyleAt, setTooltipProvider, stroke, strokeCircle, strokeCircle, strokeCircle, strokeLine, strokeLine, strokeRect, zoom, zoomMethods inherited from class FocusPanel
addBlurHandler, addClickHandler, addClickListener, addDoubleClickHandler, addDragEndHandler, addDragEnterHandler, addDragHandler, addDragLeaveHandler, addDragOverHandler, addDragStartHandler, addDropHandler, addFocusHandler, addFocusListener, addGestureChangeHandler, addGestureEndHandler, addGestureStartHandler, addKeyboardListener, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, addMouseDownHandler, addMouseListener, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseUpHandler, addMouseWheelHandler, addMouseWheelListener, addTouchCancelHandler, addTouchEndHandler, addTouchMoveHandler, addTouchStartHandler, getTabIndex, removeClickListener, removeFocusListener, removeKeyboardListener, removeMouseListener, removeMouseWheelListener, setAccessKey, setFocus, setTabIndexMethods inherited from class SimplePanel
add, getContainerElement, getWidget, iterator, remove, setWidget, setWidgetMethods inherited from class Panel
add, adopt, clear, doAttachChildren, doDetachChildren, orphan, removeMethods inherited from class Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, removeFromParent, setLayoutData, sinkEvents, unsinkEventsMethods inherited from class UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface AbstractGraph.Zoomer
zoomMethods inherited from interface AbstractGraph.Zooming
zoomMethods inherited from interface BasicTooltipProvider
getTooltipAtMethods inherited from interface ContextMenu.Listener
getAbsoluteLeft, getAbsoluteTopMethods inherited from interface HasHandlers
fireEventMethods inherited from interface HasTouchCancelHandlers
addTouchCancelHandlerMethods inherited from interface HasTouchEndHandlers
addTouchEndHandlerMethods inherited from interface HasTouchMoveHandlers
addTouchMoveHandlerMethods inherited from interface HasTouchStartHandlers
addTouchStartHandlerMethods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface MouseDownHandler
onMouseDownMethods inherited from interface MouseMoveHandler
onMouseMoveMethods inherited from interface MouseOutHandler
onMouseOutMethods inherited from interface MouseUpHandler
onMouseUpMethods inherited from interface MouseWheelHandler
onMouseWheelMethods inherited from interface TouchEndHandler
onTouchEndMethods inherited from interface TouchMoveHandler
onTouchMoveMethods inherited from interface TouchStartHandler
onTouchStart
-
Field Details
-
steps
double stepsThe default number of (time) steps shown on this graph. -
nLines
int nLinesThe number of lines to plot. -
paintScheduled
private boolean paintScheduledThe flag to indicate whether painting is already scheduled. Subsequent requests are ignored. -
pinchScale
double pinchScaleThe field to track the progress of the pinch gesture. -
pinch
Point2D pinchThe center of the pinch gesture. -
totDx
int totDxThe total shift in thex-direction. -
totDy
int totDyThe total shift in they-direction. -
MIN_STEPS
protected static final int MIN_STEPSThe minimum number of steps along thex-axis.- See Also:
-
DEFAULT_STEPS
protected static final int DEFAULT_STEPSThe default number of steps along thex-axis.- See Also:
-
clearMenu
The context menu item to clear the graph.
-
-
Constructor Details
-
LineGraph
Create new line graph forview. Theidis used to distinguish different graphs of the same module to visualize different components of the data and represents the index of the data column.- Parameters:
view- the view of this graphmodule- the module backing the graph
-
-
Method Details
-
onLoad
protected void onLoad()- Overrides:
onLoadin classAbstractGraph<double[]>
-
parse
Description copied from class:AbstractGraphParse the arguments for the graph. Default implementation does nothing.- Overrides:
parsein classAbstractGraph<double[]>- Parameters:
args- the arguments for the graph- Returns:
trueif parsing was successful
-
parseArgs
Parse command line options for the graph. The following options are recognized:log: enable logarithmic scaling on the y-axisxmin <value>: set the minimum x-axis valuexmax <value>: set the maximum x-axis valueymin <value>: set the minimum y-axis valueymax <value>: set the maximum y-axis value
- Parameters:
args- the command line arguments (comma separated, no spaces)
-
setColors
Description copied from class:AbstractGraphAssign a list of colors to the graph.- Overrides:
setColorsin classAbstractGraph<double[]>- Parameters:
colors- the list of colors
-
getNLines
public int getNLines()Get the number of lines plotted in this graph.- Returns:
- the number of lines
-
reset
public void reset()Description copied from class:AbstractGraphReset the graph. Clear canvas and messages.- Overrides:
resetin classAbstractGraph<double[]>
-
addData
public void addData(double t, double[] data) Add data to the graph. The timetis prepended to the data as the first element.- Parameters:
t- the time of the datadata- the data to add- Implementation Notes:
- The data array is cloned and the time prepended before adding it to the buffer.
-
addData
public void addData(double[] data) Add data to the graph.- Parameters:
data- the data to add- Implementation Notes:
- The data array is directly added to the buffer. It is the caller's responsibility to ensure that the first entry represents time and the data remains unmodified.
-
setLogY
void setLogY(boolean logY) Description copied from class:AbstractGraphSet they-axis to logarithmic scale iflogYistrueand ifyMin ≥ 0. IfyMin == 0it is increased to0.01 * yMax. IfyMin < 0logarithmic scale requests are ignored.- Overrides:
setLogYin classAbstractGraph<double[]>- Parameters:
logY-trueto set logarithmic scale ony-axis
-
noLogY
private void noLogY()Helper method to disable log scale ony-axis and issue warning. -
compareData
private int compareData(double[] o1, double[] o2) Compare two data arrays based on their minimum value (ignoring first entry, time). Returns a negative integer, zero, or a positive integer if the minimum of the first argument is less than, equal to, or greater than the second, respectively.- Parameters:
o1- the first data arrayo2- the second data array- Returns:
- a negative integer, zero, or a positive integer
-
paint
public boolean paint(boolean force) Description copied from class:AbstractGraphDraw the graph. For re-drawing the graph, setforcetotrue.- Overrides:
paintin classAbstractGraph<double[]>- Parameters:
force-trueto force re-drawing of graph- Returns:
trueif painting skipped
-
computeYScale
private double[] computeYScale(double h) Compute y-axis scale info: [ymin, yrange, yScale]- Parameters:
h- the height of the plotting area- Returns:
- an array containing [ymin, yScale]
-
drawLines
private void drawLines(double width, double[] yinfo, int nLines) Draw the line plots and (suppressed) markers at the newest sample.- Parameters:
width- the width of the plotting areayinfo- the y-axis transform infonLines- the number of lines to draw
-
drawLatestMarkers
private void drawLatestMarkers(double start, double[] current, int nLines, double[] yinfo) Draw markers for the newest sample (extracted helper).- Parameters:
start- the starting x-coordinatecurrent- the current data arraynLines- the number of lines to drawyinfo- the y-axis transform info
-
drawSegmentClipped
private void drawSegmentClipped(double start, double end, double[] prev, double[] current, int nLines, double[] yinfo, double width) Draw a historical segment between 'start' and 'end', handling clipping against the visible window (-w .. 0) and log/linear y transforms.- Parameters:
start- starting x-coordinate of the segmentend- ending x-coordinate of the segmentprev- the previous data arraycurrent- the current data arraynLines- the number of lines to drawyinfo- the y-axis transform infowidth- the width of the plotting area
-
drawMarkers
private void drawMarkers(double width, double ymin, int nLines) Draw horizontal marker lines (if any) using the same y transform.- Parameters:
width- the width of the plotting areaymin- the minimum y-valuenLines- the number of lines to draw
-
schedulePaint
protected void schedulePaint()Schedule painting of the graph. If painting is already scheduled, subsequent requests are ignored.- See Also:
-
export
Description copied from class:AbstractGraphExport the graphical contextctx.- Specified by:
exportin classAbstractGraph<double[]>- Parameters:
ctx- the graphical context to export
-
shift
public void shift(int dx, int dy) Description copied from class:AbstractGraphShift the (zoomed) graph within the view port by(dx, dy). Default implementation for graphs that implementShifting.- Specified by:
shiftin interfaceAbstractGraph.Shifter- Overrides:
shiftin classAbstractGraph<double[]>- Parameters:
dx- the horizontal shift of the graphdy- the vertical shift of the graph- See Also:
-
zoom
public void zoom()Description copied from class:AbstractGraphReset zoom. Default implementation for graphs that implementZooming.- Specified by:
zoomin interfaceAbstractGraph.Zooming- Overrides:
zoomin classAbstractGraph<double[]>- See Also:
-
zoom
public void zoom(double zoom, double x, double y) Description copied from class:AbstractGraphHelper method to adjust zoom level with the zoom center at the scaled coordinates(fx, fy), specified as a fraction of the view port in horizontal and vertical directions, respectively.- Overrides:
zoomin classAbstractGraph<double[]>- Parameters:
zoom- the new zoom levelx- the scaledx-coordinate of the zoom centery- the scaledy-coordinate of the zoom center- See Also:
-
getSteps
public double getSteps()Get the number of steps along thex-axis.- Returns:
- the number of steps
-
setSteps
public void setSteps(double steps) Set the number of steps along thex-axis.- Parameters:
steps- the number of steps
-
getTooltipAt
Description copied from interface:Tooltip.ProviderGet the tooltip information for the location with coordinates(x, y). The returned string may include HTML elements for formatting.- Specified by:
getTooltipAtin interfaceTooltip.Provider- Parameters:
x- thex-coordinate for the tooltipy- they-coordinate for the tooltip- Returns:
- the (formatted) string with the tooltip info
-
getTooltipAt
Description copied from interface:BasicTooltipProviderGet the tooltip at the scaled coordinates(x,y)with the origin in the lower left corner of the graph.- Specified by:
getTooltipAtin interfaceBasicTooltipProvider- Parameters:
x- thexcoordinatey- theycoordinate- Returns:
- the tooltip
-
appendTipHeader
Build and append the static header rows (label, x and y rows) to the tooltip.- Parameters:
tip- builder receiving the markupmouset- x-axis value under the cursoryval- y-axis value under the cursor
-
findInterpolationForMouse
private double[] findInterpolationForMouse(double mouset) Scan the buffer and determine the two surrounding samples and the interpolation factor for the supplied mouse time.- Parameters:
mouset- the mouse time- Returns:
- the interpolated data array (time + values) or null if not found
-
appendTipInterpolation
Append interpolated values (either Continuous mean±sdev or trait values) to the tooltip builder using the precomputed interpolation result.- Parameters:
tip- the tooltip buildermouset- the mouse time
-
appendTipContinuous
Append mean ± sdev row for Continuous modules.- Parameters:
tip- the tooltip builderinter- the interpolated data arraycolors- the colors for each trait
-
appendTipTraits
Append individual trait rows for non-Continuous modules.- Parameters:
tip- the tooltip builderinter- the interpolated data arraycolors- the colors for each trait
-
interpolate
private double interpolate(double left, double right, double x) Interpolate linearly betweencurrentandprevatx.- Parameters:
left- the left valueright- the right valuex- the location inbetween- Returns:
- the interpolated value
-
populateContextMenuAt
Description copied from class:AbstractGraphPopulate context menumenuin listening widget at (relative) position(x,y).Adds buffer size menu and queries the view to add further functionality.
- Specified by:
populateContextMenuAtin interfaceContextMenu.Provider- Overrides:
populateContextMenuAtin classAbstractGraph<double[]>- Parameters:
menu- context menu entries are added herex- horizontal coordinate (relative to listening widget)y- horizontal coordinate (relative to listening widget)- See Also:
-