- All Implemented Interfaces:
- Styleable,- EventTarget
public final class CategoryAxis extends Axis<String>
A axis implementation that will works on string categories where each
 value as a unique category(tick mark) along the axis.
- Since:
- JavaFX 2.0
- 
Property SummaryProperties Type Property Description ReadOnlyDoublePropertycategorySpacingThis is the gap between one category and the next along this axisDoublePropertyendMarginThe margin between the last tick mark and the axis endBooleanPropertygapStartAndEndIf this is true then half the space between ticks is left at the start and endDoublePropertystartMarginThe margin between the axis start and the first tick-markProperties declared in class javafx.scene.chart.Axisanimated, autoRanging, label, side, tickLabelFill, tickLabelFont, tickLabelGap, tickLabelRotation, tickLabelsVisible, tickLength, tickMarkVisibleProperties declared in class javafx.scene.layout.Regionbackground, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, widthProperties declared in class javafx.scene.ParentneedsLayoutProperties declared in class javafx.scene.NodeaccessibleHelp, 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
- 
Nested Class SummaryNested classes/interfaces declared in class javafx.scene.chart.AxisAxis.TickMark<T>
- 
Field SummaryFields declared in class javafx.scene.layout.RegionUSE_COMPUTED_SIZE, USE_PREF_SIZEFields declared in class javafx.scene.NodeBASELINE_OFFSET_SAME_AS_HEIGHT
- 
Constructor SummaryConstructors Constructor Description CategoryAxis()Create a auto-ranging category axis with an empty list of categories.CategoryAxis(ObservableList<String> categories)Create a category axis with the given categories.
- 
Method SummaryModifier and Type Method Description protected ObjectautoRange(double length)This calculates the categories based on the data provided to invalidateRange() method.protected List<String>calculateTickValues(double length, Object range)Calculate a list of all the data values for each tick mark in rangeReadOnlyDoublePropertycategorySpacingProperty()This is the gap between one category and the next along this axisDoublePropertyendMarginProperty()The margin between the last tick mark and the axis endBooleanPropertygapStartAndEndProperty()If this is true then half the space between ticks is left at the start and endObservableList<String>getCategories()Returns aObservableListof categories plotted on this axis.doublegetCategorySpacing()Gets the value of the property categorySpacing.static List<CssMetaData<? extends Styleable,?>>getClassCssMetaData()List<CssMetaData<? extends Styleable,?>>getCssMetaData()This method should delegate toNode.getClassCssMetaData()so that a Node's CssMetaData can be accessed without the need for reflection.doublegetDisplayPosition(String value)Get the display position along this axis for a given value.doublegetEndMargin()Gets the value of the property endMargin.protected ObjectgetRange()Called to get the current axis range.doublegetStartMargin()Gets the value of the property startMargin.protected StringgetTickMarkLabel(String value)Get the string label name for a tick mark with the given valueStringgetValueForDisplay(double displayPosition)Get the data value for the given display position on this axis.doublegetZeroPosition()Get the display position of the zero line along this axis.voidinvalidateRange(List<String> data)Called when data has changed and the range may not be valid any more.booleanisGapStartAndEnd()Gets the value of the property gapStartAndEnd.booleanisValueOnAxis(String value)Checks if the given value is plottable on this axisprotected Dimension2DmeasureTickMarkSize(String value, Object range)Measure the size of the label for given tick mark value.voidsetCategories(ObservableList<String> value)The ordered list of categories plotted on this axis.voidsetEndMargin(double value)Sets the value of the property endMargin.voidsetGapStartAndEnd(boolean value)Sets the value of the property gapStartAndEnd.protected voidsetRange(Object range, boolean animate)Called to set the current axis range to the given range.voidsetStartMargin(double value)Sets the value of the property startMargin.DoublePropertystartMarginProperty()The margin between the axis start and the first tick-markdoubletoNumericValue(String value)All axis values must be representable by some numeric value.StringtoRealValue(double value)All axis values must be representable by some numeric value.Methods declared in class javafx.scene.chart.AxisanimatedProperty, 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, tickMarkVisiblePropertyMethods declared in class javafx.scene.layout.RegionbackgroundProperty, 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, widthPropertyMethods declared in class javafx.scene.ParentgetBaselineOffset, getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, needsLayoutProperty, requestParentLayout, setNeedsLayout, updateBoundsMethods declared in class javafx.scene.NodeaccessibleHelpProperty, 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, 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, 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, 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, visiblePropertyMethods declared in class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods declared in interface javafx.css.StyleablegetStyleableNode, getStyleClass
- 
Property Details- 
startMarginThe margin between the axis start and the first tick-mark- See Also:
- getStartMargin(),- setStartMargin(double)
 
- 
endMarginThe margin between the last tick mark and the axis end- See Also:
- getEndMargin(),- setEndMargin(double)
 
- 
gapStartAndEndIf this is true then half the space between ticks is left at the start and end- See Also:
- isGapStartAndEnd(),- setGapStartAndEnd(boolean)
 
- 
categorySpacingThis is the gap between one category and the next along this axis- See Also:
- getCategorySpacing()
 
 
- 
- 
Constructor Details- 
CategoryAxispublic CategoryAxis()Create a auto-ranging category axis with an empty list of categories.
- 
CategoryAxisCreate a category axis with the given categories. This will not auto-range but be fixed with the given categories.- Parameters:
- categories- List of the categories for this axis
 
 
- 
- 
Method Details- 
getStartMarginpublic final double getStartMargin()Gets the value of the property startMargin.- Property description:
- The margin between the axis start and the first tick-mark
 
- 
setStartMarginpublic final void setStartMargin(double value)Sets the value of the property startMargin.- Property description:
- The margin between the axis start and the first tick-mark
 
