Class Chart
- All Implemented Interfaces:
Animation, Editable, StyleListener
An interactive, animated chart.
Form form = new Form("Revenue", new BorderLayout());
Chart chart = new Chart()
.setXAxis(new CategoryAxis(Axis.BOTTOM, "Q1", "Q2", "Q3", "Q4"))
.setTitle("Revenue");
chart.addSeries(new BarSeries("2025").setValues(12, 18, 9, 22));
chart.addSeries(new LineSeries("Target").setDashed(true).setValues(15, 15, 15, 15));
form.add(BorderLayout.CENTER, chart);
Layout is automatic: the chart measures every label before it draws, picks as many round-number ticks as fit, thins and shortens category labels that would collide and sizes the plot to whatever space is left. Data labels go through a collision layout and are dropped rather than drawn over each other.
Interaction works the same with touch, mouse, trackpad and keyboard: drag to pan once zoomed, pinch or scroll to zoom (spreading the fingers horizontally zooms only the x axis), double tap to zoom in and double tap again to reset, tap or hover a point for its tooltip, and tap a legend entry to hide or show its series. Data changes animate.
Style the component with the Chart UIID; its padding surrounds the plot, its font is
the label font and its background shows through. Colours come from ChartTheme.

-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intLegend below the plot.static final intNo legend.static final intLegend right of the plot.static final intLegend above the plot.static final intNo tooltip.static final intTooltip for the single point under the finger or pointer.static final intTooltip listing every series at the x nearest the finger or pointer, with a crosshair.static final intZoom gestures scale the value axis too unless the x axis is a category or time axis.static final intZoom gestures scale the x (category) axis only; values keep their scale.static final intZoom gestures scale both axes, following the direction of a pinch.Fields inherited from class Component
BASELINE, BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, CROSSHAIR_CURSOR, DEFAULT_CURSOR, DRAG_REGION_IMMEDIATELY_DRAG_X, DRAG_REGION_IMMEDIATELY_DRAG_XY, DRAG_REGION_IMMEDIATELY_DRAG_Y, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_POSSIBLE_DRAG_Y, E_RESIZE_CURSOR, HAND_CURSOR, LEFT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NW_RESIZE_CURSOR, RIGHT, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, TOP, W_RESIZE_CURSOR, WAIT_CURSOR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a reference line, band or marker.voidListens for taps on legend entries.voidAdds a listener for brush selections.voidListens for taps on data points.Adds a series, animating it in when the chart is showing.booleananimate()Allows the animation to reduce "repaint" calls when it returns false.voidSnapshots what is on screen as the start of the next transition.protected DimensionCalculates the preferred size based on component content.Removes every series.protected voidInvoked to indicate that the component initialization is being reversed since the component was detached from the container hierarchy.describe()A one paragraph summary of the chart for screen readers: its title and, for each series, how many values it has and their range.The accessibility text set on the chart, or a generated summary of its data.The frame last painted; hit testing and transitions read its geometry.The secondary value axis on the right, or null.The selected point, or null.The series, in paint order.The chart's data as rows of{series, item, value}, in series order.getTheme()The colour theme.getTitle()The chart title, or null.doubleThe data x the shared tooltip shows, or NaN when it shows none.getXAxis()The x (category) axis.getYAxis()The primary value axis.intOne of theZOOM_constants.hitTest(int x, int y) Finds the point at a chart relative position, the topmost series first.intThe position of a series, which also selects its default palette colour.protected voidAllows subclasses to bind functionality that relies on fully initialized and "ready for action" component statebooleanWhether tapping a legend entry hides and shows its series.booleanWhethersetLoadingis showing a loading state.booleanTrue for a horizontal bar chart: the x (category) axis runs down the left side.voidkeyReleased(int keyCode) If this Component is focused, the key released event will call this methodprotected booleanmouseWheel(WheelEvent ev) Handles a scroll wheel or trackpad scroll over this component, before its listeners and before anything above it in the hierarchy.voidThis method paints the Component on the screen, it should be overriden by subclasses to perform custom drawing or invoke the UI API's to let the PLAF perform the rendering.protected voidpinchReleased(int x, int y) To be implemented by subclasses interested in being notified when a pinch zoom has ended (i.e the user has removed one of their fingers, but is still dragging).voidpointerDragged(int[] x, int[] y) If this Component is focused, the pointer dragged event will call this methodvoidpointerHover(int[] x, int[] y) Invoked for devices where the pointer can hover without actually clicking the display.voidpointerHoverReleased(int[] x, int[] y) Invoked for devices where the pointer can hover without actually clicking the display.voidpointerPressed(int x, int y) If this Component is focused, the pointer pressed event will call this methodvoidpointerReleased(int x, int y) If this Component is focused, the pointer released event will call this methodprotected voidrefreshTheme(String id, boolean merge) Makes sure the component is up to date with the given UIIDRemoves an annotation.voidStops listening.voidRemoves a brush selection listener.voidStops listening.Removes a series.voidReturns to the full data range with an animation.setAnimationDuration(int ms) Transition length in milliseconds; 0 applies data changes without animating.setBrushEnabled(boolean enabled) Makes a drag inside the plot select a range of x values instead of scrubbing or panning; pinch, the wheel and the keyboard still zoom and pan.setBrushZooms(boolean zooms) Whether a brush selection also zooms the chart to it; true by default.setEmptyText(String text) Text shown when there is nothing to plot.setLegendPosition(int pos) One of theLEGEND_constants.setLegendToggles(boolean toggles) Whether tapping a legend entry hides and shows its series (the default).setLoading(String text) Shows that data is on its way: with no data yet the text replaces the empty state, and over existing data the chart is dimmed under it.setRotated(boolean rotated) Swaps the axes so categories run vertically and values horizontally.Adds a right hand value axis for series withsetSecondaryAxis(true).setSelection(Series s, int index) Selects pointindexofsand shows its tooltip, as a tap on it would; null clears the selection.setTheme(ChartTheme theme) Replaces the colour theme.Sets a title drawn above the plot.setTooltipMode(int mode) One of theTOOLTIP_constants.Customizes the tooltip's rows.Replaces the x axis, for example with aCategoryAxisorTimeAxis.Replaces the primary value axis, for example with aLogAxis.setZoomEnabled(boolean zoomEnabled) Whether pinch, wheel, double tap and drag zoom and pan the chart.setZoomMode(int zoomMode) Which axes pinch, wheel, double tap and keyboard zoom:ZOOM_AUTO(the default),ZOOM_XorZOOM_XY.showTooltipAtX(double x) Shows the shared tooltip and crosshair at data xx, as a tap there would inTOOLTIP_SHAREDmode; linked charts follow.voidstyleChanged(String propertyName, Style source) Invoked to indicate a change in a propertyName of a StylevoidLinks this chart's x axis viewport and crosshair with other charts, as a price chart and its volume or indicator panes need: panning or zooming one pans the others.toImage(int width, int height) Renders the chart into an image, for sharing or export.toTable()A table component showing the chart's data; offer it beside or instead of the chart for readers who cannot see it.The chart's data as a table model with the columns Series, Item and Value, for a data table view, export, or a screen reader friendly alternative to the picture.voidunsync()Leaves the group joined withsyncWith: this chart stops following the others and they stop following it, while the rest of the group stays linked.voidRuns several data changes as one animated transition.Methods inherited from class Component
accessibilityChanged, accessibilityChanged, addContextMenuListener, addDragFinishedListener, addDragOverListener, addDropListener, addFocusListener, addLongPressListener, addMouseWheelListener, addNativeDragOverListener, addNativeDropListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addPullToRefresh, addScrollListener, addStateChangeListener, addStylusListener, announceForAccessibility, bindProperty, blocksSideSwipe, calcScrollSize, canAcceptNativeDrop, cancelRepaints, clearClientProperties, consumesRawTextInput, contains, containsOrOwns, createNativeDragOperation, createStyleAnimation, deinitializeCustomStyle, deregisterFromAnimation, dragEnter, dragExit, dragFinished, draggingOver, dragInitiated, drawDraggedImage, drop, fireClicked, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getAcceptedDropActions, getAcceptedDropMimeTypes, getAccessibilityNode, getAllStyles, getAnimationManager, getBaseline, getBaselineResizeBehavior, getBindablePropertyNames, getBindablePropertyTypes, getBorder, getBottomGap, getBoundPropertyValue, getBounds, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentForm, getComponentState, getContextMenuCommands, getCursor, getDefaultDragTransparency, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragRegionStatus, getDragSpeed, getDragTransparency, getEditingDelegate, getGridPosX, getGridPosY, getHeight, getHoverStyle, getInlineAllStyles, getInlineDisabledStyles, getInlinePressedStyles, getInlineSelectedStyles, getInlineStylesTheme, getInlineUnselectedStyles, getInnerHeight, getInnerPreferredH, getInnerPreferredW, getInnerWidth, getInnerX, getInnerY, getLabelForComponent, getName, getNativeDragOperation, getNativeOverlay, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getOuterHeight, getOuterPreferredH, getOuterPreferredW, getOuterWidth, getOuterX, getOuterY, getOwner, getParent, getPreferredH, getPreferredSize, getPreferredSizeStr, getPreferredTabIndex, getPreferredW, getPressedStyle, getPropertyNames, getPropertyTypeNames, getPropertyTypes, getPropertyValue, getSameHeight, getSameWidth, getScrollable, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getSemantics, getSideGap, getStyle, getTabIndex, getTensileLength, getTextSelectionSupport, getTooltip, getTopLevelContainer, getUIID, getUIManager, getUnselectedStyle, getVisibleBounds, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFixedPreferredSize, hasFocus, hideNativeOverlay, initCustomStyle, initDisabledStyle, initLaf, initPressedStyle, initSelectedStyle, initUnselectedStyle, installDefaultPainter, isAlwaysTensile, isBlockLead, isCellRenderer, isChildOf, isDragActivated, isDragAndDropOperation, isDraggable, isDragRegion, isDropTarget, isEditable, isEditing, isEnabled, isFlatten, isFocusable, isGrabsPointerEvents, isHidden, isHidden, isHideInLandscape, isHideInPortrait, isHovered, isHScrollThumbGrabbed, isHScrollThumbHover, isIgnorePointerEvents, isInClippingRegion, isInitialized, isNativeDragSource, isNativeDropTarget, isOpaque, isOwnedBy, isPinchBlocksDragAndDrop, isRippleEffect, isRTL, isScrollable, isScrollableX, isScrollableY, isScrollVisible, isSelectableInteraction, isSetCursorSupported, isSmoothScrolling, isSnapToGrid, isStickyDrag, isTactileTouch, isTactileTouch, isTensileDragEnabled, isTraversable, isVisible, isVScrollThumbGrabbed, isVScrollThumbHover, keyPressed, keyRepeated, laidOut, longKeyPress, longPointerPress, nativeDragEnter, nativeDragExit, nativeDragOver, nativeDrop, onScrollX, onScrollY, onSetFocusable, paintBackground, paintBackgrounds, paintBorder, paintBorderBackground, paintComponent, paintComponent, paintIntersectingComponentsAbove, paintLock, paintLockRelease, paintRippleOverlay, paintScrollbars, paintScrollbarX, paintScrollbarY, paintShadows, paramString, parsePreferredSize, pinch, pinch, pointerDragged, pointerHoverPressed, pointerPressed, pointerReleased, putClientProperty, refreshTheme, refreshTheme, registerForAnimation, remove, removeContextMenuListener, removeDragFinishedListener, removeDragOverListener, removeDropListener, removeFocusListener, removeLongPressListener, removeMouseWheelListener, removeNativeDragOverListener, removeNativeDropListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeScrollListener, removeStateChangeListener, removeStylusListener, repaint, repaint, requestFocus, resetFocusable, respondsToPointerEvents, rotation, scrollRectToVisible, scrollRectToVisible, setAcceptedDropActions, setAcceptedDropMimeTypes, setAccessibilityText, setAlwaysTensile, setBlockLead, setBoundPropertyValue, setCellRenderer, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setContextMenuCommands, setCursor, setDefaultDragTransparency, setDirtyRegion, setDisabledStyle, setDraggable, setDragTransparency, setDropTarget, setEditingDelegate, setEnabled, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHidden, setHidden, setHideInLandscape, setHideInPortrait, setHorizontalScrollBounds, setHovered, setHoverStyle, setIgnorePointerEvents, setInitialized, setInlineAllStyles, setInlineDisabledStyles, setInlinePressedStyles, setInlineSelectedStyles, setInlineStylesTheme, setInlineUnselectedStyles, setIsScrollVisible, setLabelForComponent, setName, setNativeDragOperation, setNativeDragSource, setNativeDropTarget, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setOpaque, setOwner, setPinchBlocksDragAndDrop, setPreferredH, setPreferredSize, setPreferredSizeStr, setPreferredTabIndex, setPreferredW, setPressedStyle, setPropertyValue, setPullToRefresh, setRippleEffect, setRTL, setSameHeight, setSameSize, setSameWidth, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setShouldCalcPreferredSize, setSize, setSmoothScrolling, setSnapToGrid, setTabIndex, setTactileTouch, setTensileDragEnabled, setTensileLength, setTooltip, setTraversable, setUIID, setUIID, setUIIDFinal, setUnselectedStyle, setVerticalScrollBounds, setVisible, setWidth, setX, setY, shouldBlockSideSwipe, shouldBlockSideSwipeLeft, shouldBlockSideSwipeRight, shouldRenderComponentSelection, showNativeOverlay, startEditingAsync, stopEditing, stopScrollMomentum, stripMarginAndPadding, toImage, toString, unbindProperty, updateNativeOverlay, visibleBoundsContains
-
Field Details
-
LEGEND_NONE
public static final int LEGEND_NONENo legend.- See Also:
-
LEGEND_TOP
public static final int LEGEND_TOPLegend above the plot.- See Also:
-
LEGEND_BOTTOM
public static final int LEGEND_BOTTOMLegend below the plot.- See Also:
-
LEGEND_RIGHT
public static final int LEGEND_RIGHTLegend right of the plot.- See Also:
-
TOOLTIP_NONE
public static final int TOOLTIP_NONENo tooltip.- See Also:
-
TOOLTIP_POINT
public static final int TOOLTIP_POINTTooltip for the single point under the finger or pointer.- See Also:
-
TOOLTIP_SHARED
public static final int TOOLTIP_SHAREDTooltip listing every series at the x nearest the finger or pointer, with a crosshair.- See Also:
-
ZOOM_AUTO
public static final int ZOOM_AUTOZoom gestures scale the value axis too unless the x axis is a category or time axis.- See Also:
-
ZOOM_X
public static final int ZOOM_XZoom gestures scale the x (category) axis only; values keep their scale.- See Also:
-
ZOOM_XY
public static final int ZOOM_XYZoom gestures scale both axes, following the direction of a pinch.- See Also:
-
-
Constructor Details
-
Chart
public Chart()Creates an empty chart with numeric axes.
-
-
Method Details
-
addSeries
-
removeSeries
-
clearSeries
Removes every series. -
getSeries
-
indexOf
The position of a series, which also selects its default palette colour. -
addAnnotation
Adds a reference line, band or marker. -
removeAnnotation
Removes an annotation. -
update
Runs several data changes as one animated transition. -
getXAxis
The x (category) axis. -
setXAxis
-
getYAxis
The primary value axis. -
setYAxis
-
getSecondaryYAxis
The secondary value axis on the right, or null. -
setSecondaryYAxis
Adds a right hand value axis for series with
setSecondaryAxis(true).A rotated chart (
setRotated(true)) has no room for a second horizontal value axis, so while it is rotated the secondary axis is neither laid out nor painted and its series and annotations are measured against the primary value axis instead. -
getTheme
The colour theme. -
refreshTheme
Description copied from class:ComponentMakes sure the component is up to date with the given UIID
Parameters
-
id: The Style Id to update the Component with -
merge: indicates if the current styles should be merged with the new styles
- Overrides:
refreshThemein classComponent
-
-
styleChanged
Description copied from class:ComponentInvoked to indicate a change in a propertyName of a Style
NOTE By default this will trigger a call to
Container#revalidate()on the parent container, which is expensive. You can disable this behavior by callingCN.setProperty("Component.revalidateOnStyleChange", "false"). The intention is to change this behavior so that the default is to "not" revalidate on style change, so we encourage you to set this to "false" to ensure for future compatibility.Parameters
-
propertyName: the property name that was changed -
source: The changed Style object
- Specified by:
styleChangedin interfaceStyleListener- Overrides:
styleChangedin classComponent
-
-
setTheme
Replaces the colour theme. -
getTitle
The chart title, or null. -
setTitle
-
setLegendPosition
One of theLEGEND_constants. The default is below the plot; a chart with a single series and no pie hides its legend automatically. -
setTooltipMode
One of theTOOLTIP_constants. -
setTooltipRenderer
Customizes the tooltip's rows. -
isRotated
public boolean isRotated()True for a horizontal bar chart: the x (category) axis runs down the left side. -
setRotated
Swaps the axes so categories run vertically and values horizontally. -
setZoomEnabled
Whether pinch, wheel, double tap and drag zoom and pan the chart. -
setZoomMode
Which axes pinch, wheel, double tap and keyboard zoom:ZOOM_AUTO(the default),ZOOM_XorZOOM_XY. -
getZoomMode
public int getZoomMode()One of theZOOM_constants. -
setAnimationDuration
Transition length in milliseconds; 0 applies data changes without animating. -
setLoading
Shows that data is on its way: with no data yet the text replaces the empty state, and over existing data the chart is dimmed under it. It stays until
setLoading(null), so a caller that loads in steps decides when the data is complete.Parameters
text: the text to show, or null to stop showing it
Returns
this chart
-
isLoading
public boolean isLoading()WhethersetLoadingis showing a loading state. -
setBrushEnabled
Makes a drag inside the plot select a range of x values instead of scrubbing or panning; pinch, the wheel and the keyboard still zoom and pan. The selection is reported to
addRangeListenerand, unlesssetBrushZooms(false), the chart zooms to it. While the chart is zoomed a one finger drag pans instead, so a zoomed chart stays reachable by touch; resetting the zoom brings the brush back.Parameters
enabled: true to brush
Returns
this chart
-
setBrushZooms
Whether a brush selection also zooms the chart to it; true by default.
Parameters
zooms: false to only report the selection
Returns
this chart
-
addRangeListener
Adds a listener for brush selections. -
removeRangeListener
Removes a brush selection listener. -
setEmptyText
-
addSelectionListener
Listens for taps on data points. -
removeSelectionListener
Stops listening. -
setSelection
Selects pointindexofsand shows its tooltip, as a tap on it would; null clears the selection. Arrow-key stepping continues from the point, and the screen reader announces it. Selection listeners are not called: they report the user's taps and keys, and the caller already knows what it selected. Before the chart is first painted the selection is kept and applied by that paint. -
showTooltipAtX
Shows the shared tooltip and crosshair at data xx, as a tap there would inTOOLTIP_SHAREDmode; linked charts follow. Does nothing in other modes. -
getTooltipX
public double getTooltipX()The data x the shared tooltip shows, or NaN when it shows none. -
setLegendToggles
Whether tapping a legend entry hides and shows its series (the default). Legend listeners are told of taps either way. -
isLegendToggles
public boolean isLegendToggles()Whether tapping a legend entry hides and shows its series. -
addLegendListener
Listens for taps on legend entries. -
removeLegendListener
Stops listening. -
getSelection
The selected point, or null. -
getLastContext
The frame last painted; hit testing and transitions read its geometry. -
toImage
Renders the chart into an image, for sharing or export. -
beginChange
public void beginChange()Snapshots what is on screen as the start of the next transition. Called by series before they mutate; applications useupdate(Runnable)instead. -
initComponent
protected void initComponent()Description copied from class:ComponentAllows subclasses to bind functionality that relies on fully initialized and "ready for action" component state- Overrides:
initComponentin classComponent
-
deinitialize
protected void deinitialize()Description copied from class:ComponentInvoked to indicate that the component initialization is being reversed since the component was detached from the container hierarchy. This allows the component to deregister animators and cleanup after itself. This method is the opposite of the initComponent() method.- Overrides:
deinitializein classComponent
-
animate
public boolean animate()Description copied from class:ComponentAllows the animation to reduce "repaint" calls when it returns false. It is called once for every frame. Frames are defined by the
com.codename1.ui.Displayclass.Returns
true if a repaint is desired or false if no repaint is necessary
-
calcPreferredSize
Description copied from class:ComponentCalculates the preferred size based on component content. This method is invoked lazily by getPreferred size.
Returns
the calculated preferred size based on component content
- Overrides:
calcPreferredSizein classComponent
-
paint
Description copied from class:ComponentThis method paints the Component on the screen, it should be overriden by subclasses to perform custom drawing or invoke the UI API's to let the PLAF perform the rendering.
Parameters
g: the component graphics
-
getTableRows
-
toTableModel
The chart's data as a table model with the columns Series, Item and Value, for a data table view, export, or a screen reader friendly alternative to the picture.
Returns
a new, read only table model
-
toTable
A table component showing the chart's data; offer it beside or instead of the chart for readers who cannot see it.
Returns
a new table
-
describe
A one paragraph summary of the chart for screen readers: its title and, for each series, how many values it has and their range.
Returns
the summary
-
getAccessibilityText
The accessibility text set on the chart, or a generated summary of its data.- Overrides:
getAccessibilityTextin classComponent
-
hitTest
Finds the point at a chart relative position, the topmost series first. -
pointerPressed
public void pointerPressed(int x, int y) Description copied from class:ComponentIf this Component is focused, the pointer pressed event will call this method
Parameters
-
x: the pointer x coordinate -
y: the pointer y coordinate
- Overrides:
pointerPressedin classComponent
-
-
pointerDragged
public void pointerDragged(int[] x, int[] y) Description copied from class:ComponentIf this Component is focused, the pointer dragged event will call this method
Parameters
-
x: the pointer x coordinate -
y: the pointer y coordinate
- Overrides:
pointerDraggedin classComponent
-
-
pinchReleased
protected void pinchReleased(int x, int y) Description copied from class:ComponentTo be implemented by subclasses interested in being notified when a pinch zoom has ended (i.e the user has removed one of their fingers, but is still dragging).
Parameters
-
x: The x-coordinate of the remaining finger in the drag. (Absolute) -
y: The y-coordinate of the remaining finger in the drag. (Absolute)
- Overrides:
pinchReleasedin classComponent
-
-
pointerReleased
public void pointerReleased(int x, int y) Description copied from class:ComponentIf this Component is focused, the pointer released event will call this method
Parameters
-
x: the pointer x coordinate -
y: the pointer y coordinate
- Overrides:
pointerReleasedin classComponent
-
-
resetZoom
public void resetZoom()Returns to the full data range with an animation. -
mouseWheel
Description copied from class:ComponentHandles a scroll wheel or trackpad scroll over this component, before its listeners and before anything above it in the hierarchy.
A component that moves its own content -- an editor that scrolls itself, a viewer that pans -- implements this. Everything else leaves it alone and the wheel scrolls the nearest scrollable ancestor, which is what a wheel means.
This exists because a wheel used to arrive as a synthetic press, drag and release played into the component tree: a component that wanted the wheel got it by handling pointer events, and so did every component that did not want it. The events are gone and this is what replaces them, for the few components that have something of their own to move.
Parameters
ev: the wheel event, carrying the scroll deltas in display pixels
Returns
true when this component handled the wheel and nothing else should act on it
- Overrides:
mouseWheelin classComponent
-
pointerHover
public void pointerHover(int[] x, int[] y) Description copied from class:ComponentInvoked for devices where the pointer can hover without actually clicking the display. This is true for PC mouse pointer as well as some devices such as the BB storm.
Parameters
-
x: the pointer x coordinate -
y: the pointer y coordinate
- Overrides:
pointerHoverin classComponent
-
-
pointerHoverReleased
public void pointerHoverReleased(int[] x, int[] y) Description copied from class:ComponentInvoked for devices where the pointer can hover without actually clicking the display. This is true for PC mouse pointer as well as some devices such as the BB storm.
Parameters
-
x: the pointer x coordinate -
y: the pointer y coordinate
- Overrides:
pointerHoverReleasedin classComponent
-
-
keyReleased
public void keyReleased(int keyCode) Description copied from class:ComponentIf this Component is focused, the key released event will call this method
Parameters
keyCode: the key code value to indicate a physical key.
- Overrides:
keyReleasedin classComponent
-
syncWith
Links this chart's x axis viewport and crosshair with other charts, as a price chart and its volume or indicator panes need: panning or zooming one pans the others. -
unsync
public void unsync()Leaves the group joined withsyncWith: this chart stops following the others and they stop following it, while the rest of the group stays linked. Removing a chart from its form does not unlink it, so a chart shown again keeps syncing; call this when a linked chart is discarded.
-