Class Chart3DCanvas
java.lang.Object
javafx.scene.Node
javafx.scene.canvas.Canvas
org.jfree.chart3d.fx.Chart3DCanvas
- All Implemented Interfaces:
EventListener,javafx.css.Styleable,javafx.event.EventTarget,org.jfree.chart3d.Chart3DChangeListener
public class Chart3DCanvas
extends javafx.scene.canvas.Canvas
implements org.jfree.chart3d.Chart3DChangeListener
A canvas node for displaying a
Chart3D in JavaFX. This node
handles mouse events and tooltips but does not provide a context menu or
toolbar (these features are provided by the Chart3DViewer class.)-
Property Summary
Properties inherited from class javafx.scene.canvas.Canvas
height, widthProperties inherited from class javafx.scene.Node
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, focusVisible, focusWithin, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, viewOrder, visible -
Field Summary
Fields inherited from class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT -
Constructor Summary
ConstructorsConstructorDescriptionChart3DCanvas(org.jfree.chart3d.Chart3D chart) Creates a new canvas to display the supplied chart in JavaFX. -
Method Summary
Modifier and TypeMethodDescriptionvoidchartChanged(org.jfree.chart3d.Chart3DChangeEvent event) Redraws the chart whenever a chart change event is received.voiddraw()Draws the content of the canvas and updates therenderingInfoattribute with the latest rendering information.org.jfree.chart3d.Chart3DgetChart()Returns the chart that is being displayed by this node.doubleReturns the margin that is used when zooming to fit.doubleReturns the multiplier used to calculate the maximum permitted distance between the viewing point and the origin.doubleReturns the minimum distance between the viewing point and the origin.doubleReturns the increment for panning left and right.org.jfree.chart3d.graphics3d.RenderingInfoReturns the rendering info from the most recent drawing of the chart.doubleReturns the increment for rotating up and down.booleanReturntrueto indicate the canvas is resizable.booleanReturns a flag that controls whether rotation by mouse dragging is enabled.booleanReturns the flag that controls whether tooltips are enabled.voidsetChart(org.jfree.chart3d.Chart3D chart) Sets the chart to be displayed by this node.voidsetMargin(double margin) Sets the margin (note that this will not have an immediate effect, it will only be applied on the next call tozoomToFit(double, double)).voidsetMaxViewingDistanceMultiplier(double multiplier) Sets the multiplier used to calculate the maximum viewing distance.voidsetMinViewingDistance(double minViewingDistance) Sets the minimum between the viewing point and the origin.voidsetPanIncrement(double increment) Sets the increment for panning left and right (an angle measured in radians).voidsetRotateIncrement(double increment) Sets the increment for rotating up and down (an angle measured in radians).voidsetRotateViewEnabled(boolean enabled) Sets the flag that controls whether rotation by mouse dragging is enabled.voidsetTooltipEnabled(boolean tooltipEnabled) Sets the flag that controls whether tooltips are enabled.protected voidupdateTooltip(javafx.scene.input.MouseEvent me) Updates the tooltip.voidzoomToFit(double width, double height) Adjusts the viewing distance so that the chart fits the specified size.Methods inherited from class javafx.scene.canvas.Canvas
getGraphicsContext2D, getHeight, getWidth, heightProperty, setHeight, setWidth, widthPropertyMethods inherited from class javafx.scene.Node
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, focusVisibleProperty, focusWithinProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBaselineOffset, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClassCssMetaData, getClip, getContentBias, getCssMetaData, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInitialFocusTraversable, 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, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isFocusVisible, isFocusWithin, 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, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visiblePropertyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface javafx.css.Styleable
getStyleableNode
-
Constructor Details
-
Chart3DCanvas
Creates a new canvas to display the supplied chart in JavaFX.- Parameters:
chart- the chart (nullnot permitted).
-
-
Method Details
-
getChart
Returns the chart that is being displayed by this node.- Returns:
- The chart (never
null).
-
setChart
Sets the chart to be displayed by this node.- Parameters:
chart- the chart (nullnot permitted).
-
getMargin
Returns the margin that is used when zooming to fit. The margin can be used to control the amount of space around the chart (where labels are often drawn). The default value is 0.25 (25 percent).- Returns:
- The margin.
-
setMargin
Sets the margin (note that this will not have an immediate effect, it will only be applied on the next call tozoomToFit(double, double)).- Parameters:
margin- the margin.
-
getRenderingInfo
Returns the rendering info from the most recent drawing of the chart.- Returns:
- The rendering info (possibly
null).
-
getMinViewingDistance
Returns the minimum distance between the viewing point and the origin. This is initialised in the constructor based on the chart dimensions.- Returns:
- The minimum viewing distance.
-
setMinViewingDistance
Sets the minimum between the viewing point and the origin. If the current distance is lower than the new minimum, it will be set to this minimum value.- Parameters:
minViewingDistance- the minimum viewing distance.
-
getMaxViewingDistanceMultiplier
Returns the multiplier used to calculate the maximum permitted distance between the viewing point and the origin. The multiplier is applied to the minimum viewing distance. The default value is 8.0.- Returns:
- The multiplier.
-
setMaxViewingDistanceMultiplier
Sets the multiplier used to calculate the maximum viewing distance.- Parameters:
multiplier- the multiplier (must be > 1.0).
-
getPanIncrement
Returns the increment for panning left and right. This is an angle in radians, and the default value isMath.PI / 120.0.- Returns:
- The panning increment.
-
setPanIncrement
Sets the increment for panning left and right (an angle measured in radians).- Parameters:
increment- the angle in radians.
-
getRotateIncrement
Returns the increment for rotating up and down. This is an angle in radians, and the default value isMath.PI / 120.0.- Returns:
- The rotation increment.
-
setRotateIncrement
Sets the increment for rotating up and down (an angle measured in radians).- Parameters:
increment- the angle in radians.
-
isTooltipEnabled
Returns the flag that controls whether tooltips are enabled.- Returns:
- The flag.
-
setTooltipEnabled
Sets the flag that controls whether tooltips are enabled.- Parameters:
tooltipEnabled- the new flag value.
-
isRotateViewEnabled
Returns a flag that controls whether rotation by mouse dragging is enabled.- Returns:
- A boolean.
-
setRotateViewEnabled
Sets the flag that controls whether rotation by mouse dragging is enabled.- Parameters:
enabled- the new flag value.
-
zoomToFit
Adjusts the viewing distance so that the chart fits the specified size. A margin is left (seegetMargin()) around the edges to leave room for labels etc.- Parameters:
width- the width.height- the height.
-
draw
Draws the content of the canvas and updates therenderingInfoattribute with the latest rendering information. -
isResizable
Returntrueto indicate the canvas is resizable.- Overrides:
isResizablein classjavafx.scene.Node- Returns:
true.
-
updateTooltip
Updates the tooltip. This method will return without doing anything if thetooltipEnabledflag is set to false.- Parameters:
me- the mouse event.
-
chartChanged
Redraws the chart whenever a chart change event is received.- Specified by:
chartChangedin interfaceorg.jfree.chart3d.Chart3DChangeListener- Parameters:
event- the event (nullnot permitted).
-