Package de.gsi.chart.axes.spi
Class AbstractAxis
- java.lang.Object
-
- javafx.scene.Node
-
- javafx.scene.Parent
-
- javafx.scene.layout.Region
-
- javafx.scene.layout.Pane
-
- de.gsi.chart.axes.spi.AbstractAxisParameter
-
- de.gsi.chart.axes.spi.AbstractAxis
-
- All Implemented Interfaces:
Axis,de.gsi.dataset.AxisDescription,de.gsi.dataset.event.EventSource,javafx.css.Styleable,javafx.event.EventTarget
- Direct Known Subclasses:
DefaultNumericAxis,LinearAxis,LogarithmicAxis,NumericAxis,OscilloscopeAxis
public abstract class AbstractAxis extends AbstractAxisParameter implements Axis
- Author:
- rstein
-
-
Field Summary
Fields Modifier and Type Field Description protected javafx.animation.Timelineanimatorprotected static intBURST_LIMIT_CSS_MSprotected doublecachedOffsetprotected javafx.beans.property.DoublePropertycurrentLowerBoundThe current value for the lowerBound of this axis, ie min value.protected booleanlabelOverlapprotected java.util.concurrent.locks.ReentrantLocklockprotected static doubleMAX_NARROW_FONT_SCALEprotected doublemaxLabelHeightprotected doublemaxLabelWidthprotected static doubleMIN_NARROW_FONT_SCALEprotected static intRANGE_ANIMATION_DURATION_MSprotected doublescaleFontprotected java.util.WeakHashMap<java.lang.Double,TickMark>tickMarkDoubleCacheprotected java.util.WeakHashMap<java.lang.String,TickMark>tickMarkStringCache-
Fields inherited from class de.gsi.chart.axes.spi.AbstractAxisParameter
DEFAULT_MINOR_TICK_COUNT, isInvertedAxis, isTimeAxis, majorTickMarks, majorTickMarkValues, maxProp, minorTickMarks, minorTickMarkValues, minProp, oldAxisLength, oldAxisMax, oldAxisMin, oldTickUnit, scaleBinding, tickLabelRotation, tickUnit, valid
-
-
Constructor Summary
Constructors Constructor Description AbstractAxis()AbstractAxis(double lowerBound, double upperBound)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected AxisRangeautoRange(double length)This calculates the upper and lower bound based on the data provided to invalidateRange() method.protected AxisRangeautoRange(double minValue, double maxValue, double length, double labelSize)javafx.beans.property.ObjectProperty<AxisLabelFormatter>axisLabelFormatterProperty()protected abstract java.util.List<java.lang.Double>calculateMajorTickValues(double length, AxisRange range)Calculate a list of all the data values for each tick mark in rangeprotected abstract java.util.List<java.lang.Double>calculateMinorTickValues()Calculate a list of the data values for every minor tick markprotected doublecalculateNewScale(double length, double lowerBound, double upperBound)Calculate a new scale for this axis.protected voidclearAxisCanvas(javafx.scene.canvas.GraphicsContext gc, double width, double height)abstract doublecomputePreferredTickUnit(double axisLength)Computes the preferred tick unit based on the upper/lower bounds and the length of the axis in screen coordinates.protected doublecomputePrefHeight(double width)Computes the preferred height of this axis for the given width.protected doublecomputePrefWidth(double height)Computes the preferred width of this axis for the given height.protected abstract AxisRangecomputeRange(double minValue, double maxValue, double axisLength, double labelSize)Computes range of this axis, similarly toautoRange(double, double, double, double).protected java.util.List<TickMark>computeTickMarks(AxisRange range, boolean majorTickMark)voiddrawAxis(javafx.scene.canvas.GraphicsContext gc, double axisWidth, double axisHeight)Function allows custom drawing of axes outside the Axis environment (ie.protected static voiddrawAxisLabel(javafx.scene.canvas.GraphicsContext gc, double x, double y, javafx.scene.text.Text label)protected voiddrawAxisLabel(javafx.scene.canvas.GraphicsContext gc, double axisWidth, double axisHeight, javafx.scene.text.Text axisName, javafx.collections.ObservableList<TickMark> tickMarks, double tickLength)protected voiddrawAxisLine(javafx.scene.canvas.GraphicsContext gc, double axisLength, double axisWidth, double axisHeight)protected voiddrawAxisPost()function to be executed after the axis has been drawn can be used to execute user-specific code (e.g.protected voiddrawAxisPre()function to be executed prior to drawing axis can be used to execute user-specific code (e.g.protected voiddrawTickLabels(javafx.scene.canvas.GraphicsContext gc, double axisWidth, double axisHeight, javafx.collections.ObservableList<TickMark> tickMarks, double tickLength)protected static voiddrawTickMarkLabel(javafx.scene.canvas.GraphicsContext gc, double x, double y, double scaleFont, TickMark tickMark)protected voiddrawTickMarks(javafx.scene.canvas.GraphicsContext gc, double axisLength, double axisWidth, double axisHeight, javafx.collections.ObservableList<TickMark> tickMarks, double tickLength, javafx.scene.shape.Path tickStyle)voidfireInvalidated()Notifies listeners that the data has been invalidated.voidforceRedraw()forces redrawing of axis (via layoutChildren()).AxisLabelFormattergetAxisLabelFormatter()protected AxisRangegetAxisRange()javafx.scene.canvas.CanvasgetCanvas()doublegetDisplayPosition(double value)Get the display position along this axis for a given value.javafx.scene.canvas.GraphicsContextgetGraphicsContext()protected static doublegetMaxTickLabelHeight(java.util.List<TickMark> tickMarks)protected static doublegetMaxTickLabelWidth(java.util.List<TickMark> tickMarks)TickMarkgetNewTickMark(java.lang.Double tickValue, double tickPosition, java.lang.String tickMarkLabel)java.lang.StringgetTickMarkLabel(double value)Get the string label name for a tick mark with the given valuedoublegetZeroPosition()Get the display position of the zero line along this axis.voidinvalidateCaches()voidinvalidateRange(java.util.List<java.lang.Number> data)Called when data has changed and the range may not be valid any more.booleanisLabelOverlapping()booleanisValueOnAxis(double value)Checks if the given value is plottable on this axisprotected voidlayoutChildren()Invoked during the layout pass to layout this axis and all its content.protected doublemeasureTickMarkLength(java.lang.Double major)voidrecomputeTickMarks()protected voidrecomputeTickMarks(AxisRange range)voidrequestAxisLayout()Request that the axis is laid out in the next layout pass.voidsetAxisLabelFormatter(AxisLabelFormatter value)booleansetMax(double value)booleansetMin(double value)protected voidsetRange(AxisRange rangeObj, boolean animate)protected booleanshouldAnimate()This is used to check if any given animation should run.protected static doublesnap(double coordinate)protected voidtickMarksUpdated()Called during layout if the tickmarks have been updated, allowing subclasses to do anything they need to in reaction.protected voidupdateCachedVariables()to be overwritten by derived class that want to cache variables for efficiency reasonsprotected voidupdateCSS()-
Methods inherited from class de.gsi.chart.axes.spi.AbstractAxisParameter
add, add, animatedProperty, animationDurationProperty, autoGrowRangingProperty, autoNotification, autoRangePaddingProperty, autoRangeRoundingProperty, autoRangingProperty, autoUnitScalingProperty, axisLabelGapProperty, axisLabelTextAlignmentProperty, axisPaddingProperty, centerAxisPositionProperty, clear, contains, equalString, getaAxisLabelTextAlignment, getAnimationDuration, getAutoRange, getAutoRangePadding, getAxisCenterPosition, getAxisLabel, getAxisLabelGap, getAxisLabelTextAlignment, getAxisPadding, getCenterAxisPosition, getClassCssMetaData, getCssMetaData, getLength, getMajorTickStyle, getMax, getMaxMajorTickLabelCount, getMaxMaxjorTickLabelCount, getMin, getMinorTickCount, getMinorTickLength, getMinorTickMarks, getMinorTickMarkValues, getMinorTickStyle, getName, getOverlapPolicy, getRange, getScale, getSide, getTickLabelFill, getTickLabelFont, getTickLabelFormatter, getTickLabelGap, getTickLabelRotation, getTickLabelSpacing, getTickLength, getTickMarks, getTickMarkValues, getTickUnit, getUnit, getUnitScaling, getUserRange, invalidate, invertAxis, invertAxisProperty, invokeListener, isAnimated, isAutoGrowRanging, isAutoRangeRounding, isAutoRanging, isAutoUnitScaling, isDefined, isInvertedAxis, isMinorTickVisible, isTickLabelsVisible, isTickMarkVisible, isTimeAxis, isValid, maxMajorTickLabelCountProperty, maxProperty, minorTickCountProperty, minorTickLengthProperty, minorTickVisibleProperty, minProperty, nameProperty, overlapPolicyProperty, scaleProperty, set, set, set, setAnimated, setAnimationDuration, setAutoGrowRanging, setAutoRangePadding, setAutoRangeRounding, setAutoRanging, setAutoUnitScaling, setAxisCenterPosition, setAxisLabelGap, setAxisLabelTextAlignment, setAxisPadding, setMaxMajorTickLabelCount, setMinorTickCount, setMinorTickLength, setMinorTickVisible, setName, setOverlapPolicy, setScale, setSide, setTickLabelFill, setTickLabelFont, setTickLabelFormatter, setTickLabelGap, setTickLabelRotation, setTickLabelSpacing, setTickLabelsVisible, setTickLength, setTickMarkVisible, setTickUnit, setTimeAxis, setUnit, setUnitScaling, setUnitScaling, sideProperty, tickLabelFillProperty, tickLabelFontProperty, tickLabelFormatterProperty, tickLabelGapProperty, tickLabelRotationProperty, tickLabelSpacing, tickLabelsVisibleProperty, tickLengthProperty, tickMarkVisibleProperty, tickUnitProperty, timeAxisProperty, unitProperty, unitScalingProperty, updateAxisLabelAndUnit, updateEventListener, updateScaleAndUnitPrefix, validProperty
-
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 class javafx.scene.Parent
getBaselineOffset, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, queryAccessibleAttribute, requestLayout, requestParentLayout, setNeedsLayout, updateBounds
-
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 interface de.gsi.chart.axes.Axis
autoGrowRangingProperty, autoRangingProperty, autoUnitScalingProperty, getAutoRange, getAxisTransform, getHeight, getLength, getLogAxisType, getMinorTickCount, getMinorTickMarks, getRange, getSide, getTickLabelFill, getTickLabelFont, getTickLabelFormatter, getTickLabelGap, getTickLabelSpacing, getTickMarks, getTickUnit, getUnitScaling, getUserRange, getValueForDisplay, getWidth, invertAxis, invertAxisProperty, invokeListener, isAutoGrowRanging, isAutoRanging, isAutoUnitScaling, isInvertedAxis, isLogAxis, isTimeAxis, maxProperty, minProperty, nameProperty, setAnimated, setAutoGrowRanging, setAutoRanging, setAutoUnitScaling, setName, setSide, setTickUnit, setTimeAxis, setUnit, setUnitScaling, setUnitScaling, sideProperty, tickUnitProperty, timeAxisProperty, unitProperty, unitScalingProperty
-
Methods inherited from interface de.gsi.dataset.AxisDescription
add, add, add, clear, contains, getMax, getMin, getName, getUnit, isDefined, set, set, set, set
-
-
-
-
Field Detail
-
MIN_NARROW_FONT_SCALE
protected static final double MIN_NARROW_FONT_SCALE
- See Also:
- Constant Field Values
-
MAX_NARROW_FONT_SCALE
protected static final double MAX_NARROW_FONT_SCALE
- See Also:
- Constant Field Values
-
RANGE_ANIMATION_DURATION_MS
protected static final int RANGE_ANIMATION_DURATION_MS
- See Also:
- Constant Field Values
-
BURST_LIMIT_CSS_MS
protected static final int BURST_LIMIT_CSS_MS
- See Also:
- Constant Field Values
-
animator
protected final javafx.animation.Timeline animator
-
labelOverlap
protected boolean labelOverlap
-
scaleFont
protected double scaleFont
-
cachedOffset
protected double cachedOffset
-
lock
protected final transient java.util.concurrent.locks.ReentrantLock lock
-
maxLabelHeight
protected double maxLabelHeight
-
maxLabelWidth
protected double maxLabelWidth
-
currentLowerBound
protected final javafx.beans.property.DoubleProperty currentLowerBound
The current value for the lowerBound of this axis, ie min value. This may be the same as lowerBound or different. It is used by NumberAxis to animate the lowerBound from the old value to the new value.
-
tickMarkStringCache
protected java.util.WeakHashMap<java.lang.String,TickMark> tickMarkStringCache
-
tickMarkDoubleCache
protected java.util.WeakHashMap<java.lang.Double,TickMark> tickMarkDoubleCache
-
-
Method Detail
-
axisLabelFormatterProperty
public javafx.beans.property.ObjectProperty<AxisLabelFormatter> axisLabelFormatterProperty()
-
computePreferredTickUnit
public abstract double computePreferredTickUnit(double axisLength)
Computes the preferred tick unit based on the upper/lower bounds and the length of the axis in screen coordinates.- Parameters:
axisLength- the length in screen coordinates- Returns:
- the tick unit
-
drawAxis
public void drawAxis(javafx.scene.canvas.GraphicsContext gc, double axisWidth, double axisHeight)Description copied from interface:AxisFunction allows custom drawing of axes outside the Axis environment (ie. on another canvas)
-
fireInvalidated
public void fireInvalidated()
Notifies listeners that the data has been invalidated. If the data is added to the chart, it triggers repaint.- Specified by:
fireInvalidatedin classAbstractAxisParameter
-
forceRedraw
public void forceRedraw()
Description copied from interface:Axisforces redrawing of axis (via layoutChildren()). This is used to force an update while the main chart area is being updated (a requestLayout()) would be executed only during the next pulse. This is used explicitly in the Chart class. Outside use of this context should be limited to a minimum... handle with care- Specified by:
forceRedrawin interfaceAxis
-
getAxisLabelFormatter
public AxisLabelFormatter getAxisLabelFormatter()
-
getCanvas
public javafx.scene.canvas.Canvas getCanvas()
-
getDisplayPosition
public double getDisplayPosition(double value)
Get the display position along this axis for a given value. If the value is not in the current range, the returned value will be an extrapolation of the display position.- Specified by:
getDisplayPositionin interfaceAxis- Parameters:
value- The data value to work out display position for- Returns:
- display position
-
getGraphicsContext
public javafx.scene.canvas.GraphicsContext getGraphicsContext()
-
getNewTickMark
public TickMark getNewTickMark(java.lang.Double tickValue, double tickPosition, java.lang.String tickMarkLabel)
-
getTickMarkLabel
public java.lang.String getTickMarkLabel(double value)
Get the string label name for a tick mark with the given value- Specified by:
getTickMarkLabelin interfaceAxis- Parameters:
value- The value to format into a tick label string- Returns:
- A formatted string for the given value
-
getZeroPosition
public double getZeroPosition()
Get the display position of the zero line along this axis.- Specified by:
getZeroPositionin interfaceAxis- Returns:
- display position or Double.NaN if zero is not in current range;
-
invalidateCaches
public void invalidateCaches()
-
invalidateRange
public void invalidateRange(java.util.List<java.lang.Number> data)
Called 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.- Specified by:
invalidateRangein interfaceAxis- Parameters:
data- The current set of all data that needs to be plotted on this axis
-
isLabelOverlapping
public boolean isLabelOverlapping()
-
isValueOnAxis
public boolean isValueOnAxis(double value)
Checks if the given value is plottable on this axis- Specified by:
isValueOnAxisin interfaceAxis- Parameters:
value- The value to check if its on axis- Returns:
- true if the given value is plottable on this axis
-
recomputeTickMarks
public void recomputeTickMarks()
-
requestAxisLayout
public void requestAxisLayout()
Request that the axis is laid out in the next layout pass. This replaces requestLayout() as it has been overridden to do nothing so that changes to children's bounds etc do not cause a layout. This was done as a optimisation as the Axis knows the exact minimal set of changes that really need layout to be updated. So we only want to request layout then, not on any child change.- Specified by:
requestAxisLayoutin interfaceAxis
-
setAxisLabelFormatter
public void setAxisLabelFormatter(AxisLabelFormatter value)
-
setMax
public boolean setMax(double value)
- Specified by:
setMaxin interfacede.gsi.dataset.AxisDescription- Overrides:
setMaxin classAbstractAxisParameter
-
setMin
public boolean setMin(double value)
- Specified by:
setMinin interfacede.gsi.dataset.AxisDescription- Overrides:
setMinin classAbstractAxisParameter
-
autoRange
protected AxisRange autoRange(double length)
This calculates the upper and lower bound 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.- Parameters:
length- The length of the axis in screen coordinates- Returns:
- Range information, this is implementation dependent
-
autoRange
protected AxisRange autoRange(double minValue, double maxValue, double length, double labelSize)
-
calculateMajorTickValues
protected abstract java.util.List<java.lang.Double> calculateMajorTickValues(double length, AxisRange range)Calculate a list of all the data values for each tick mark in range- Parameters:
length- The length of the axis in display unitsrange- A range object returned from autoRange()- Returns:
- A list of tick marks that fit along the axis if it was the given length
-
calculateMinorTickValues
protected abstract java.util.List<java.lang.Double> calculateMinorTickValues()
Calculate a list of the data values for every minor tick mark- Returns:
- List of data values where to draw minor tick marks
-
calculateNewScale
protected double calculateNewScale(double length, double lowerBound, double upperBound)Calculate a new scale for this axis. This should not effect any state(properties) of this axis.- Parameters:
length- The display length of the axislowerBound- The lower bound valueupperBound- The upper bound value- Returns:
- new scale to fit the range from lower bound to upper bound in the given display length
-
clearAxisCanvas
protected void clearAxisCanvas(javafx.scene.canvas.GraphicsContext gc, double width, double height)
-
computePrefHeight
protected double computePrefHeight(double width)
Computes the preferred height of this axis for the given width. If axis orientation is horizontal, it takes into account the tick mark length, tick label gap and label height.- Overrides:
computePrefHeightin classjavafx.scene.layout.Region- Returns:
- the computed preferred width for this axis
-
computePrefWidth
protected double computePrefWidth(double height)
Computes the preferred width of this axis for the given height. If axis orientation is vertical, it takes into account the tick mark length, tick label gap and label height.- Overrides:
computePrefWidthin classjavafx.scene.layout.Region- Returns:
- the computed preferred width for this axis
-
computeRange
protected abstract AxisRange computeRange(double minValue, double maxValue, double axisLength, double labelSize)
Computes range of this axis, similarly toautoRange(double, double, double, double). The major difference is that this method is called whenauto-rangeis off.- Parameters:
minValue- The min data value that needs to be plotted on this axismaxValue- The max data value that needs to be plotted on this axisaxisLength- The length of the axis in display coordinateslabelSize- The approximate average size a label takes along the axis- Returns:
- The calculated range
- See Also:
autoRange(double, double, double, double)
-
computeTickMarks
protected java.util.List<TickMark> computeTickMarks(AxisRange range, boolean majorTickMark)
-
drawAxisLabel
protected void drawAxisLabel(javafx.scene.canvas.GraphicsContext gc, double axisWidth, double axisHeight, javafx.scene.text.Text axisName, javafx.collections.ObservableList<TickMark> tickMarks, double tickLength)
-
drawAxisLine
protected void drawAxisLine(javafx.scene.canvas.GraphicsContext gc, double axisLength, double axisWidth, double axisHeight)
-
drawAxisPost
protected void drawAxisPost()
function to be executed after the axis has been drawn can be used to execute user-specific code (e.g. update of other classes/properties)
-
drawAxisPre
protected void drawAxisPre()
function to be executed prior to drawing axis can be used to execute user-specific code (e.g. modifying tick-marks) prior to drawing
-
drawTickLabels
protected void drawTickLabels(javafx.scene.canvas.GraphicsContext gc, double axisWidth, double axisHeight, javafx.collections.ObservableList<TickMark> tickMarks, double tickLength)
-
drawTickMarks
protected void drawTickMarks(javafx.scene.canvas.GraphicsContext gc, double axisLength, double axisWidth, double axisHeight, javafx.collections.ObservableList<TickMark> tickMarks, double tickLength, javafx.scene.shape.Path tickStyle)
-
getAxisRange
protected AxisRange getAxisRange()
- Returns:
- axsis range that is supposed to be shown
-
layoutChildren
protected void layoutChildren()
Invoked during the layout pass to layout this axis and all its content.- Overrides:
layoutChildrenin classjavafx.scene.Parent
-
measureTickMarkLength
protected double measureTickMarkLength(java.lang.Double major)
-
recomputeTickMarks
protected void recomputeTickMarks(AxisRange range)
-
setRange
protected void setRange(AxisRange rangeObj, boolean animate)
-
shouldAnimate
protected boolean shouldAnimate()
This is used to check if any given animation should run. It returns true if animation is enabled and the node is visible and in a scene.- Returns:
- true if animations should happen
-
tickMarksUpdated
protected void tickMarksUpdated()
Called during layout if the tickmarks have been updated, allowing subclasses to do anything they need to in reaction.
-
updateCachedVariables
protected void updateCachedVariables()
to be overwritten by derived class that want to cache variables for efficiency reasons
-
updateCSS
protected void updateCSS()
-
drawAxisLabel
protected static void drawAxisLabel(javafx.scene.canvas.GraphicsContext gc, double x, double y, javafx.scene.text.Text label)
-
drawTickMarkLabel
protected static void drawTickMarkLabel(javafx.scene.canvas.GraphicsContext gc, double x, double y, double scaleFont, TickMark tickMark)
-
getMaxTickLabelHeight
protected static double getMaxTickLabelHeight(java.util.List<TickMark> tickMarks)
-
getMaxTickLabelWidth
protected static double getMaxTickLabelWidth(java.util.List<TickMark> tickMarks)
-
snap
protected static double snap(double coordinate)
- Parameters:
coordinate- double coordinate to snapped to actual pixel index- Returns:
- coordinate that is snapped to pixel (for a 'crisper' display)
-
-