- java.lang.Object
-
- javafx.scene.Node
-
- javafx.scene.Parent
-
- javafx.scene.layout.Region
-
- javafx.scene.chart.Chart
-
- javafx.scene.chart.XYChart<X,Y>
-
- javafx.scene.chart.BarChart<X,Y>
-
- All Implemented Interfaces:
-
Styleable
,EventTarget
public class BarChart<X,Y> extends XYChart<X,Y>
绘制一个指示类别数据值的条形图。 条可以是垂直或水平,取决于哪个轴是类别轴。- 从以下版本开始:
- JavaFX 2.0
-
-
Property Summary
Properties Type Property 描述 DoubleProperty
barGap
在同一类别的酒吧之间留下的差距DoubleProperty
categoryGap
在不同类别的酒吧之间留下的差距-
Properties inherited from class javafx.scene.chart.Chart
animated, legend, legendSide, legendVisible, title, 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
-
Properties inherited from class javafx.scene.chart.XYChart
alternativeColumnFillVisible, alternativeRowFillVisible, data, horizontalGridLinesVisible, horizontalZeroLineVisible, verticalGridLinesVisible, verticalZeroLineVisible
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javafx.scene.chart.XYChart
XYChart.Data<X,Y>, XYChart.Series<X,Y>
-
-
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 描述 BarChart(Axis<X> xAxis, Axis<Y> yAxis)
用给定的轴构建一个新的BarChart。BarChart(Axis<X> xAxis, Axis<Y> yAxis, ObservableList<XYChart.Series<X,Y>> data)
用给定的轴和数据构造一个新的BarChart。BarChart(Axis<X> xAxis, Axis<Y> yAxis, ObservableList<XYChart.Series<X,Y>> data, double categoryGap)
用给定的轴和数据构造一个新的BarChart。
-
方法摘要
所有方法 静态方法 接口方法 具体的方法 Modifier and Type 方法 描述 DoubleProperty
barGapProperty()
在同一类别的酒吧之间留下的差距DoubleProperty
categoryGapProperty()
在不同类别的酒吧之间留下的差距protected void
dataItemAdded(XYChart.Series<X,Y> series, int itemIndex, XYChart.Data<X,Y> item)
将数据项添加到系列时调用。protected void
dataItemChanged(XYChart.Data<X,Y> item)
数据项已更改时调用,即其xValue,yValue或extraValue已更改。protected void
dataItemRemoved(XYChart.Data<X,Y> item, XYChart.Series<X,Y> series)
当数据项已从数据模型中删除但在图表上仍然可见时调用。double
getBarGap()
获取属性barGap的值。double
getCategoryGap()
获取属性categoryGap的值。static List<CssMetaData<? extends Styleable,?>>
getClassCssMetaData()
List<CssMetaData<? extends Styleable,?>>
getCssMetaData()
该方法应该委托给Node.getClassCssMetaData()
,以便可以访问节点的CssMetaData而不需要反射。protected void
layoutPlotChildren()
被要求更新和布局情节儿童。protected void
seriesAdded(XYChart.Series<X,Y> series, int seriesIndex)
一系列已经添加到图表数据模型中。protected void
seriesChanged(ListChangeListener.Change<? extends XYChart.Series> c)
当将每个原子更改作为此图表的系列列表时调用protected void
seriesRemoved(XYChart.Series<X,Y> series)
数据模型中已经删除了一个系列,但它仍然可以在图表上显示。void
setBarGap(double value)
设置属性barGap的值。void
setCategoryGap(double value)
设置属性categoryGap的值。-
Methods inherited from 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 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
-
Methods inherited from class javafx.scene.chart.XYChart
alternativeColumnFillVisibleProperty, alternativeRowFillVisibleProperty, currentDisplayedExtraValueProperty, currentDisplayedXValueProperty, currentDisplayedYValueProperty, dataProperty, getCurrentDisplayedExtraValue, getCurrentDisplayedXValue, getCurrentDisplayedYValue, getData, getDisplayedDataIterator, getDisplayedSeriesIterator, getPlotChildren, getVerticalGridLinesVisible, getXAxis, getYAxis, horizontalGridLinesVisibleProperty, horizontalZeroLineVisibleProperty, isAlternativeColumnFillVisible, isAlternativeRowFillVisible, isHorizontalGridLinesVisible, isHorizontalZeroLineVisible, isVerticalZeroLineVisible, layoutChartChildren, removeDataItemFromDisplay, removeSeriesFromDisplay, setAlternativeColumnFillVisible, setAlternativeRowFillVisible, setCurrentDisplayedExtraValue, setCurrentDisplayedXValue, setCurrentDisplayedYValue, setData, setHorizontalGridLinesVisible, setHorizontalZeroLineVisible, setVerticalGridLinesVisible, setVerticalZeroLineVisible, updateAxisRange, updateLegend, verticalGridLinesVisibleProperty, verticalZeroLineVisibleProperty
-
-
-
-
Property Detail
-
barGap
public final DoubleProperty barGapProperty
在同一类别的酒吧之间留下的差距- 另请参见:
-
getBarGap()
,setBarGap(double)
-
categoryGap
public final DoubleProperty categoryGapProperty
在不同类别的酒吧之间留下的差距
-
-
构造方法详细信息
-
BarChart
public BarChart(Axis<X> xAxis, Axis<Y> yAxis)
用给定的轴构建一个新的BarChart。 两轴应该是ValueAxis / NumberAxis和CategoryAxis,它们可以是任意顺序,具体取决于是否要使用水平或垂直条形图。- 参数
-
xAxis
- 要使用的x轴 -
yAxis
- 要使用的y轴
-
BarChart
public BarChart(Axis<X> xAxis, Axis<Y> yAxis, ObservableList<XYChart.Series<X,Y>> data)
用给定的轴和数据构造一个新的BarChart。 两轴应该是ValueAxis / NumberAxis和CategoryAxis,它们可以是任意顺序,具体取决于是否要使用水平或垂直条形图。- 参数
-
xAxis
- 要使用的x轴 -
yAxis
- 要使用的y轴 -
data
- 要使用的数据,这是使用的实际列表,所以对其进行的任何更改将反映在图表中
-
BarChart
public BarChart(Axis<X> xAxis, Axis<Y> yAxis, ObservableList<XYChart.Series<X,Y>> data, double categoryGap)
用给定的轴和数据构造一个新的BarChart。 两轴应该是ValueAxis / NumberAxis和CategoryAxis,它们可以是任意顺序,具体取决于是否要使用水平或垂直条形图。- 参数
-
xAxis
- 要使用的x轴 -
yAxis
- 要使用的y轴 -
data
- 要使用的数据,这是使用的实际列表,所以对其进行的任何更改将反映在图表中 -
categoryGap
- 不同类别酒吧之间的差距
-
-
方法详细信息
-
getBarGap
public final double getBarGap()
获取属性barGap的值。- Property description:
- 在同一类别的酒吧之间留下的差距
-
setBarGap
public final void setBarGap(double value)
设置属性barGap的值。- Property description:
- 在同一类别的酒吧之间留下的差距
-
barGapProperty
public final DoubleProperty barGapProperty()
在同一类别的酒吧之间留下的差距- 另请参见:
-
getBarGap()
,setBarGap(double)
-
getCategoryGap
public final double getCategoryGap()
获取属性categoryGap的值。- Property description:
- 在不同类别的酒吧之间留下的差距
-
setCategoryGap
public final void setCategoryGap(double value)
设置属性categoryGap的值。- Property description:
- 在不同类别的酒吧之间留下的差距
-
categoryGapProperty
public final DoubleProperty categoryGapProperty()
在不同类别的酒吧之间留下的差距
-
dataItemAdded
protected void dataItemAdded(XYChart.Series<X,Y> series, int itemIndex, XYChart.Data<X,Y> item)
说明从类别复制:XYChart
将数据项添加到系列时调用。 这是XYChart的实现可以创建/添加新节点,以使getPlotChildren表示此数据项。 如果animated = true,他们也可以将数据添加为淡入淡出或相似。- Specified by:
-
dataItemAdded
在XYChart<X,Y>
- 参数
-
series
- 数据项被添加到的系列 -
itemIndex
- 系列中新项目的索引 -
item
- 添加的新数据项
-
dataItemRemoved
protected void dataItemRemoved(XYChart.Data<X,Y> item, XYChart.Series<X,Y> series)
描述从类别复制:XYChart
当数据项已从数据模型中删除但在图表上仍然可见时调用。 它仍然可见,以便您可以处理动画,以删除它在这种方法。 完成动画数据项后,您必须调用removeDataItemFromDisplay()来删除项目节点不显示在图表上。- Specified by:
-
dataItemRemoved
在XYChart<X,Y>
- 参数
-
item
- 从系列中删除的项目 -
series
- 该项目已被删除
-
dataItemChanged
protected void dataItemChanged(XYChart.Data<X,Y> item)
数据项已更改时调用,即其xValue,yValue或extraValue已更改。- Specified by:
-
dataItemChanged
在XYChart<X,Y>
- 参数
-
item
- 被更改的数据项
-
seriesChanged
protected void seriesChanged(ListChangeListener.Change<? extends XYChart.Series> c)
说明从类别复制:XYChart
当将每个原子更改作为此图表的系列列表时调用- 重写:
-
seriesChanged
在XYChart<X,Y>
- 参数
-
c
- 表示系列更改的更改实例
-
seriesAdded
protected void seriesAdded(XYChart.Series<X,Y> series, int seriesIndex)
说明从类别复制:XYChart
一系列已经添加到图表数据模型中。 这是XYChart的实现可以创建/添加新的节点来getPlotChildren来表示这个系列。 此外,您必须处理添加已经在系列中的任何数据项。 您可以简单地为每一个调用dataItemAdded(),或为要添加的整个系列提供一些不同的动画。- Specified by:
-
seriesAdded
在XYChart<X,Y>
- 参数
-
series
- 已添加的系列 -
seriesIndex
- 新系列的索引
-
seriesRemoved
protected void seriesRemoved(XYChart.Series<X,Y> series)
说明从类别复制:XYChart
数据模型中已经删除了一个系列,但它仍然可以在图表上显示。 它仍然可见,以便您可以处理动画,以删除它在这种方法。 完成动画数据项后,您必须调用removeSeriesFromDisplay()从显示列表中删除该系列。- Specified by:
-
seriesRemoved
在XYChart<X,Y>
- 参数
-
series
- 已被删除的系列
-
layoutPlotChildren
protected void layoutPlotChildren()
被要求更新和布局情节儿童。 这应该包括更新表示轴和网格线顶部的图的节点的所有工作。原点是绘图区域的左上角,绘制区域可以通过获取x轴的宽度及其高度从y轴的高度。- Specified by:
-
layoutPlotChildren
的XYChart<X,Y>
-
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
在XYChart<X,Y>
- 结果
- 与该节点相关联的CssMetaData,其可以包括其超类的CssMetaData。
- 从以下版本开始:
- JavaFX 8.0
-
-