com.orsoncharts.fx

## Class Chart3DCanvas

- java.lang.Object
- - javafx.scene.Node
  - - javafx.scene.canvas.Canvas
    - - com.orsoncharts.fx.Chart3DCanvas

- All Implemented Interfaces:
    Chart3DChangeListener, java.util.EventListener, javafx.css.Styleable, javafx.event.EventTarget

      public class Chart3DCanvas
      extends javafx.scene.canvas.Canvas
      implements 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.)
  Since:
    1.4

- - ### Property Summary

    - ### Properties inherited from class javafx.scene.canvas.Canvas

      `heightProperty, widthProperty`

    - ### Properties inherited from class javafx.scene.Node

      `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`

  - ### Field Summary

    - ### Fields inherited from class javafx.scene.Node

      `BASELINE_OFFSET_SAME_AS_HEIGHT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Chart3DCanvas(Chart3D chart)` Creates a new canvas to display the supplied chart in JavaFX.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `chartChanged(Chart3DChangeEvent event)` Called to inform that a chart change event has occurred.
    `void` | `draw()` Draws the content of the canvas and updates the `renderingInfo` attribute with the latest rendering information.
    `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.
    `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(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, impl_computeContains, impl_computeGeomBounds, impl_createPeer, impl_processMXNode, impl_updatePeer, 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, 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, visibleProperty`

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### Chart3DCanvas

          public Chart3DCanvas(Chart3D chart)

      Creates a new canvas to display the supplied chart in JavaFX.
      Parameters:
        `chart` - the chart (`null` not permitted).

  - ### Method Detail

    - #### getChart

          public Chart3D getChart()

      Returns the chart that is being displayed by this node.
      Returns:
        The chart (never `null`).

    - #### setChart

          public void setChart(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 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

          public double 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(Chart3DChangeEvent event)

      Description copied from interface: `Chart3DChangeListener`
      Called to inform that a chart change event has occurred.
      Specified by:
        `chartChanged` in interface `Chart3DChangeListener`
      Parameters:
        `event` - the event.