org.jfree.chart.fx
Class ChartViewer
- java.lang.Object
-
- javafx.scene.Node
-
- javafx.scene.Parent
-
- javafx.scene.layout.Region
-
- javafx.scene.control.Control
-
- org.jfree.chart.fx.ChartViewer
-
- All Implemented Interfaces:
- javafx.css.Styleable, javafx.event.EventTarget, javafx.scene.control.Skinnable, ChartMouseListenerFX
public class ChartViewer extends javafx.scene.control.Control implements javafx.scene.control.Skinnable, ChartMouseListenerFX
A control for displaying aJFreeChartin JavaFX (embeds aChartCanvas, adds drag zooming and provides a popup menu for export to PNG/JPG/SVG and PDF formats). Many behaviours(tooltips, zooming etc) are provided directly by the canvas.THE API FOR THIS CLASS IS SUBJECT TO CHANGE IN FUTURE RELEASES. This is so that we can incorporate feedback on the (new) JavaFX support in JFreeChart.
- Since:
- 1.0.18
-
-
Property Summary
-
Properties inherited from class javafx.scene.control.Control
contextMenuProperty, skinProperty, tooltipProperty
-
Properties inherited from class javafx.scene.layout.Region
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, heightProperty, insetsProperty, maxHeightProperty, maxWidthProperty, minHeightProperty, minWidthProperty, opaqueInsetsProperty, paddingProperty, prefHeightProperty, prefWidthProperty, scaleShapeProperty, shapeProperty, snapToPixelProperty, widthProperty
-
Properties inherited from class javafx.scene.Parent
impl_traversalEngineProperty, needsLayoutProperty
-
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, 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 Summary
Constructors Constructor and Description ChartViewer(JFreeChart chart)Creates a new viewer to display the supplied chart in JavaFX.ChartViewer(JFreeChart chart, boolean contextMenuEnabled)Creates a new viewer instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddChartMouseListener(ChartMouseListenerFX listener)Registers a listener to receiveChartMouseEventnotifications from this viewer.voidchartMouseClicked(ChartMouseEventFX event)Receives notification of a mouse click on a chart.voidchartMouseMoved(ChartMouseEventFX event)Receives notification of a mouse move event on a chart.JFreeChartgetChart()Returns the chart that is being displayed by this node.ChartRenderingInfogetRenderingInfo()Returns the rendering info from the most recent drawing of the chart.voidhideZoomRectangle()Hides the zoom rectangle.booleanisTooltipEnabled()Returns the flag that controls whether or not tooltips are displayed for the chart.voidremoveChartMouseListener(ChartMouseListenerFX listener)Removes a listener from the list of objects listening for chart mouse events.voidsetChart(JFreeChart chart)Sets the chart to be displayed by this node.voidsetTooltipEnabled(boolean enabled)Sets the flag that controls whether or not the chart tooltips are shown by this viewer.voidshowZoomRectangle(double x, double y, double w, double h)Sets the size and location of the zoom rectangle and makes it visible if it wasn't already visible.-
Methods inherited from class javafx.scene.control.Control
contextMenuProperty, executeAccessibleAction, getBaselineOffset, getClassCssMetaData, getContextMenu, getCssMetaData, getSkin, getTooltip, isResizable, queryAccessibleAttribute, setContextMenu, setSkin, setTooltip, skinProperty, tooltipProperty
-
Methods inherited from class javafx.scene.layout.Region
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getWidth, heightProperty, impl_computeGeomBounds, impl_createPeer, impl_updatePeer, insetsProperty, isCacheShape, isCenterShape, isScaleShape, isSnapToPixel, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapToPixelProperty, widthProperty
-
Methods inherited from class javafx.scene.Parent
getChildrenUnmodifiable, getImpl_traversalEngine, getStylesheets, impl_getAllParentStylesheets, impl_processMXNode, impl_traversalEngineProperty, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, setImpl_traversalEngine
-
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, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, 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_findStyles, impl_getLeafTransform, impl_getMatchingStyles, impl_getPeer, impl_getPivotX, impl_getPivotY, impl_getPivotZ, impl_getStyleMap, impl_hasTransforms, impl_isShowMnemonics, impl_isTreeVisible, impl_pickNode, impl_processCSS, impl_reapplyCSS, impl_setShowMnemonics, impl_setStyleMap, impl_showMnemonicsProperty, impl_syncPeer, impl_transformsChanged, impl_traverse, 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, lookupAll, managedProperty, 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, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, 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, setEffect, setEventDispatcher, setFocusTraversable, 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, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, visibleProperty
-
-
-
-
Constructor Detail
-
ChartViewer
public ChartViewer(JFreeChart chart)
Creates a new viewer to display the supplied chart in JavaFX.- Parameters:
chart- the chart (nullnot permitted).
-
ChartViewer
public ChartViewer(JFreeChart chart, boolean contextMenuEnabled)
Creates a new viewer instance.- Parameters:
chart- the chart (nullnot permitted).contextMenuEnabled- enable the context menu?
-
-
Method Detail
-
getChart
public JFreeChart getChart()
Returns the chart that is being displayed by this node.- Returns:
- The chart (never
null).
-
setChart
public void setChart(JFreeChart chart)
Sets the chart to be displayed by this node.- Parameters:
chart- the chart (nullnot permitted).
-
isTooltipEnabled
public boolean isTooltipEnabled()
Returns the flag that controls whether or not tooltips are displayed for the chart.- Returns:
- A boolean.
-
setTooltipEnabled
public void setTooltipEnabled(boolean enabled)
Sets the flag that controls whether or not the chart tooltips are shown by this viewer.- Parameters:
enabled- the new flag value.
-
getRenderingInfo
public ChartRenderingInfo getRenderingInfo()
Returns the rendering info from the most recent drawing of the chart.- Returns:
- The rendering info (possibly
null).
-
hideZoomRectangle
public void hideZoomRectangle()
Hides the zoom rectangle. The work is delegated to the control's current skin.
-
showZoomRectangle
public void showZoomRectangle(double x, double y, double w, double h)Sets the size and location of the zoom rectangle and makes it visible if it wasn't already visible. The work is delegated to the control's current skin.- Parameters:
x- the x-location.y- the y-location.w- the width.h- the height.
-
addChartMouseListener
public void addChartMouseListener(ChartMouseListenerFX listener)
Registers a listener to receiveChartMouseEventnotifications from this viewer.- Parameters:
listener- the listener (nullnot permitted).
-
removeChartMouseListener
public void removeChartMouseListener(ChartMouseListenerFX listener)
Removes a listener from the list of objects listening for chart mouse events.- Parameters:
listener- the listener.
-
chartMouseClicked
public void chartMouseClicked(ChartMouseEventFX event)
Description copied from interface:ChartMouseListenerFXReceives notification of a mouse click on a chart.- Specified by:
chartMouseClickedin interfaceChartMouseListenerFX- Parameters:
event- event information (nevernull).
-
chartMouseMoved
public void chartMouseMoved(ChartMouseEventFX event)
Description copied from interface:ChartMouseListenerFXReceives notification of a mouse move event on a chart.- Specified by:
chartMouseMovedin interfaceChartMouseListenerFX- Parameters:
event- event information (nevernull).
-
-
DMelt 3.0 © DataMelt by jWork.ORG