- java.lang.Object
-
- javafx.scene.Node
-
- javafx.scene.Parent
-
- javafx.scene.layout.Region
-
- javafx.scene.chart.Axis<String>
-
- javafx.scene.chart.CategoryAxis
-
- All Implemented Interfaces:
-
Styleable
,EventTarget
public final class CategoryAxis extends Axis<String>
一个轴实现,它将对字符串类别起作用,其中每个值作为轴上的唯一类别(刻度线)。- 从以下版本开始:
- JavaFX 2.0
-
-
Property Summary
Properties Type Property 描述 ReadOnlyDoubleProperty
categorySpacing
这是沿着这个轴线的一个类别和下一个类别之间的差距DoubleProperty
endMargin
最后一个刻度线与轴端之间的余量BooleanProperty
gapStartAndEnd
如果这是真的,那么刻度之间的一半空格留在开始和结束DoubleProperty
startMargin
轴开始和第一个刻度线之间的余量-
Properties inherited from class javafx.scene.chart.Axis
animated, autoRanging, label, side, tickLabelFill, tickLabelFont, tickLabelGap, tickLabelRotation, tickLabelsVisible, tickLength, tickMarkVisible
-
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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javafx.scene.chart.Axis
Axis.TickMark<T>
-
-
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 描述 CategoryAxis()
创建一个具有空列表类别的自动范围类别轴。CategoryAxis(ObservableList<String> categories)
创建具有给定类别的类别轴。
-
方法摘要
所有方法 静态方法 接口方法 具体的方法 Modifier and Type 方法 描述 protected Object
autoRange(double length)
这将根据提供给invalidateRange()方法的数据计算类别。protected List<String>
calculateTickValues(double length, Object range)
计算范围内每个刻度线的所有数据值的列表ReadOnlyDoubleProperty
categorySpacingProperty()
这是沿着这个轴线的一个类别和下一个类别之间的差距DoubleProperty
endMarginProperty()
最后一个刻度线与轴端之间的余量BooleanProperty
gapStartAndEndProperty()
如果这是真的,那么刻度之间的一半空格留在开始和结束ObservableList<String>
getCategories()
返回在此轴上绘制的类别的ObservableList
。double
getCategorySpacing()
获取属性categorySpacing的值。static List<CssMetaData<? extends Styleable,?>>
getClassCssMetaData()
List<CssMetaData<? extends Styleable,?>>
getCssMetaData()
该方法应该委托给Node.getClassCssMetaData()
,以便可以访问Node的CssMetaData而不需要反射。double
getDisplayPosition(String value)
获取给定值的沿该轴的显示位置。double
getEndMargin()
获取属性endMargin的值。protected Object
getRange()
被称为获取当前的轴范围。double
getStartMargin()
获取属性startMargin的值。protected String
getTickMarkLabel(String value)
获取具有给定值的刻度线的字符串标签名称String
getValueForDisplay(double displayPosition)
获取此轴上给定显示位置的数据值。double
getZeroPosition()
获取沿该轴的零线的显示位置。void
invalidateRange(List<String> data)
数据更改时调用,范围可能不再有效。boolean
isGapStartAndEnd()
获取属性gapStartAndEnd的值。boolean
isValueOnAxis(String value)
检查给定值是否在该轴上是可绘制的protected Dimension2D
measureTickMarkSize(String value, Object range)
测量给定刻度标记值的标签尺寸。void
setCategories(ObservableList<String> value)
在此轴上绘制的类别的有序列表。void
setEndMargin(double value)
设置属性endMargin的值。void
setGapStartAndEnd(boolean value)
设置属性gapStartAndEnd的值。protected void
setRange(Object range, boolean animate)
调用将当前轴范围设置为给定范围。void
setStartMargin(double value)
设置属性startMargin的值。DoubleProperty
startMarginProperty()
轴开始和第一个刻度线之间的余量double
toNumericValue(String value)
所有轴值必须由某些数值表示。String
toRealValue(double value)
所有轴值必须由某些数值表示。-
Methods inherited from class javafx.scene.chart.Axis
animatedProperty, autoRangingProperty, computePrefHeight, computePrefWidth, getAnimated, getLabel, getSide, getTickLabelFill, getTickLabelFont, getTickLabelGap, getTickLabelRotation, getTickLength, getTickMarks, invalidateRange, isAutoRanging, isRangeValid, isTickLabelsVisible, isTickMarkVisible, labelProperty, layoutChildren, measureTickMarkLabelSize, measureTickMarkSize, requestAxisLayout, requestLayout, setAnimated, setAutoRanging, setLabel, setSide, setTickLabelFill, setTickLabelFont, setTickLabelGap, setTickLabelRotation, setTickLabelsVisible, setTickLength, setTickMarkVisible, shouldAnimate, sideProperty, tickLabelFillProperty, tickLabelFontProperty, tickLabelGapProperty, tickLabelRotationProperty, tickLabelsVisibleProperty, tickLengthProperty, tickMarksUpdated, tickMarkVisibleProperty
-
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, requestParentLayout, setNeedsLayout, updateBounds
-
Methods inherited from class javafx.scene.layout.Region
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, 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
-
startMargin
public final DoubleProperty startMarginProperty
轴开始和第一个刻度线之间的余量
-
endMargin
public final DoubleProperty endMarginProperty
最后一个刻度线与轴端之间的余量- 另请参见:
-
getEndMargin()
,setEndMargin(double)
-
gapStartAndEnd
public final BooleanProperty gapStartAndEndProperty
如果这是真的,那么刻度之间的一半空格留在开始和结束
-
categorySpacing
public final ReadOnlyDoubleProperty categorySpacingProperty
这是沿着这个轴线的一个类别和下一个类别之间的差距- 另请参见:
-
getCategorySpacing()
-
-
构造方法详细信息
-
CategoryAxis
public CategoryAxis()
创建一个具有空列表类别的自动范围类别轴。
-
CategoryAxis
public CategoryAxis(ObservableList<String> categories)
创建具有给定类别的类别轴。 这不会是自动范围的,而是按照给定的类别进行修改。- 参数
-
categories
- 此轴的类别列表
-
-
方法详细信息
-
getStartMargin
public final double getStartMargin()
获取属性startMargin的值。- Property description:
- 轴开始和第一个刻度线之间的余量
-
setStartMargin
public final void setStartMargin(double value)
设置属性startMargin的值。- Property description:
- 轴开始和第一个刻度线之间的余量
-
startMarginProperty
public final DoubleProperty startMarginProperty()
轴开始和第一个刻度线之间的余量
-
getEndMargin
public final double getEndMargin()
获取属性endMargin的值。- Property description:
- 最后一个刻度线与轴端之间的余量
-
setEndMargin
public final void setEndMargin(double value)
设置属性endMargin的值。- Property description:
- 最后一个刻度线与轴端之间的余量
-
endMarginProperty
public final DoubleProperty endMarginProperty()
最后一个刻度线与轴端之间的余量- 另请参见:
-
getEndMargin()
,setEndMargin(double)
-
isGapStartAndEnd
public final boolean isGapStartAndEnd()
获取属性gapStartAndEnd的值。- Property description:
- 如果这是真的,那么刻度之间的一半空格留在开始和结束
-
setGapStartAndEnd
public final void setGapStartAndEnd(boolean value)
设置属性gapStartAndEnd的值。- Property description:
- 如果这是真的,那么刻度之间的一半空格留在开始和结束
-
gapStartAndEndProperty
public final BooleanProperty gapStartAndEndProperty()
如果这是真的,那么刻度之间的一半空格留在开始和结束
-
setCategories
public final void setCategories(ObservableList<String> value)
在此轴上绘制的类别的有序列表。 如果autoRanging为true,则会根据图表数据自动设置。 如果应用程序设置了类别,那么自动测距关闭。 如果尝试将重复条目添加到此列表中,则抛出一个IllegalArgumentException
。- 参数
-
value
- 在此轴上绘制的类别的有序列表
-
getCategories
public final ObservableList<String> getCategories()
返回在该轴上绘制的类别的ObservableList
。- 结果
- ObservableList这个轴的类别列表。
- 另请参见:
-
categories
-
getCategorySpacing
public final double getCategorySpacing()
获取属性categorySpacing的值。- Property description:
- 这是沿着这个轴线的一个类别和下一个类别之间的差距
-
categorySpacingProperty
public final ReadOnlyDoubleProperty categorySpacingProperty()
这是沿着这个轴线的一个类别和下一个类别之间的差距- 另请参见:
-
getCategorySpacing()
-
getRange
protected Object getRange()
被称为获取当前的轴范围。
-
setRange
protected void setRange(Object range, boolean animate)
调用将当前轴范围设置为给定范围。 如果isAnimating()为true,那么此方法应将范围设置为新范围。
-
autoRange
protected Object autoRange(double length)
这将根据提供给invalidateRange()方法的数据计算类别。 这不能影响轴的状态,改变轴的任何属性。 应在范围对象中返回自动范围的任何结果。 如果已决定为此轴采用此范围,我们将传递给setRange()。
-
calculateTickValues
protected List<String> calculateTickValues(double length, Object range)
计算范围内每个刻度线的所有数据值的列表- Specified by:
-
calculateTickValues
在Axis<String>
- 参数
-
length
- 显示单位轴的长度 -
range
- 从autoRange()返回的范围对象 - 结果
- 如果是给定长度,则可以沿轴线拟合的刻度线列表
-
getTickMarkLabel
protected String getTickMarkLabel(String value)
获取具有给定值的刻度线的字符串标签名称- Specified by:
-
getTickMarkLabel
在Axis<String>
- 参数
-
value
- 要格式化为刻度标签字符串的值 - 结果
- 给定值的格式化字符串
-
measureTickMarkSize
protected Dimension2D measureTickMarkSize(String value, Object range)
测量给定刻度标记值的标签尺寸。 这使用为刻度线设置的字体- 重写:
-
measureTickMarkSize
在Axis<String>
- 参数
-
value
- 刻度值 -
range
- 计算期间使用的范围 - 结果
- 给定值的刻度标签的大小
-
invalidateRange
public void invalidateRange(List<String> data)
数据更改时调用,范围可能不再有效。 如果isAutoRanging()返回true,则仅由图表调用。 如果我们是自动测距,它将导致布局被请求,并且自动测距在下一个布局传递中发生。- 重写:
-
invalidateRange
在Axis<String>
- 参数
-
data
- 需要在此轴上绘制的所有数据的当前集合
-
getDisplayPosition
public double getDisplayPosition(String value)
获取给定值的沿该轴的显示位置。 如果该值不等于任何类别,则返回Double.NaN- Specified by:
-
getDisplayPosition
中的Axis<String>
- 参数
-
value
- 数据值计算显示位置 - 结果
- 显示位置或Double.NaN如果值不是其中一个类别
-
getValueForDisplay
public String getValueForDisplay(double displayPosition)
获取此轴上给定显示位置的数据值。 如果轴是一个CategoryAxis,这将是最接近的值。- Specified by:
-
getValueForDisplay
在Axis<String>
- 参数
-
displayPosition
- 此轴上的像素位置 - 结果
- 给定像素位置的最近数据值,如果不在轴上则为null;
-
isValueOnAxis
public boolean isValueOnAxis(String value)
检查给定值是否在该轴上是可绘制的- Specified by:
-
isValueOnAxis
在Axis<String>
- 参数
-
value
- 检查其轴上的值 - 结果
- 如果给定值在此轴上是可绘制的,则为true
-
toNumericValue
public double toNumericValue(String value)
所有轴值必须由某些数值表示。 这将获取给定数据值的数值。- Specified by:
-
toNumericValue
在Axis<String>
- 参数
-
value
- 要转换的数据值 - 结果
- 给定数据值的数值
-
toRealValue
public String toRealValue(double value)
所有轴值必须由某些数值表示。 这将获取给定数值的数据值。- Specified by:
-
toRealValue
在Axis<String>
- 参数
-
value
- 要转换的数值 - 结果
- 给定数值的数据值
-
getZeroPosition
public double getZeroPosition()
获取沿该轴的零线的显示位置。 由于在类别Axis上没有零的概念,这总是Double.NaN。- Specified by:
-
getZeroPosition
在Axis<String>
- 结果
- 总是Double.NaN为CategoryAxis
-
getClassCssMetaData
public static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
- 结果
- 与此类相关联的CssMetaData可能包括其类的CssMetaData。
- 从以下版本开始:
- JavaFX 8.0
-
getCssMetaData
public List<CssMetaData<? extends Styleable,?>> getCssMetaData()
该方法应该委托给Node.getClassCssMetaData()
,以便可以访问Node的CssMetaData而不需要反射。- Specified by:
-
getCssMetaData
在接口Styleable
- 重写:
-
getCssMetaData
在Axis<String>
- 结果
- 与该节点相关联的CssMetaData,其可以包括其超类的CssMetaData。
- 从以下版本开始:
- JavaFX 8.0
-
-