public abstract class Axis<T> extends Region
Some examples of concrete subclasses include NumberAxis
whose axis plots data
in numbers and CategoryAxis
whose values / ticks represent string
categories along its axis.
Type | Property and Description |
---|---|
BooleanProperty |
animated
When true any changes to the axis and its range will be animated.
|
BooleanProperty |
autoRanging
This is true when the axis determines its range from the data automatically
|
ObjectProperty<String> |
label
The axis label
|
ObjectProperty<Side> |
side
The side of the plot which this axis is being drawn on
|
ObjectProperty<Paint> |
tickLabelFill
The fill for all tick labels
|
ObjectProperty<Font> |
tickLabelFont
The font for all tick labels
|
DoubleProperty |
tickLabelGap
The gap between tick labels and the tick mark lines
|
DoubleProperty |
tickLabelRotation
Rotation in degrees of tick mark labels from their normal horizontal.
|
BooleanProperty |
tickLabelsVisible
true if tick mark labels should be displayed
|
DoubleProperty |
tickLength
The length of tick mark lines
|
BooleanProperty |
tickMarkVisible
true if tick marks should be displayed
|
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width
needsLayout
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, visible
Modifier and Type | Class and Description |
---|---|
static class |
Axis.TickMark<T>
TickMark represents the label text, its associated properties for each tick
along the Axis.
|
USE_COMPUTED_SIZE, USE_PREF_SIZE
BASELINE_OFFSET_SAME_AS_HEIGHT
Constructor and Description |
---|
Axis()
Creates and initializes a new instance of the Axis class.
|
Modifier and Type | Method and Description |
---|---|
BooleanProperty |
animatedProperty()
When true any changes to the axis and its range will be animated.
|
protected abstract Object |
autoRange(double length)
This calculates the upper and lower bound based on the data provided to invalidateRange() method.
|
BooleanProperty |
autoRangingProperty()
This is true when the axis determines its range from the data automatically
|
protected abstract List<T> |
calculateTickValues(double length,
Object range)
Calculate a list of all the data values for each tick mark in range
|
protected double |
computePrefHeight(double width)
Computes the preferred height of this axis for the given width.
|
protected double |
computePrefWidth(double height)
Computes the preferred width of this axis for the given height.
|
boolean |
getAnimated()
Indicates whether the changes to axis range will be animated or not.
|
static List<CssMetaData<? extends Styleable,?>> |
getClassCssMetaData() |
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. |
abstract double |
getDisplayPosition(T value)
Get the display position along this axis for a given value.
|
String |
getLabel()
Gets the value of the property label.
|
protected abstract Object |
getRange()
Called to get the current axis range.
|
Side |
getSide()
Gets the value of the property side.
|
Paint |
getTickLabelFill()
Gets the value of the property tickLabelFill.
|
Font |
getTickLabelFont()
Gets the value of the property tickLabelFont.
|
double |
getTickLabelGap()
Gets the value of the property tickLabelGap.
|
double |
getTickLabelRotation()
Gets the value of the property tickLabelRotation.
|
double |
getTickLength()
Gets the value of the property tickLength.
|
protected abstract String |
getTickMarkLabel(T value)
Get the string label name for a tick mark with the given value
|
ObservableList<Axis.TickMark<T>> |
getTickMarks()
Unmodifiable observable list of tickmarks, each TickMark directly representing a tickmark on this axis.
|
abstract T |
getValueForDisplay(double displayPosition)
Get the data value for the given display position on this axis.
|
abstract double |
getZeroPosition()
Get the display position of the zero line along this axis.
|
protected void |
invalidateRange()
Mark the current range invalid, this will cause anything that depends on the range to be recalculated on the
next layout.
|
void |
invalidateRange(List<T> data)
Called when data has changed and the range may not be valid any more.
|
boolean |
isAutoRanging()
Gets the value of the property autoRanging.
|
protected boolean |
isRangeValid()
See if the current range is valid, if it is not then any range dependent calulcations need to redone on the next layout pass
|
boolean |
isTickLabelsVisible()
Gets the value of the property tickLabelsVisible.
|
boolean |
isTickMarkVisible()
Gets the value of the property tickMarkVisible.
|
abstract boolean |
isValueOnAxis(T value)
Checks if the given value is plottable on this axis
|
ObjectProperty<String> |
labelProperty()
The axis label
|
protected void |
layoutChildren()
Invoked during the layout pass to layout this axis and all its content.
|
protected Dimension2D |
measureTickMarkLabelSize(String labelText,
double rotation)
Measure the size of the label for given tick mark value.
|
protected Dimension2D |
measureTickMarkSize(T value,
double rotation)
Measure the size of the label for given tick mark value.
|
protected Dimension2D |
measureTickMarkSize(T value,
Object range)
Measure the size of the label for given tick mark value.
|
void |
requestAxisLayout()
Request that the axis is laid out in the next layout pass.
|
void |
requestLayout()
We suppress requestLayout() calls here by doing nothing as we don't want changes to our children to cause
layout.
|
void |
setAnimated(boolean value)
Sets the value of the property animated.
|
void |
setAutoRanging(boolean value)
Sets the value of the property autoRanging.
|
void |
setLabel(String value)
Sets the value of the property label.
|
protected abstract void |
setRange(Object range,
boolean animate)
Called to set the current axis range to the given range.
|
void |
setSide(Side value)
Sets the value of the property side.
|
void |
setTickLabelFill(Paint value)
Sets the value of the property tickLabelFill.
|
void |
setTickLabelFont(Font value)
Sets the value of the property tickLabelFont.
|
void |
setTickLabelGap(double value)
Sets the value of the property tickLabelGap.
|
void |
setTickLabelRotation(double value)
Sets the value of the property tickLabelRotation.
|
void |
setTickLabelsVisible(boolean value)
Sets the value of the property tickLabelsVisible.
|
void |
setTickLength(double value)
Sets the value of the property tickLength.
|
void |
setTickMarkVisible(boolean value)
Sets the value of the property tickMarkVisible.
|
protected boolean |
shouldAnimate()
This is used to check if any given animation should run.
|
ObjectProperty<Side> |
sideProperty()
The side of the plot which this axis is being drawn on
|
ObjectProperty<Paint> |
tickLabelFillProperty()
The fill for all tick labels
|
ObjectProperty<Font> |
tickLabelFontProperty()
The font for all tick labels
|
DoubleProperty |
tickLabelGapProperty()
The gap between tick labels and the tick mark lines
|
DoubleProperty |
tickLabelRotationProperty()
Rotation in degrees of tick mark labels from their normal horizontal.
|
BooleanProperty |
tickLabelsVisibleProperty()
true if tick mark labels should be displayed
|
DoubleProperty |
tickLengthProperty()
The length of tick mark lines
|
protected void |
tickMarksUpdated()
Called during layout if the tickmarks have been updated, allowing subclasses to do anything they need to
in reaction.
|
BooleanProperty |
tickMarkVisibleProperty()
true if tick marks should be displayed
|
abstract double |
toNumericValue(T value)
All axis values must be representable by some numeric value.
|
abstract T |
toRealValue(double value)
All axis values must be representable by some numeric value.
|
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, snapSize, snapSpace, snapToPixelProperty, widthProperty
getBaselineOffset, getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, queryAccessibleAttribute, requestParentLayout, setNeedsLayout, updateBounds
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, 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, 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, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, visibleProperty
public final ObjectProperty<Side> sideProperty
getSide()
,
setSide(Side)
public final ObjectProperty<String> labelProperty
getLabel()
,
setLabel(String)
public final BooleanProperty tickMarkVisibleProperty
isTickMarkVisible()
,
setTickMarkVisible(boolean)
public final BooleanProperty tickLabelsVisibleProperty
public final DoubleProperty tickLengthProperty
getTickLength()
,
setTickLength(double)
public final BooleanProperty autoRangingProperty
isAutoRanging()
,
setAutoRanging(boolean)
public final ObjectProperty<Font> tickLabelFontProperty
getTickLabelFont()
,
setTickLabelFont(Font)
public final ObjectProperty<Paint> tickLabelFillProperty
getTickLabelFill()
,
setTickLabelFill(Paint)
public final DoubleProperty tickLabelGapProperty
getTickLabelGap()
,
setTickLabelGap(double)
public final BooleanProperty animatedProperty
getAnimated()
,
setAnimated(boolean)
public final DoubleProperty tickLabelRotationProperty
public ObservableList<Axis.TickMark<T>> getTickMarks()
public final Side getSide()
public final void setSide(Side value)
public final ObjectProperty<Side> sideProperty()
getSide()
,
setSide(Side)
public final String getLabel()
public final void setLabel(String value)
public final ObjectProperty<String> labelProperty()
getLabel()
,
setLabel(String)
public final boolean isTickMarkVisible()
public final void setTickMarkVisible(boolean value)
public final BooleanProperty tickMarkVisibleProperty()
isTickMarkVisible()
,
setTickMarkVisible(boolean)
public final boolean isTickLabelsVisible()
public final void setTickLabelsVisible(boolean value)
public final BooleanProperty tickLabelsVisibleProperty()
public final double getTickLength()
public final void setTickLength(double value)
public final DoubleProperty tickLengthProperty()
getTickLength()
,
setTickLength(double)
public final boolean isAutoRanging()
public final void setAutoRanging(boolean value)
public final BooleanProperty autoRangingProperty()
isAutoRanging()
,
setAutoRanging(boolean)
public final Font getTickLabelFont()
public final void setTickLabelFont(Font value)
public final ObjectProperty<Font> tickLabelFontProperty()
getTickLabelFont()
,
setTickLabelFont(Font)
public final Paint getTickLabelFill()
public final void setTickLabelFill(Paint value)
public final ObjectProperty<Paint> tickLabelFillProperty()
getTickLabelFill()
,
setTickLabelFill(Paint)
public final double getTickLabelGap()
public final void setTickLabelGap(double value)
public final DoubleProperty tickLabelGapProperty()
getTickLabelGap()
,
setTickLabelGap(double)
public final boolean getAnimated()
public final void setAnimated(boolean value)
public final BooleanProperty animatedProperty()
getAnimated()
,
setAnimated(boolean)
public final double getTickLabelRotation()
public final void setTickLabelRotation(double value)
public final DoubleProperty tickLabelRotationProperty()
protected final boolean isRangeValid()
protected final void invalidateRange()
protected final boolean shouldAnimate()
public void requestLayout()
requestLayout
in class Parent
public void requestAxisLayout()
public void invalidateRange(List<T> data)
data
- The current set of all data that needs to be plotted on this axisprotected abstract Object autoRange(double length)
length
- The length of the axis in screen coordinatesprotected abstract void setRange(Object range, boolean animate)
range
- A range object returned from autoRange()animate
- If true animate the change in rangeprotected abstract Object getRange()
public abstract double getZeroPosition()
public abstract double getDisplayPosition(T value)
value
- The data value to work out display position forpublic abstract T getValueForDisplay(double displayPosition)
displayPosition
- A pixel position on this axispublic abstract boolean isValueOnAxis(T value)
value
- The value to check if its on axispublic abstract double toNumericValue(T value)
value
- The data value to convertpublic abstract T toRealValue(double value)
value
- The numeric value to convertprotected abstract List<T> calculateTickValues(double length, Object range)
length
- The length of the axis in display unitsrange
- A range object returned from autoRange()protected double computePrefHeight(double width)
computePrefHeight
in class Region
width
- the width that should be used if preferred height depends
on itprotected double computePrefWidth(double height)
computePrefWidth
in class Region
height
- the height that should be used if preferred width depends
on itprotected void tickMarksUpdated()
protected void layoutChildren()
layoutChildren
in class Parent
protected abstract String getTickMarkLabel(T value)
value
- The value to format into a tick label stringprotected final Dimension2D measureTickMarkLabelSize(String labelText, double rotation)
labelText
- tick mark label textrotation
- The text rotationprotected final Dimension2D measureTickMarkSize(T value, double rotation)
value
- tick mark valuerotation
- The text rotationprotected Dimension2D measureTickMarkSize(T value, Object range)
value
- tick mark valuerange
- range to use during calculationspublic static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
public List<CssMetaData<? extends Styleable,?>> getCssMetaData()
Node.getClassCssMetaData()
so that
a Node's CssMetaData can be accessed without the need for reflection.getCssMetaData
in interface Styleable
getCssMetaData
in class Region
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2020, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.