X
- type of X valuesY
- type of Y valuespublic class XYChartPane<X,Y> extends Region
XYChart
s that allows adding custom chart plugins
and
overlay
different chart types. The basic usage of the pane is following:
NumericAxis xAxis = new NumericAxis();
xAxis.setAnimated(false);
NumericAxis yAxis = new NumericAxis();
yAxis.setAnimated(false);
yAxis.setAutoRangePadding(0.1);
LineChart<Number, Number> lineChart = new LineChart<>(xAxis, yAxis);
XYChartPane<Number, Number> chartPane = new XYChartPane<>(lineChart);
chartPane.getPlugins().addAll(new Zoomer(), new Panner(), new DataPointTooltip<>());
Note that certain plugin implementations such as Zoomer
or Panner
work properly only if both X and
Y axis are instances of NumericAxis
.
The overlay charts can be added on top of the base chart:
ScatterChart<Number, Number> overlayChart1 = ...;
ScatterChart<Number, Number> overlayChart2 = ...;
chartPane.getOverlayCharts().addAll(overlayChart1, overlayChart2);
Constraints concerning overlay charts:
null
(to make it transparent and to not intercept mouse
events).auto-ranging
is set to false
(to follow the range of the base chart).commonYAxisProperty()
can be used to configure a single (common) Y axis or independent axes for each
chart. The Y axis side
is respected for each overlay chart. If the commonYAxis
property is value is true
the Y axis range follows the range of the base chart's Y axis.title
of individual charts added to the pane are set to null
. Use
titleProperty()
instead.visibility
or side
will have no effect. Instead set legend's visibility and side
using XYChartPane properties with the same names.Type | Property and Description |
---|---|
BooleanProperty |
commonYAxis
Indicates whether
overlay charts should share Y axis with the base
chart or axis of each chart should be rendered separately. |
ObjectProperty<Side> |
legendSide
Side of the chart pane where the legend should be displayed.
|
BooleanProperty |
legendVisible
Indicates whether the chart legend should be visible.
|
StringProperty |
title
Title property.
|
ObjectProperty<Side> |
titleSide
The side of the chart where the title is displayed.
|
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, heightProperty, insetsProperty, maxHeightProperty, maxWidthProperty, minHeightProperty, minWidthProperty, opaqueInsetsProperty, paddingProperty, prefHeightProperty, prefWidthProperty, scaleShapeProperty, shapeProperty, snapToPixelProperty, widthProperty
impl_traversalEngineProperty, needsLayoutProperty
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
USE_COMPUTED_SIZE, USE_PREF_SIZE
BASELINE_OFFSET_SAME_AS_HEIGHT
Constructor and Description |
---|
XYChartPane(XYChart<X,Y> chart)
Creates a new instance of
ChartPane with given chart. |
Modifier and Type | Method and Description |
---|---|
BooleanProperty |
commonYAxisProperty()
Indicates whether
overlay charts should share Y axis with the base
chart or axis of each chart should be rendered separately. |
void |
enableAxisAutoRanging()
Enables
auto-ranging property on both X and Y axis by calling
enableXAxisAutoRanging() and enableYAxisAutoRanging() . |
void |
enableXAxisAutoRanging()
Enables
auto-ranging property on the base chart X axis. |
void |
enableYAxisAutoRanging()
|
XYChart<X,Y> |
getChart()
Returns the base chart associated with this pane.
|
static List<CssMetaData<? extends Styleable,?>> |
getClassCssMetaData() |
List<CssMetaData<? extends Styleable,?>> |
getCssMetaData() |
Side |
getLegendSide()
Returns the value of the
legendSideProperty() . |
ObservableList<XYChart<X,Y>> |
getOverlayCharts()
Returns a list of overlay charts rendered on top of the
base chart . |
Bounds |
getPlotAreaBounds()
Returns bounds of the plot area within the coordinates of the
ChartPane . |
ObservableList<XYChartPlugin<X,Y>> |
getPlugins()
Returns a list of pluggins added to this chart pane.
|
String |
getTitle()
Returns the value of the
titleProperty() . |
Side |
getTitleSide()
Returns the value of the
titleSideProperty() . |
String |
getUserAgentStylesheet() |
boolean |
isCommonYAxis()
Returns the value of the
commonYAxisProperty() . |
boolean |
isLegendVisible()
Returns the value of the
legendVisibleProperty() . |
protected void |
layoutChildren() |
ObjectProperty<Side> |
legendSideProperty()
Side of the chart pane where the legend should be displayed.
|
BooleanProperty |
legendVisibleProperty()
Indicates whether the chart legend should be visible.
|
void |
setCommonYAxis(boolean shareYAxis)
Sets the value of the
commonYAxisProperty() . |
void |
setLegendSide(Side value)
Sets the value of the
legendSideProperty() . |
void |
setLegendVisible(boolean value)
Sets the value of the
legendVisibleProperty() . |
void |
setTitle(String value)
Sets the value of the
titleProperty() . |
void |
setTitleSide(Side value)
Sets the value of the
titleSideProperty() . |
StringProperty |
titleProperty()
Title property.
|
ObjectProperty<Side> |
titleSideProperty()
The side of the chart where the title is displayed.
|
Bounds |
toPlotArea(Bounds bounds)
Translates bounds from chart pane coordinates to the plot area coordinates.
|
Point2D |
toPlotArea(double xCoord,
double yCoord)
Translates point from chart pane coordinates to the plot area coordinates.
|
Point2D |
toPlotArea(Point2D point)
Translates point from ChartPane coordinates to the plot area coordinates.
|
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getWidth, heightProperty, impl_computeContains, impl_computeGeomBounds, impl_computeLayoutBounds, impl_createPeer, impl_notifyLayoutBoundsChanged, impl_pickNodeLocal, impl_updatePeer, insetsProperty, isCacheShape, isCenterShape, isResizable, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapSize, snapSpace, snapToPixelProperty, widthProperty
getBaselineOffset, getChildren, getChildrenUnmodifiable, getImpl_traversalEngine, getManagedChildren, getStylesheets, impl_getAllParentStylesheets, impl_processCSS, impl_processMXNode, impl_traversalEngineProperty, isNeedsLayout, layout, lookup, needsLayoutProperty, queryAccessibleAttribute, requestLayout, requestParentLayout, setImpl_traversalEngine, setNeedsLayout, updateBounds
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, 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_clearDirty, impl_computeIntersects, 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_pickNode, 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, 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, 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
public final BooleanProperty commonYAxisProperty
overlay charts
should share Y axis with the base
chart
or axis of each chart should be rendered separately.
Default Value: false
isCommonYAxis()
,
setCommonYAxis(boolean)
public final StringProperty titleProperty
title
of individual charts.getTitle()
,
setTitle(String)
public final ObjectProperty<Side> titleSideProperty
Default Value: Side.TOP
getTitleSide()
,
setTitleSide(Side)
public final BooleanProperty legendVisibleProperty
isLegendVisible()
,
setLegendVisible(boolean)
public final ObjectProperty<Side> legendSideProperty
Default Value: Side.BOTTOM
getLegendSide()
,
setLegendSide(Side)
public String getUserAgentStylesheet()
getUserAgentStylesheet
in class Region
public final XYChart<X,Y> getChart()
public final ObservableList<XYChart<X,Y>> getOverlayCharts()
base chart
.public final ObservableList<XYChartPlugin<X,Y>> getPlugins()
public final Bounds getPlotAreaBounds()
ChartPane
.public final Point2D toPlotArea(Point2D point)
point
- the point to translatepublic final Point2D toPlotArea(double xCoord, double yCoord)
xCoord
- the x coordinate within ChartPane coordinates systemyCoord
- the y coordinate within ChartPane coordinates systempublic final Bounds toPlotArea(Bounds bounds)
bounds
- the bounds within ChartPane coordinates systempublic final void enableAxisAutoRanging()
auto-ranging
property on both X and Y axis by calling
enableXAxisAutoRanging()
and enableYAxisAutoRanging()
.public final void enableXAxisAutoRanging()
auto-ranging
property on the base chart
X axis.
Note that overlay chart
X axes should have always the auto-ranging property set to
false
as their range should follow the range of the base chart X axis.public final void enableYAxisAutoRanging()
auto-ranging
property on the base chart
Y axis and
possibly on overlay charts
Y axes. true
only if
commonYAxisProperty()
is false
. In other words if there is a single Y axis, the auto-ranging of
all overlay chart Y axes should be disabled and follow the Y range of the base chart.protected void layoutChildren()
layoutChildren
in class Parent
public final BooleanProperty commonYAxisProperty()
overlay charts
should share Y axis with the base
chart
or axis of each chart should be rendered separately.
Default Value: false
isCommonYAxis()
,
setCommonYAxis(boolean)
public final void setCommonYAxis(boolean shareYAxis)
commonYAxisProperty()
.shareYAxis
- if true
all charts will share the Y axispublic final boolean isCommonYAxis()
commonYAxisProperty()
.commonYAxisProperty()
public final StringProperty titleProperty()
title
of individual charts.getTitle()
,
setTitle(String)
public final String getTitle()
titleProperty()
.public final void setTitle(String value)
titleProperty()
.value
- the new titlepublic final ObjectProperty<Side> titleSideProperty()
Default Value: Side.TOP
getTitleSide()
,
setTitleSide(Side)
public final Side getTitleSide()
titleSideProperty()
.public final void setTitleSide(Side value)
titleSideProperty()
.value
- the title sidepublic final BooleanProperty legendVisibleProperty()
isLegendVisible()
,
setLegendVisible(boolean)
public final boolean isLegendVisible()
legendVisibleProperty()
.true
if the legend is displayed, else false
public final void setLegendVisible(boolean value)
legendVisibleProperty()
.value
- true
to display the legend, false
to hide it.public final ObjectProperty<Side> legendSideProperty()
Default Value: Side.BOTTOM
getLegendSide()
,
setLegendSide(Side)
public final Side getLegendSide()
legendSideProperty()
.public final void setLegendSide(Side value)
legendSideProperty()
.value
- the side on which legend should be displayedpublic static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
public List<CssMetaData<? extends Styleable,?>> getCssMetaData()
getCssMetaData
in interface Styleable
getCssMetaData
in class Region
Copyright © 2019 CERN. All rights reserved.