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, width

    Properties 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, 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

    Constructors
    Constructor Description
    Chart3DCanvas​(org.jfree.chart3d.Chart3D chart)
    Creates a new canvas to display the supplied chart in JavaFX.
  • Method Summary

    Modifier and Type Method Description
    void chartChanged​(org.jfree.chart3d.Chart3DChangeEvent event)
    Redraws the chart whenever a chart change event is received.
    void draw()
    Draws the content of the canvas and updates the renderingInfo attribute with the latest rendering information.
    org.jfree.chart3d.Chart3D getChart()
    Returns the chart that is being displayed by this node.
    double getMargin()
    Returns the margin that is used when zooming to fit.
    double getMaxViewingDistanceMultiplier()
    Returns the multiplier used to calculate the maximum permitted distance between the viewing point and the origin.
    double getMinViewingDistance()
    Returns the minimum distance between the viewing point and the origin.
    double getPanIncrement()
    Returns the increment for panning left and right.
    org.jfree.chart3d.graphics3d.RenderingInfo getRenderingInfo()
    Returns the rendering info from the most recent drawing of the chart.
    double getRotateIncrement()
    Returns the increment for rotating up and down.
    boolean isResizable()
    Return true to indicate the canvas is resizable.
    boolean isRotateViewEnabled()
    Returns a flag that controls whether or not rotation by mouse dragging is enabled.
    boolean isTooltipEnabled()
    Returns the flag that controls whether or not tooltips are enabled.
    void setChart​(org.jfree.chart3d.Chart3D chart)
    Sets the chart to be displayed by this node.
    void setMargin​(double margin)
    Sets the margin (note that this will not have an immediate effect, it will only be applied on the next call to zoomToFit(double, double)).
    void setMaxViewingDistanceMultiplier​(double multiplier)
    Sets the multiplier used to calculate the maximum viewing distance.
    void setMinViewingDistance​(double minViewingDistance)
    Sets the minimum between the viewing point and the origin.
    void setPanIncrement​(double increment)
    Sets the increment for panning left and right (an angle measured in radians).
    void setRotateIncrement​(double increment)
    Sets the increment for rotating up and down (an angle measured in radians).
    void setRotateViewEnabled​(boolean enabled)
    Sets the flag that controls whether or not rotation by mouse dragging is enabled.
    void setTooltipEnabled​(boolean tooltipEnabled)
    Sets the flag that controls whether or not tooltips are enabled.
    protected void updateTooltip​(javafx.scene.input.MouseEvent me)
    Updates the tooltip.
    void zoomToFit​(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, widthProperty

    Methods 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, 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, 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, visibleProperty

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface javafx.css.Styleable

    getStyleableNode
  • Constructor Details

    • Chart3DCanvas

      public Chart3DCanvas​(org.jfree.chart3d.Chart3D chart)
      Creates a new canvas to display the supplied chart in JavaFX.
      Parameters:
      chart - the chart (null not permitted).
  • Method Details

    • getChart

      public org.jfree.chart3d.Chart3D getChart()
      Returns the chart that is being displayed by this node.
      Returns:
      The chart (never null).
    • setChart

      public void setChart​(org.jfree.chart3d.Chart3D chart)
      Sets the chart to be displayed by this node.
      Parameters:
      chart - the chart (null not permitted).
    • getMargin

      public double 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

      public void setMargin​(double margin)
      Sets the margin (note that this will not have an immediate effect, it will only be applied on the next call to zoomToFit(double, double)).
      Parameters:
      margin - the margin.
    • getRenderingInfo

      public org.jfree.chart3d.graphics3d.RenderingInfo getRenderingInfo()
      Returns the rendering info from the most recent drawing of the chart.
      Returns:
      The rendering info (possibly null).
    • getMinViewingDistance

      public double 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

      public void setMinViewingDistance​(double minViewingDistance)
      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

      public void setMaxViewingDistanceMultiplier​(double multiplier)
      Sets the multiplier used to calculate the maximum viewing distance.
      Parameters:
      multiplier - the multiplier (must be > 1.0).
    • getPanIncrement

      public double getPanIncrement()
      Returns the increment for panning left and right. This is an angle in radians, and the default value is Math.PI / 120.0.
      Returns:
      The panning increment.
    • setPanIncrement

      public void setPanIncrement​(double increment)
      Sets the increment for panning left and right (an angle measured in radians).
      Parameters:
      increment - the angle in radians.
    • getRotateIncrement

      public double getRotateIncrement()
      Returns the increment for rotating up and down. This is an angle in radians, and the default value is Math.PI / 120.0.
      Returns:
      The rotate increment.
    • setRotateIncrement

      public void setRotateIncrement​(double increment)
      Sets the increment for rotating up and down (an angle measured in radians).
      Parameters:
      increment - the angle in radians.
    • isTooltipEnabled

      public boolean isTooltipEnabled()
      Returns the flag that controls whether or not tooltips are enabled.
      Returns:
      The flag.
    • setTooltipEnabled

      public void setTooltipEnabled​(boolean tooltipEnabled)
      Sets the flag that controls whether or not tooltips are enabled.
      Parameters:
      tooltipEnabled - the new flag value.
    • isRotateViewEnabled

      public boolean isRotateViewEnabled()
      Returns a flag that controls whether or not rotation by mouse dragging is enabled.
      Returns:
      A boolean.
    • setRotateViewEnabled

      public void setRotateViewEnabled​(boolean enabled)
      Sets the flag that controls whether or not rotation by mouse dragging is enabled.
      Parameters:
      enabled - the new flag value.
    • zoomToFit

      public void zoomToFit​(double width, double height)
      Adjusts the viewing distance so that the chart fits the specified size. A margin is left (see getMargin()) around the edges to leave room for labels etc.
      Parameters:
      width - the width.
      height - the height.
    • draw

      public void draw()
      Draws the content of the canvas and updates the renderingInfo attribute with the latest rendering information.
    • isResizable

      public boolean isResizable()
      Return true to indicate the canvas is resizable.
      Overrides:
      isResizable in class javafx.scene.Node
      Returns:
      true.
    • updateTooltip

      protected void updateTooltip​(javafx.scene.input.MouseEvent me)
      Updates the tooltip. This method will return without doing anything if the tooltipEnabled flag is set to false.
      Parameters:
      me - the mouse event.
    • chartChanged

      public void chartChanged​(org.jfree.chart3d.Chart3DChangeEvent event)
      Redraws the chart whenever a chart change event is received.
      Specified by:
      chartChanged in interface org.jfree.chart3d.Chart3DChangeListener
      Parameters:
      event - the event (null not permitted).