- 
startMarginPropertyThe margin between the axis start and the first tick-mark- See Also:
- getStartMargin(),- setStartMargin(double)
 
- 
getEndMarginpublic final double getEndMargin()Gets the value of the property endMargin.- Property description:
- The margin between the last tick mark and the axis end
 
- 
setEndMarginpublic final void setEndMargin(double value)Sets the value of the property endMargin.- Property description:
- The margin between the last tick mark and the axis end
 
- 
endMarginPropertyThe margin between the last tick mark and the axis end- See Also:
- getEndMargin(),- setEndMargin(double)
 
- 
isGapStartAndEndpublic final boolean isGapStartAndEnd()Gets the value of the property gapStartAndEnd.- Property description:
- If this is true then half the space between ticks is left at the start and end
 
- 
setGapStartAndEndpublic final void setGapStartAndEnd(boolean value)Sets the value of the property gapStartAndEnd.- Property description:
- If this is true then half the space between ticks is left at the start and end
 
- 
gapStartAndEndPropertyIf this is true then half the space between ticks is left at the start and end- See Also:
- isGapStartAndEnd(),- setGapStartAndEnd(boolean)
 
- 
setCategoriesThe ordered list of categories plotted on this axis. This is set automatically based on the charts data if autoRanging is true. If the application sets the categories then auto ranging is turned off. If there is an attempt to add duplicate entry into this list, anIllegalArgumentExceptionis thrown.- Parameters:
- value- the ordered list of categories plotted on this axis
 
- 
getCategoriesReturns aObservableListof categories plotted on this axis.- Returns:
- ObservableList of categories for this axis.
 
- 
getCategorySpacingpublic final double getCategorySpacing()Gets the value of the property categorySpacing.- Property description:
- This is the gap between one category and the next along this axis
 
- 
categorySpacingPropertyThis is the gap between one category and the next along this axis- See Also:
- getCategorySpacing()
 
- 
getRangeCalled to get the current axis range.
- 
setRangeCalled to set the current axis range to the given range. If isAnimating() is true then this method should animate the range to the new range.
- 
autoRangeThis calculates the categories based on the data provided to invalidateRange() method. This must not effect the state of the axis, changing any properties of the axis. Any results of the auto-ranging should be returned in the range object. This will we passed to setRange() if it has been decided to adopt this range for this axis.
- 
calculateTickValuesCalculate a list of all the data values for each tick mark in range- Specified by:
- calculateTickValuesin class- Axis<String>
- Parameters:
- length- The length of the axis in display units
- range- A range object returned from autoRange()
- Returns:
- A list of tick marks that fit along the axis if it was the given length
 
- 
getTickMarkLabelGet the string label name for a tick mark with the given value- Specified by:
- getTickMarkLabelin class- Axis<String>
- Parameters:
- value- The value to format into a tick label string
- Returns:
- A formatted string for the given value
 
- 
measureTickMarkSizeMeasure the size of the label for given tick mark value. This uses the font that is set for the tick marks- Overrides:
- measureTickMarkSizein class- Axis<String>
- Parameters:
- value- tick mark value
- range- range to use during calculations
- Returns:
- size of tick mark label for given value
 
- 
invalidateRangeCalled when data has changed and the range may not be valid any more. This is only called by the chart if isAutoRanging() returns true. If we are auto ranging it will cause layout to be requested and auto ranging to happen on next layout pass.- Overrides:
- invalidateRangein class- Axis<String>
- Parameters:
- data- The current set of all data that needs to be plotted on this axis
 
- 
getDisplayPositionGet the display position along this axis for a given value. If the value is not equal to any of the categories, Double.NaN is returned- Specified by:
- getDisplayPositionin class- Axis<String>
- Parameters:
- value- The data value to work out display position for
- Returns:
- display position or Double.NaN if value not one of the categories
 
- 
getValueForDisplayGet the data value for the given display position on this axis. If the axis is a CategoryAxis this will be the nearest value.- Specified by:
- getValueForDisplayin class- Axis<String>
- Parameters:
- displayPosition- A pixel position on this axis
- Returns:
- the nearest data value to the given pixel position or null if not on axis;
 
- 
isValueOnAxisChecks if the given value is plottable on this axis- Specified by:
- isValueOnAxisin class- Axis<String>
- Parameters:
- value- The value to check if its on axis
- Returns:
- true if the given value is plottable on this axis
 
- 
toNumericValueAll axis values must be representable by some numeric value. This gets the numeric value for a given data value.- Specified by:
- toNumericValuein class- Axis<String>
- Parameters:
- value- The data value to convert
- Returns:
- Numeric value for the given data value
 
- 
toRealValueAll axis values must be representable by some numeric value. This gets the data value for a given numeric value.- Specified by:
- toRealValuein class- Axis<String>
- Parameters:
- value- The numeric value to convert
- Returns:
- Data value for given numeric value
 
- 
getZeroPositionpublic double getZeroPosition()Get the display position of the zero line along this axis. As there is no concept of zero on a CategoryAxis this is always Double.NaN.- Specified by:
- getZeroPositionin class- Axis<String>
- Returns:
- always Double.NaN for CategoryAxis
 
- 
getClassCssMetaData- Returns:
- The CssMetaData associated with this class, which may include the CssMetaData of its superclasses.
- Since:
- JavaFX 8.0
 
- 
getCssMetaDataThis method should delegate toNode.getClassCssMetaData()so that a Node's CssMetaData can be accessed without the need for reflection.- Specified by:
- getCssMetaDatain interface- Styleable
- Overrides:
- getCssMetaDatain class- Axis<String>
- Returns:
- The CssMetaData associated with this node, which may include the CssMetaData of its superclasses.
- Since:
- JavaFX 8.0
 
 
-