- java.lang.Object
-
- javafx.scene.Node
-
- javafx.scene.Parent
-
- javafx.scene.layout.Region
-
- javafx.scene.chart.Chart
-
- All Implemented Interfaces:
-
Styleable
,EventTarget
public abstract class Chart extends Region
所有图表的基础类。 它有3个部分的标题,图例和图表内容。 图表内容由图表的特定子类填充。- 从以下版本开始:
- JavaFX 2.0
-
-
Property Summary
Properties Type Property 描述 BooleanProperty
animated
当真的任何数据变化将被动画。protected ObjectProperty<Node>
legend
该节点显示为Legend。ObjectProperty<Side>
legendSide
图表侧面应显示图例BooleanProperty
legendVisible
当为true时,如果图表实现支持图例,图表将显示图例。StringProperty
title
图表标题ObjectProperty<Side>
titleSide
显示标题的图表侧-
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
-
Properties inherited from class javafx.scene.Parent
needsLayout
-
Properties inherited from class javafx.scene.layout.Region
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width
-
-
Field Summary
-
Fields inherited from class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT
-
Fields inherited from class javafx.scene.layout.Region
USE_COMPUTED_SIZE, USE_PREF_SIZE
-
-
构造方法摘要
构造方法 Constructor 描述 Chart()
创建一个新的默认图表实例。
-
方法摘要
所有方法 静态方法 接口方法 抽象方法 具体的方法 Modifier and Type 方法 描述 protected void
animate(Animation animation)
在动画完成后,在图形的每一帧上播放给定的动画图表。BooleanProperty
animatedProperty()
当真的任何数据变化将被动画。protected double
computeMinHeight(double width)
图表的大小在外,用户告诉图表,它有多少空间和图表在里面。protected double
computeMinWidth(double height)
图表的大小在外,用户告诉图表,它有多少空间和图表在里面。protected double
computePrefHeight(double width)
图表的大小在外,用户告诉图表,它有多少空间和图表在里面。protected double
computePrefWidth(double height)
图表的大小在外,用户告诉图表,它有多少空间和图表在里面。boolean
getAnimated()
指示数据更改是否将被动画化。protected ObservableList<Node>
getChartChildren()
图表中所有内容的可修改和可观察的列表。static List<CssMetaData<? extends Styleable,?>>
getClassCssMetaData()
List<CssMetaData<? extends Styleable,?>>
getCssMetaData()
该方法应该委托给Node.getClassCssMetaData()
,以便可以访问Node的CssMetaData而不需要反射。protected Node
getLegend()
获取属性图例的值。Side
getLegendSide()
获取属性legendSide的值。String
getTitle()
获取属性标题的值。Side
getTitleSide()
获取属性titleSide的值。boolean
isLegendVisible()
获取属性legendVisible的值。protected abstract void
layoutChartChildren(double top, double left, double width, double height)
调用更新和布局从getChartChildren()protected void
layoutChildren()
在布局传递期间调用以布局此图表及其所有内容。protected ObjectProperty<Node>
legendProperty()
该节点显示为Legend。ObjectProperty<Side>
legendSideProperty()
图表侧面应显示图例BooleanProperty
legendVisibleProperty()
当为true时,如果图表实现支持图例,图表将显示图例。protected void
requestChartLayout()
当你知道某些事情发生了变化,需要将图表转发出来时,就会调用它。void
setAnimated(boolean value)
设置动画属性的值。protected void
setLegend(Node value)
设置属性图例的值。void
setLegendSide(Side value)
设置属性legendSide的值。void
setLegendVisible(boolean value)
设置属性legendVisible的值。void
setTitle(String value)
设置属性标题的值。void
setTitleSide(Side value)
设置属性titleSide的值。protected boolean
shouldAnimate()
这是用来检查任何给定的动画是否应该运行。StringProperty
titleProperty()
图表标题ObjectProperty<Side>
titleSideProperty()
显示标题的图表侧-
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, 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, 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, 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 class javafx.scene.Parent
getBaselineOffset, getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, queryAccessibleAttribute, requestLayout, requestParentLayout, setNeedsLayout, updateBounds
-
Methods inherited from 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 inherited from interface javafx.css.Styleable
getStyleableNode
-
-
-
-
Property Detail
-
title
public final StringProperty titleProperty
图表标题- 另请参见:
-
getTitle()
,setTitle(String)
-
titleSide
public final ObjectProperty<Side> titleSideProperty
显示标题的图表侧- Default value:
- Side.TOP
- 另请参见:
-
getTitleSide()
,setTitleSide(Side)
-
legend
protected final ObjectProperty<Node> legendProperty
该节点显示为Legend。 子类可以在这里设置一个节点作为图例显示在一边。 如果没有图例,那么这可以设置为null- 另请参见:
-
getLegend()
,setLegend(Node)
-
legendVisible
public final BooleanProperty legendVisibleProperty
当为true时,如果图表实现支持图例,图表将显示图例。
-
legendSide
public final ObjectProperty<Side> legendSideProperty
图表侧面应显示图例- Default value:
- Side.BOTTOM
- 另请参见:
-
getLegendSide()
,setLegendSide(Side)
-
animated
public final BooleanProperty animatedProperty
当真的任何数据变化将被动画。- 另请参见:
-
getAnimated()
,setAnimated(boolean)
-
-
方法详细信息
-
getTitle
public final String getTitle()
获取属性标题的值。- Property description:
- 图表标题
-
setTitle
public final void setTitle(String value)
设置属性标题的值。- Property description:
- 图表标题
-
titleProperty
public final StringProperty titleProperty()
图表标题- 另请参见:
-
getTitle()
,setTitle(String)
-
getTitleSide
public final Side getTitleSide()
获取属性titleSide的值。- Property description:
- 显示标题的图表侧
- Default value:
- Side.TOP
-
setTitleSide
public final void setTitleSide(Side value)
设置属性titleSide的值。- Property description:
- 显示标题的图表侧
- Default value:
- Side.TOP
-
titleSideProperty
public final ObjectProperty<Side> titleSideProperty()
显示标题的图表侧- Default value:
- Side.TOP
- 另请参见:
-
getTitleSide()
,setTitleSide(Side)
-
getLegend
protected final Node getLegend()
获取属性图例的值。- Property description:
- 该节点显示为Legend。 子类可以在这里设置一个节点作为图例显示在一边。 如果没有图例,那么这可以设置为null
-
setLegend
protected final void setLegend(Node value)
设置属性图例的值。- Property description:
- 该节点显示为Legend。 子类可以在这里设置一个节点作为图例显示在一边。 如果没有图例,那么这可以设置为null
-
legendProperty
protected final ObjectProperty<Node> legendProperty()
该节点显示为Legend。 子类可以在这里设置一个节点作为图例显示在一边。 如果没有图例,那么这可以设置为null- 另请参见:
-
getLegend()
,setLegend(Node)
-
isLegendVisible
public final boolean isLegendVisible()
获取属性legendVisible的值。- Property description:
- 当为true时,如果图表实现支持图例,图表将显示图例。
-
setLegendVisible
public final void setLegendVisible(boolean value)
设置属性legendVisible的值。- Property description:
- 当为true时,如果图表实现支持图例,图表将显示图例。
-
legendVisibleProperty
public final BooleanProperty legendVisibleProperty()
当为true时,如果图表实现支持图例,图表将显示图例。
-
getLegendSide
public final Side getLegendSide()
获取属性legendSide的值。- Property description:
- 图表侧面应显示图例
- Default value:
- Side.BOTTOM
-
setLegendSide
public final void setLegendSide(Side value)
设置属性legendSide的值。- Property description:
- 图表侧面应显示图例
- Default value:
- Side.BOTTOM
-
legendSideProperty
public final ObjectProperty<Side> legendSideProperty()
图表侧面应显示图例- Default value:
- Side.BOTTOM
- 另请参见:
-
getLegendSide()
,setLegendSide(Side)
-
getAnimated
public final boolean getAnimated()
指示数据更改是否将被动画化。- 结果
- 如果数据更改将被动画化,否则为false。
-
setAnimated
public final void setAnimated(boolean value)
设置动画属性的值。- Property description:
- 当真的任何数据变化将被动画。
-
animatedProperty
public final BooleanProperty animatedProperty()
当真的任何数据变化将被动画。- 另请参见:
-
getAnimated()
,setAnimated(boolean)
-
getChartChildren
protected ObservableList<Node> getChartChildren()
图表中所有内容的可修改和可观察的列表。 这就是Chart的实现应该添加任何用来绘制图表的节点。 这不包括这个课程照顾的传说和标题。- 结果
- 可观察的情节儿童列表
-
animate
protected void animate(Animation animation)
在动画完成后,在图形的每一帧上播放给定的动画图表。 因此,为了向图表添加动画,请在数据模型上创建一个动画,然后在layoutChartContent()映射数据模型中创建动画,然后使用动画调用此方法。- 参数
-
animation
- 要玩的动画
-
requestChartLayout
protected void requestChartLayout()
当你知道某些事情发生了变化,需要将图表转发出来时,就会调用它。
-
shouldAnimate
protected final boolean shouldAnimate()
这是用来检查任何给定的动画是否应该运行。 如果启用了动画并且节点在可见的场景中,则返回true。- 结果
- 如果启用动画并且节点可见并且在场景中,则为true
-
layoutChartChildren
protected abstract void layoutChartChildren(double top, double left, double width, double height)
调用更新和布局从getChartChildren()- 参数
-
top
- 从原始位置的顶部偏移量来计算图表内容上的任何填充 -
left
- 从原点向左偏移以计算图表内容上的任何填充 -
width
- 布局图表的区域的宽度 -
height
- 布局图表的区域的高度
-
layoutChildren
protected void layoutChildren()
在布局传递期间调用以布局此图表及其所有内容。- 重写:
-
layoutChildren
在Parent
-
computeMinHeight
protected double computeMinHeight(double width)
图表的大小在外,用户告诉图表,它有多少空间和图表在里面。 所以最小高度是一个常数150。- 重写:
-
computeMinHeight
在Region
- 参数
-
width
- 如果最小高度取决于应该使用的宽度 - 结果
- 计算该区域的最小高度
-
computeMinWidth
protected double computeMinWidth(double height)
图表的大小在外,用户告诉图表,它有多少空间和图表在里面。 所以最小宽度是一个常数200。- 重写:
-
computeMinWidth
在Region
- 参数
-
height
- 如果最小宽度取决于应该使用的高度 - 结果
- 计算出该区域的最小宽度
-
computePrefWidth
protected double computePrefWidth(double height)
图表的大小在外,用户告诉图表,它有多少空间和图表在里面。 所以优选的宽度是500。- 重写:
-
computePrefWidth
在Region
- 参数
-
height
- 如果首选宽度取决于应该使用的高度 - 结果
- 计算这个区域的首选宽度
-
computePrefHeight
protected double computePrefHeight(double width)
图表的大小在外,用户告诉图表,它有多少空间和图表在里面。 所以优选的高度是一个常数400。- 重写:
-
computePrefHeight
在Region
- 参数
-
width
- 如果偏好的高度取决于应该使用的宽度 - 结果
- 该区域计算的优选高度
-
getClassCssMetaData
public static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
- 结果
- 与此类相关联的CssMetaData可能包括其类的CssMetaData。
- 从以下版本开始:
- JavaFX 8.0
-
getCssMetaData
public List<CssMetaData<? extends Styleable,?>> getCssMetaData()
该方法应该委托给Node.getClassCssMetaData()
,以便可以访问节点的CssMetaData而不需要反射。- Specified by:
-
getCssMetaData
在接口Styleable
- 重写:
-
getCssMetaData
在Region
- 结果
- 与该节点相关联的CssMetaData,其可以包括其超类的CssMetaData。
- 从以下版本开始:
- JavaFX 8.0
-
-