public class ChartCanvas extends javafx.scene.canvas.Canvas implements org.jfree.chart.event.ChartChangeListener, org.jfree.chart.event.OverlayChangeListener
JFreeChart in JavaFX. You can use the
canvas directly to display charts, but usually the ChartViewer
class (which embeds a canvas) is a better option as it provides additional
features.
The canvas installs several default mouse handlers, if you don't like the behaviour provided by these you can retrieve the handler by ID and disable or remove it (the IDs are "tooltip", "scroll", "anchor", "pan" and "dispatch").
The FontSmoothingType for the underlying GraphicsContext is
set to FontSmoothingType.LCD as this gives better results on the
systems we've tested on. You can modify this using
getGraphicsContext().setFontSmoothingType(yourValue).
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, cacheHintProperty, cacheProperty, clipProperty, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, focusedProperty, focusTraversableProperty, hoverProperty, idProperty, impl_showMnemonicsProperty, impl_treeVisibleProperty, inputMethodRequestsProperty, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParentTransformProperty, localToSceneTransformProperty, managedProperty, mouseTransparentProperty, nodeOrientationProperty, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, pickOnBoundsProperty, pressedProperty, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, styleProperty, translateXProperty, translateYProperty, translateZProperty, visibleProperty| Constructor and Description |
|---|
ChartCanvas(org.jfree.chart.JFreeChart chart)
Creates a new canvas to display the supplied chart in JavaFX.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAuxiliaryMouseHandler(MouseHandlerFX handler)
Adds a handler to the list of auxiliary handlers.
|
void |
addChartMouseListener(ChartMouseListenerFX listener)
Registers a listener to receive
ChartMouseEvent notifications. |
void |
addMouseHandler(MouseHandlerFX handler)
Adds a mouse handler to the list of available handlers (handlers that
are candidates to take the position of live handler).
|
void |
addOverlay(OverlayFX overlay)
Add an overlay to the canvas.
|
void |
chartChanged(org.jfree.chart.event.ChartChangeEvent event)
Receives a notification from the chart that it has been changed and
responds by redrawing the chart entirely.
|
void |
clearLiveHandler()
Clears the current live handler.
|
void |
draw()
Draws the content of the canvas and updates the
renderingInfo attribute with the latest rendering
information. |
Rectangle2D |
findDataArea(Point2D point)
Returns the data area (the area inside the axes) for the plot or subplot.
|
Point2D |
getAnchor()
Returns the anchor point.
|
org.jfree.chart.JFreeChart |
getChart()
Returns the chart that is being displayed by this node.
|
List<ChartMouseListenerFX> |
getChartMouseListeners()
Returns a (newly created) list containing the listeners currently
registered with the canvas.
|
MouseHandlerFX |
getMouseHandler(String id)
Returns the mouse handler with the specified ID, or
null if
there is no handler with that ID. |
org.jfree.chart.ChartRenderingInfo |
getRenderingInfo()
Returns the rendering info from the most recent drawing of the chart.
|
protected void |
handleScroll(javafx.scene.input.ScrollEvent e)
Handles a scroll event by passing it on to the registered handlers.
|
boolean |
isDomainZoomable()
Returns the flag that determines whether or not zooming is enabled for
the domain axis.
|
boolean |
isRangeZoomable()
Returns the flag that determines whether or not zooming is enabled for
the range axis.
|
boolean |
isResizable()
Return
true to indicate the canvas is resizable. |
boolean |
isTooltipEnabled()
Returns the flag that controls whether or not tooltips are enabled.
|
void |
overlayChanged(org.jfree.chart.event.OverlayChangeEvent event)
Handles a change to an overlay by repainting the chart canvas.
|
void |
removeAuxiliaryMouseHandler(MouseHandlerFX handler)
Removes a handler from the list of auxiliary handlers.
|
void |
removeChartMouseListener(ChartMouseListenerFX listener)
Removes a listener from the list of objects listening for chart mouse
events.
|
void |
removeMouseHandler(MouseHandlerFX handler)
Removes a handler from the list of available handlers.
|
void |
removeOverlay(OverlayFX overlay)
Removes an overlay from the canvas.
|
void |
setAnchor(Point2D anchor)
Set the anchor point and forces a redraw of the chart (the anchor point
is used to determine the position of the crosshairs on the chart, if
they are visible).
|
void |
setChart(org.jfree.chart.JFreeChart chart)
Sets the chart to be displayed by this node.
|
void |
setDomainZoomable(boolean zoomable)
Sets the flag that controls whether or not domain axis zooming is
enabled.
|
void |
setRangeZoomable(boolean zoomable)
Sets the flag that controls whether or not range axis zooming is
enabled.
|
void |
setTooltip(String text,
double x,
double y)
Sets the tooltip text, with the (x, y) location being used for the
anchor.
|
void |
setTooltipEnabled(boolean tooltipEnabled)
Sets the flag that controls whether or not tooltips are enabled.
|
getGraphicsContext2D, getHeight, getWidth, heightProperty, impl_computeContains, impl_computeGeomBounds, impl_createPeer, impl_processMXNode, impl_updatePeer, setHeight, setWidth, widthPropertyaccessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, containsBounds, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBaselineOffset, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClassCssMetaData, getClip, getContentBias, getCssMetaData, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, hasProperties, hoverProperty, idProperty, impl_clearDirty, impl_computeIntersects, impl_computeLayoutBounds, impl_cssGetCursorInitialValue, impl_cssGetFocusTraversableInitialValue, impl_findStyles, impl_geomChanged, impl_getLeafTransform, impl_getMatchingStyles, impl_getPeer, impl_getPivotX, impl_getPivotY, impl_getPivotZ, impl_getStyleMap, impl_hasTransforms, impl_intersects, impl_intersectsBounds, impl_isDirty, impl_isDirtyEmpty, impl_isShowMnemonics, impl_isTreeVisible, impl_layoutBoundsChanged, impl_markDirty, impl_notifyLayoutBoundsChanged, impl_pickNode, impl_pickNodeLocal, impl_processCSS, impl_processCSS, impl_reapplyCSS, impl_setShowMnemonics, impl_setStyleMap, impl_showMnemonicsProperty, impl_syncPeer, impl_transformsChanged, impl_traverse, impl_treeVisibleProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookup, lookupAll, managedProperty, maxHeight, maxWidth, minHeight, minWidth, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, prefHeight, prefWidth, pressedProperty, pseudoClassStateChanged, queryAccessibleAttribute, relocate, removeEventFilter, removeEventHandler, requestFocus, resize, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, visiblePropertypublic ChartCanvas(org.jfree.chart.JFreeChart chart)
chart is null, a blank canvas will be displayed.chart - the chart.public org.jfree.chart.JFreeChart getChart()
null).public void setChart(org.jfree.chart.JFreeChart chart)
chart - the chart (null permitted).public boolean isDomainZoomable()
public void setDomainZoomable(boolean zoomable)
true will have no effect.zoomable - the new flag value.public boolean isRangeZoomable()
public void setRangeZoomable(boolean zoomable)
true will have no effect.zoomable - the new flag value.public org.jfree.chart.ChartRenderingInfo getRenderingInfo()
null).public boolean isTooltipEnabled()
true. The TooltipHandlerFX
class will only update the tooltip if this flag is set to
true.public void setTooltipEnabled(boolean tooltipEnabled)
tooltipEnabled - the new flag value.public Point2D getAnchor()
null).public void setAnchor(Point2D anchor)
anchor - the anchor (null permitted).public void addOverlay(OverlayFX overlay)
overlay - the overlay (null not permitted).public void removeOverlay(OverlayFX overlay)
overlay - the overlay to remove (null not permitted).public void overlayChanged(org.jfree.chart.event.OverlayChangeEvent event)
overlayChanged in interface org.jfree.chart.event.OverlayChangeListenerevent - the event.public List<ChartMouseListenerFX> getChartMouseListeners()
null).public void addChartMouseListener(ChartMouseListenerFX listener)
ChartMouseEvent notifications.listener - the listener (null not permitted).public void removeChartMouseListener(ChartMouseListenerFX listener)
listener - the listener.public MouseHandlerFX getMouseHandler(String id)
null if
there is no handler with that ID. This method will look for handlers
in both the regular and auxiliary handler lists.id - the ID (null not permitted).public void addMouseHandler(MouseHandlerFX handler)
handler - the handler (null not permitted).public void removeMouseHandler(MouseHandlerFX handler)
handler - the handler (null not permitted).public void addAuxiliaryMouseHandler(MouseHandlerFX handler)
handler - the handler (null not permitted).public void removeAuxiliaryMouseHandler(MouseHandlerFX handler)
handler - the handler (null not permitted).public void clearLiveHandler()
public final void draw()
renderingInfo attribute with the latest rendering
information.public Rectangle2D findDataArea(Point2D point)
point - the selection point (for subplot selection).public boolean isResizable()
true to indicate the canvas is resizable.isResizable in class javafx.scene.Nodetrue.public void setTooltip(String text, double x, double y)
null, no tooltip will be displayed.
This method is intended for calling by the TooltipHandlerFX
class, you won't normally call it directly.text - the text (null permitted).x - the x-coordinate of the mouse pointer.y - the y-coordinate of the mouse pointer.protected void handleScroll(javafx.scene.input.ScrollEvent e)
e - the scroll event.public void chartChanged(org.jfree.chart.event.ChartChangeEvent event)
chartChanged in interface org.jfree.chart.event.ChartChangeListenerevent - event information.Copyright © 2017 JFree.org. All rights reserved.