Class XYChart<X,Y>
java.lang.Object
javafx.scene.Node
javafx.scene.Parent
javafx.scene.layout.Region
javafx.scene.chart.Chart
javafx.scene.chart.XYChart<X,Y>
- Type Parameters:
-
X- the X axis value type -
Y- the Y axis value type
- All Implemented Interfaces:
-
Styleable,EventTarget
- Direct Known Subclasses:
-
AreaChart,BarChart,BubbleChart,LineChart,ScatterChart,StackedAreaChart,StackedBarChart
public abstract class XYChart<X,Y> extends Chart
Chart base class for all 2 axis charts. It is responsible for drawing the two axes and the plot content. It contains a list of all content in the plot and implementations of XYChart can add nodes to this list that need to be rendered.
It is possible to install Tooltips on data items / symbols. For example the following code snippet installs Tooltip on the 1st data item.
XYChart.Data item = ( XYChart.Data)series.getData().get(0);
Tooltip.install(item.getNode(), new Tooltip("Symbol-0"));
- Since:
- JavaFX 2.0
Nested Class Summary
| Modifier and Type | Class | Description |
|---|---|---|
static final class |
XYChart.Data<X, |
A single data item with data for 2 axis charts |
static final class |
XYChart.Series<X, |
A named series of data items |
Property Summary
| Type | Property | Description |
|---|---|---|
final BooleanProperty |
alternativeColumnFillVisible |
If true then alternative vertical columns will have fills |
final BooleanProperty |
alternativeRowFillVisible |
If true then alternative horizontal rows will have fills |
final ObjectProperty |
data |
XYCharts data |
final BooleanProperty |
horizontalGridLinesVisible |
True if horizontal grid lines should be drawn |
final BooleanProperty |
horizontalZeroLineVisible |
If this is true and the horizontal axis has both positive and negative values then a additional axis line will be drawn at the zero point |
final BooleanProperty |
verticalGridLinesVisible |
True if vertical grid lines should be drawn |
final BooleanProperty |
verticalZeroLineVisible |
If this is true and the vertical axis has both positive and negative values then a additional axis line will be drawn at the zero point |
Properties declared in class javafx.scene.chart.Chart
animated, legend, legendSide, legendVisible, title, titleSide
Properties declared in class javafx.scene.layout.Region
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width
Properties declared in class javafx.scene.Parent
needsLayout
Properties declared in 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 declared in class javafx.scene.layout.Region
USE_COMPUTED_SIZE, USE_PREF_SIZE
Fields declared in class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT
Constructor Summary
| Constructor | Description |
|---|---|
XYChart |
Constructs a XYChart given the two axes. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
final BooleanProperty |
alternativeColumnFillVisibleProperty() |
If true then alternative vertical columns will have fills |
final BooleanProperty |
alternativeRowFillVisibleProperty() |
If true then alternative horizontal rows will have fills |
protected final ObjectProperty |
currentDisplayedExtraValueProperty |
The current displayed extra value property. |
protected final ObjectProperty |
currentDisplayedXValueProperty |
The current displayed data value property that is plotted on X axis. |
protected final ObjectProperty |
currentDisplayedYValueProperty |
The current displayed data value property that is plotted on Y axis. |
protected abstract void |
dataItemAdded |
Called when a data item has been added to a series. |
protected abstract void |
dataItemChanged |
Called when a data item has changed, ie its xValue, yValue or extraValue has changed. |
protected abstract void |
dataItemRemoved |
Called when a data item has been removed from data model but it is still visible on the chart. |
final ObjectProperty |
dataProperty() |
XYCharts data |
static List |
getClassCssMetaData() |
Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses. |
List |
getCssMetaData() |
This method should delegate to Node.getClassCssMetaData() so that a Node's CssMetaData can be accessed without the need for reflection. |
protected final Object |
getCurrentDisplayedExtraValue |
The current displayed data extra value. |
protected final X |
getCurrentDisplayedXValue |
The current displayed data value plotted on the X axis. |
protected final Y |
getCurrentDisplayedYValue |
The current displayed data value plotted on the Y axis. |
final ObservableList |
getData() |
Gets the value of the data property. |
protected final Iterator |
getDisplayedDataIterator |
XYChart maintains a list of all items currently displayed this includes all current data + any data items recently deleted that are in the process of being faded out. |
protected final Iterator |
getDisplayedSeriesIterator() |
XYChart maintains a list of all series currently displayed this includes all current series + any series that have recently been deleted that are in the process of being faded (animated) out. |
protected ObservableList |
getPlotChildren() |
Modifiable and observable list of all content in the plot. |
final boolean |
getVerticalGridLinesVisible() |
Indicates whether vertical grid lines are visible or not. |
Axis |
getXAxis() |
Get the X axis, by default it is along the bottom of the plot |
Axis |
getYAxis() |
Get the Y axis, by default it is along the left of the plot |
final BooleanProperty |
horizontalGridLinesVisibleProperty() |
True if horizontal grid lines should be drawn |
final BooleanProperty |
horizontalZeroLineVisibleProperty() |
If this is true and the horizontal axis has both positive and negative values then a additional axis line will be drawn at the zero point |
final boolean |
isAlternativeColumnFillVisible() |
Gets the value of the alternativeColumnFillVisible property. |
final boolean |
isAlternativeRowFillVisible() |
Gets the value of the alternativeRowFillVisible property. |
final boolean |
isHorizontalGridLinesVisible() |
Gets the value of the horizontalGridLinesVisible property. |
final boolean |
isHorizontalZeroLineVisible() |
Gets the value of the horizontalZeroLineVisible property. |
final boolean |
isVerticalZeroLineVisible() |
Gets the value of the verticalZeroLineVisible property. |
protected final void |
layoutChartChildren |
Called to update and layout the chart children available from getChartChildren() |
protected abstract void |
layoutPlotChildren() |
Called to update and layout the plot children. |
protected final void |
removeDataItemFromDisplay |
This should be called from dataItemRemoved() when you are finished with any animation for deleting the item from the chart. |
protected final void |
removeSeriesFromDisplay |
This should be called from seriesRemoved() when you are finished with any animation for deleting the series from the chart. |
protected abstract void |
seriesAdded |
A series has been added to the charts data model. |
protected void |
seriesChanged |
Called when each atomic change is made to the list of series for this chart |
protected abstract void |
seriesRemoved |
A series has been removed from the data model but it is still visible on the chart. |
final void |
setAlternativeColumnFillVisible |
Sets the value of the alternativeColumnFillVisible property. |
final void |
setAlternativeRowFillVisible |
Sets the value of the alternativeRowFillVisible property. |
protected final void |
setCurrentDisplayedExtraValue |
Set the current displayed data extra value. |
protected final void |
setCurrentDisplayedXValue |
Set the current displayed data value plotted on X axis. |
protected final void |
setCurrentDisplayedYValue |
Set the current displayed data value plotted on Y axis. |
final void |
setData |
Sets the value of the data property. |
final void |
setHorizontalGridLinesVisible |
Sets the value of the horizontalGridLinesVisible property. |
final void |
setHorizontalZeroLineVisible |
Sets the value of the horizontalZeroLineVisible property. |
final void |
setVerticalGridLinesVisible |
Sets the value of the verticalGridLinesVisible property. |
final void |
setVerticalZeroLineVisible |
Sets the value of the verticalZeroLineVisible property. |
protected void |
updateAxisRange() |
This is called when the range has been invalidated and we need to update it. |
protected void |
updateLegend() |
This is called whenever a series is added or removed and the legend needs to be updated |
final BooleanProperty |
verticalGridLinesVisibleProperty() |
True if vertical grid lines should be drawn |
final BooleanProperty |
verticalZeroLineVisibleProperty() |
If this is true and the vertical axis has both positive and negative values then a additional axis line will be drawn at the zero point |
Methods declared in class javafx.scene.chart.Chart
animate, animatedProperty, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, getAnimated, getChartChildren, getLegend, getLegendSide, getTitle, getTitleSide, isLegendVisible, layoutChildren, legendProperty, legendSideProperty, legendVisibleProperty, requestChartLayout, setAnimated, setLegend, setLegendSide, setLegendVisible, setTitle, setTitleSide, shouldAnimate, titleProperty, titleSideProperty
Methods declared in class javafx.scene.layout.Region
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, computeMaxHeight, computeMaxWidth, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, getWidth, heightProperty, 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, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthProperty
Methods declared in class javafx.scene.Parent
getBaselineOffset, getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBounds
Methods declared in 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, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, 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, 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, queryAccessibleAttribute, relocate, removeEventFilter, removeEventHandler, requestFocus, requestFocusTraversal, 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 declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods declared in interface javafx.css.Styleable
getStyleableNode
Property Details
data
public final ObjectProperty<ObservableList<XYChart.Series<X,Y>>> dataProperty
XYCharts data
- See Also:
verticalGridLinesVisible
public final BooleanProperty verticalGridLinesVisibleProperty
True if vertical grid lines should be drawn
- See Also:
horizontalGridLinesVisible
public final BooleanProperty horizontalGridLinesVisibleProperty
True if horizontal grid lines should be drawn
- See Also:
alternativeColumnFillVisible
public final BooleanProperty alternativeColumnFillVisibleProperty
If true then alternative vertical columns will have fills
- See Also:
alternativeRowFillVisible
public final BooleanProperty alternativeRowFillVisibleProperty
If true then alternative horizontal rows will have fills
- See Also:
verticalZeroLineVisible
public final BooleanProperty verticalZeroLineVisibleProperty
If this is true and the vertical axis has both positive and negative values then a additional axis line will be drawn at the zero point
- Default value:
- true
- See Also:
horizontalZeroLineVisible
public final BooleanProperty horizontalZeroLineVisibleProperty
If this is true and the horizontal axis has both positive and negative values then a additional axis line will be drawn at the zero point
- Default value:
- true
- See Also:
Constructor Details
XYChart
public XYChart(Axis<X> xAxis, Axis<Y> yAxis)
Constructs a XYChart given the two axes. The initial content for the chart plot background and plot area that includes vertical and horizontal grid lines and fills, are added.
- Parameters:
-
xAxis- X Axis for this XY chart -
yAxis- Y Axis for this XY chart
Method Details
getXAxis
public Axis<X> getXAxis()
Get the X axis, by default it is along the bottom of the plot
- Returns:
- the X axis of the chart
getYAxis
public Axis<Y> getYAxis()
Get the Y axis, by default it is along the left of the plot
- Returns:
- the Y axis of this chart
getData
public final ObservableList<XYChart.Series<X,Y>> getData()
Gets the value of the
data property.- Property description:
- XYCharts data
- Returns:
- the value of the
dataproperty - See Also:
setData
public final void setData(ObservableList<XYChart.Series<X,Y>> value)
Sets the value of the
data property.- Property description:
- XYCharts data
- Parameters:
-
value- the value for thedataproperty - See Also:
dataProperty
public final ObjectProperty<ObservableList<XYChart.Series<X,Y>>> dataProperty()
XYCharts data
- Returns:
- the
dataproperty - See Also:
getVerticalGridLinesVisible
public final boolean getVerticalGridLinesVisible()
Indicates whether vertical grid lines are visible or not.
- Returns:
- true if verticalGridLines are visible else false.
- See Also:
setVerticalGridLinesVisible
public final void setVerticalGridLinesVisible(boolean value)
Sets the value of the
verticalGridLinesVisible property.- Property description:
- True if vertical grid lines should be drawn
- Parameters:
-
value- the value for theverticalGridLinesVisibleproperty - See Also:
verticalGridLinesVisibleProperty
public final BooleanProperty verticalGridLinesVisibleProperty()
True if vertical grid lines should be drawn
- Returns:
- the
verticalGridLinesVisibleproperty - See Also:
isHorizontalGridLinesVisible
public final boolean isHorizontalGridLinesVisible()
Gets the value of the
horizontalGridLinesVisible property.- Property description:
- True if horizontal grid lines should be drawn
- Returns:
- the value of the
horizontalGridLinesVisibleproperty - See Also:
setHorizontalGridLinesVisible
public final void setHorizontalGridLinesVisible(boolean value)
Sets the value of the
horizontalGridLinesVisible property.- Property description:
- True if horizontal grid lines should be drawn
- Parameters:
-
value- the value for thehorizontalGridLinesVisibleproperty - See Also:
horizontalGridLinesVisibleProperty
public final BooleanProperty horizontalGridLinesVisibleProperty()
True if horizontal grid lines should be drawn
- Returns:
- the
horizontalGridLinesVisibleproperty - See Also:
isAlternativeColumnFillVisible
public final boolean isAlternativeColumnFillVisible()
Gets the value of the
alternativeColumnFillVisible property.- Property description:
- If true then alternative vertical columns will have fills
- Returns:
- the value of the
alternativeColumnFillVisibleproperty - See Also:
setAlternativeColumnFillVisible
public final void setAlternativeColumnFillVisible(boolean value)
Sets the value of the
alternativeColumnFillVisible property.- Property description:
- If true then alternative vertical columns will have fills
- Parameters:
-
value- the value for thealternativeColumnFillVisibleproperty - See Also:
alternativeColumnFillVisibleProperty
public final BooleanProperty alternativeColumnFillVisibleProperty()
If true then alternative vertical columns will have fills
- Returns:
- the
alternativeColumnFillVisibleproperty - See Also:
isAlternativeRowFillVisible
public final boolean isAlternativeRowFillVisible()
Gets the value of the
alternativeRowFillVisible property.- Property description:
- If true then alternative horizontal rows will have fills
- Returns:
- the value of the
alternativeRowFillVisibleproperty - See Also:
setAlternativeRowFillVisible
public final void setAlternativeRowFillVisible(boolean value)
Sets the value of the
alternativeRowFillVisible property.- Property description:
- If true then alternative horizontal rows will have fills
- Parameters:
-
value- the value for thealternativeRowFillVisibleproperty - See Also:
alternativeRowFillVisibleProperty
public final BooleanProperty alternativeRowFillVisibleProperty()
If true then alternative horizontal rows will have fills
- Returns:
- the
alternativeRowFillVisibleproperty - See Also:
isVerticalZeroLineVisible
public final boolean isVerticalZeroLineVisible()
Gets the value of the
verticalZeroLineVisible property.- Property description:
- If this is true and the vertical axis has both positive and negative values then a additional axis line will be drawn at the zero point
- Default value:
- true
- Returns:
- the value of the
verticalZeroLineVisibleproperty - See Also:
setVerticalZeroLineVisible
public final void setVerticalZeroLineVisible(boolean value)
Sets the value of the
verticalZeroLineVisible property.- Property description:
- If this is true and the vertical axis has both positive and negative values then a additional axis line will be drawn at the zero point
- Default value:
- true
- Parameters:
-
value- the value for theverticalZeroLineVisibleproperty - See Also:
verticalZeroLineVisibleProperty
public final BooleanProperty verticalZeroLineVisibleProperty()
If this is true and the vertical axis has both positive and negative values then a additional axis line will be drawn at the zero point
- Default value:
- true
- Returns:
- the
verticalZeroLineVisibleproperty - See Also:
isHorizontalZeroLineVisible
public final boolean isHorizontalZeroLineVisible()
Gets the value of the
horizontalZeroLineVisible property.- Property description:
- If this is true and the horizontal axis has both positive and negative values then a additional axis line will be drawn at the zero point
- Default value:
- true
- Returns:
- the value of the
horizontalZeroLineVisibleproperty - See Also:
setHorizontalZeroLineVisible
public final void setHorizontalZeroLineVisible(boolean value)
Sets the value of the
horizontalZeroLineVisible property.- Property description:
- If this is true and the horizontal axis has both positive and negative values then a additional axis line will be drawn at the zero point
- Default value:
- true
- Parameters:
-
value- the value for thehorizontalZeroLineVisibleproperty - See Also:
horizontalZeroLineVisibleProperty
public final BooleanProperty horizontalZeroLineVisibleProperty()
If this is true and the horizontal axis has both positive and negative values then a additional axis line will be drawn at the zero point
- Default value:
- true
- Returns:
- the
horizontalZeroLineVisibleproperty - See Also:
getPlotChildren
protected ObservableList<Node> getPlotChildren()
Modifiable and observable list of all content in the plot. This is where implementations of XYChart should add any nodes they use to draw their plot.
- Returns:
- Observable list of plot children
updateLegend
protected void updateLegend()
This is called whenever a series is added or removed and the legend needs to be updated
dataItemAdded
protected abstract void dataItemAdded(XYChart.Series<X,Y> series, int itemIndex, XYChart.Data<X,Y> item)
Called when a data item has been added to a series. This is where implementations of XYChart can create/add new nodes to getPlotChildren to represent this data item. They also may animate that data add with a fade in or similar if animated = true.
- Parameters:
-
series- The series the data item was added to -
itemIndex- The index of the new item within the series -
item- The new data item that was added
dataItemRemoved
protected abstract void dataItemRemoved(XYChart.Data<X,Y> item, XYChart.Series<X,Y> series)
Called when a data item has been removed from data model but it is still visible on the chart. Its still visible so that you can handle animation for removing it in this method. After you are done animating the data item you must call removeDataItemFromDisplay() to remove the items node from being displayed on the chart.
- Parameters:
-
item- The item that has been removed from the series -
series- The series the item was removed from
dataItemChanged
protected abstract void dataItemChanged(XYChart.Data<X,Y> item)
Called when a data item has changed, ie its xValue, yValue or extraValue has changed.
- Parameters:
-
item- The data item who was changed
seriesAdded
protected abstract void seriesAdded(XYChart.Series<X,Y> series, int seriesIndex)
A series has been added to the charts data model. This is where implementations of XYChart can create/add new nodes to getPlotChildren to represent this series. Also you have to handle adding any data items that are already in the series. You may simply call dataItemAdded() for each one or provide some different animation for a whole series being added.
- Parameters:
-
series- The series that has been added -
seriesIndex- The index of the new series
seriesRemoved
protected abstract void seriesRemoved(XYChart.Series<X,Y> series)
A series has been removed from the data model but it is still visible on the chart. Its still visible so that you can handle animation for removing it in this method. After you are done animating the data item you must call removeSeriesFromDisplay() to remove the series from the display list.
- Parameters:
-
series- The series that has been removed
seriesChanged
protected void seriesChanged(ListChangeListener.Change<? extends XYChart.Series> c)
Called when each atomic change is made to the list of series for this chart
- Parameters:
-
c- a Change instance representing the changes to the series
updateAxisRange
protected void updateAxisRange()
This is called when the range has been invalidated and we need to update it. If the axis are auto ranging then we compile a list of all data that the given axis has to plot and call invalidateRange() on the axis passing it that data.
layoutPlotChildren
protected abstract void layoutPlotChildren()
Called to update and layout the plot children. This should include all work to updates nodes representing the plot on top of the axis and grid lines etc. The origin is the top left of the plot area, the plot area with can be got by getting the width of the x axis and its height from the height of the y axis.
layoutChartChildren
protected final void layoutChartChildren(double top, double left, double width, double height)
Called to update and layout the chart children available from getChartChildren()
- Specified by:
-
layoutChartChildrenin classChart - Parameters:
-
top- The top offset from the origin to account for any padding on the chart content -
left- The left offset from the origin to account for any padding on the chart content -
width- The width of the area to layout the chart within -
height- The height of the area to layout the chart within
removeSeriesFromDisplay
protected final void removeSeriesFromDisplay(XYChart.Series<X,Y> series)
This should be called from seriesRemoved() when you are finished with any animation for deleting the series from the chart. It will remove the series from showing up in the Iterator returned by getDisplayedSeriesIterator().
- Parameters:
-
series- The series to remove
getDisplayedSeriesIterator
protected final Iterator<XYChart.Series<X,Y>> getDisplayedSeriesIterator()
XYChart maintains a list of all series currently displayed this includes all current series + any series that have recently been deleted that are in the process of being faded (animated) out. This creates and returns a iterator over that list. This is what implementations of XYChart should use when plotting data.
- Returns:
- iterator over currently displayed series
getCurrentDisplayedXValue
protected final X getCurrentDisplayedXValue(XYChart.Data<X,Y> item)
The current displayed data value plotted on the X axis. This may be the same as xValue or different. It is used by XYChart to animate the xValue from the old value to the new value. This is what you should plot in any custom XYChart implementations. Some XYChart chart implementations such as LineChart also use this to animate when data is added or removed.
- Parameters:
-
item- The XYChart.Data item from which the current X axis data value is obtained - Returns:
- The current displayed X data value
setCurrentDisplayedXValue
protected final void setCurrentDisplayedXValue(XYChart.Data<X,Y> item, X value)
Set the current displayed data value plotted on X axis.
- Parameters:
-
item- The XYChart.Data item from which the current X axis data value is obtained. -
value- The X axis data value - See Also:
currentDisplayedXValueProperty
protected final ObjectProperty<X> currentDisplayedXValueProperty(XYChart.Data<X,Y> item)
The current displayed data value property that is plotted on X axis.
- Parameters:
-
item- The XYChart.Data item from which the current X axis data value property object is obtained. - Returns:
- The current displayed X data value ObjectProperty.
- See Also:
getCurrentDisplayedYValue
protected final Y getCurrentDisplayedYValue(XYChart.Data<X,Y> item)
The current displayed data value plotted on the Y axis. This may be the same as yValue or different. It is used by XYChart to animate the yValue from the old value to the new value. This is what you should plot in any custom XYChart implementations. Some XYChart chart implementations such as LineChart also use this to animate when data is added or removed.
- Parameters:
-
item- The XYChart.Data item from which the current Y axis data value is obtained - Returns:
- The current displayed Y data value
setCurrentDisplayedYValue
protected final void setCurrentDisplayedYValue(XYChart.Data<X,Y> item, Y value)
Set the current displayed data value plotted on Y axis.
- Parameters:
-
item- The XYChart.Data item from which the current Y axis data value is obtained. -
value- The Y axis data value - See Also:
currentDisplayedYValueProperty
protected final ObjectProperty<Y> currentDisplayedYValueProperty(XYChart.Data<X,Y> item)
The current displayed data value property that is plotted on Y axis.
- Parameters:
-
item- The XYChart.Data item from which the current Y axis data value property object is obtained. - Returns:
- The current displayed Y data value ObjectProperty.
- See Also:
getCurrentDisplayedExtraValue
protected final Object getCurrentDisplayedExtraValue(XYChart.Data<X,Y> item)
The current displayed data extra value. This may be the same as extraValue or different. It is used by XYChart to animate the extraValue from the old value to the new value. This is what you should plot in any custom XYChart implementations.
- Parameters:
-
item- The XYChart.Data item from which the current extra value is obtained - Returns:
- The current extra value
setCurrentDisplayedExtraValue
protected final void setCurrentDisplayedExtraValue(XYChart.Data<X,Y> item, Object value)
Set the current displayed data extra value.
- Parameters:
-
item- The XYChart.Data item from which the current extra value is obtained. -
value- The extra value - See Also:
currentDisplayedExtraValueProperty
protected final ObjectProperty<Object> currentDisplayedExtraValueProperty(XYChart.Data<X,Y> item)
The current displayed extra value property.
- Parameters:
-
item- The XYChart.Data item from which the current extra value property object is obtained. - Returns:
- ObjectProperty<Object> The current extra value ObjectProperty
- See Also:
getDisplayedDataIterator
protected final Iterator<XYChart.Data<X,Y>> getDisplayedDataIterator(XYChart.Series<X,Y> series)
XYChart maintains a list of all items currently displayed this includes all current data + any data items recently deleted that are in the process of being faded out. This creates and returns a iterator over that list. This is what implementations of XYChart should use when plotting data.
- Parameters:
-
series- The series to get displayed data for - Returns:
- iterator over currently displayed items from this series
removeDataItemFromDisplay
protected final void removeDataItemFromDisplay(XYChart.Series<X,Y> series, XYChart.Data<X,Y> item)
This should be called from dataItemRemoved() when you are finished with any animation for deleting the item from the chart. It will remove the data item from showing up in the Iterator returned by getDisplayedDataIterator().
- Parameters:
-
series- The series to remove -
item- The item to remove from series's display list
getClassCssMetaData
public static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
Gets the
CssMetaData associated with this class, which may include the CssMetaData of its superclasses.- Returns:
- the
CssMetaData - Since:
- JavaFX 8.0
getCssMetaData
public List<CssMetaData<? extends Styleable,?>> getCssMetaData()
This method should delegate to
Node.getClassCssMetaData() so that a Node's CssMetaData can be accessed without the need for reflection.- Specified by:
-
getCssMetaDatain interfaceStyleable - Overrides:
-
getCssMetaDatain classChart - Returns:
- The CssMetaData associated with this node, which may include the CssMetaData of its superclasses.
- Since:
- JavaFX 8.0
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.