Package de.gsi.chart
Class XYChart
- java.lang.Object
-
- javafx.scene.Node
-
- javafx.scene.Parent
-
- javafx.scene.layout.Region
-
- javafx.scene.control.Control
-
- de.gsi.chart.ui.HiddenSidesPane
-
- de.gsi.chart.Chart
-
- de.gsi.chart.XYChart
-
- All Implemented Interfaces:
javafx.beans.Observable,javafx.css.Styleable,javafx.event.EventTarget,javafx.scene.control.Skinnable
public class XYChart extends Chart
Chart designed primarily to display data traces using DataSet interfaces which are more flexible and efficient than the observable lists used by XYChart. Brief history: original design inspired by Oracle, extended by CERN (i.e. plugin concept/zoomer), modified to mitigate JavaFX performance issues and extended renderer concept/canvas-concept/interfaces/+more plugins by GSI. Refactored and re-write in 2018 to make it compatible with Apache 2.0 which -- in the spirit of 'Ship of Theseus' -- makes it de-facto a new development. Contributions, bug-fixes, and modifications are welcome. Hope you find this library useful and enjoy!- Author:
- braeun, rstein
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.gsi.chart.Chart
Chart.ChartHBox, Chart.ChartVBox
-
-
Field Summary
Fields Modifier and Type Field Description protected static intBURST_LIMIT_MSprotected javafx.beans.value.ChangeListener<? super java.lang.Boolean>gridLineVisibilitychangeprotected javafx.beans.property.BooleanPropertypolarPlot-
Fields inherited from class de.gsi.chart.Chart
allDataSets, animator, autoNotification, axesAndCanvasPane, axesChangeListener, axesChangeListenerLocal, axesCorner, axesList, axesPane, canvas, canvasForeground, datasetChangeListener, dataSetDataListener, DEBUG, hiddenPane, isAxesUpdate, isCanvasChangeRequested, layoutOngoing, listeners, parameterDisplayPane, plotBackground, plotForeGround, pluginsArea, pluginsChangedListener, showing, showingBinding, showingListener, title, titleLabel, titleLegendCorner, titleLegendPane, toolBar, toolBarPinned, windowPropertyListener
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaxesChanged(javafx.collections.ListChangeListener.Change<? extends Axis> change)add XYChart specific axis handling (ie.protected voidaxisSideChanged(javafx.beans.value.ObservableValue<? extends Side> change, Side oldValue, Side newValue)protected voidcheckRendererForRequiredAxes(Renderer renderer)checks whether renderer has required x and y axes and adds the first x or y from the chart itself if necessaryjavafx.collections.ObservableList<de.gsi.dataset.DataSet>getAllDatasets()javafx.collections.ObservableList<de.gsi.dataset.DataSet>getAllShownDatasets()protected java.util.List<de.gsi.dataset.DataSet>getDataSetForAxis(Axis axis)GridRenderergetGridRenderer()PolarTickStepgetPolarStepSize()AxisgetXAxis()Returns the x axis.AxisgetYAxis()Returns the y axis.javafx.beans.property.BooleanPropertyhorizontalGridLinesVisibleProperty()Indicates whether horizontal grid lines are visible or not.booleanisHorizontalGridLinesVisible()Indicates whether horizontal grid lines are visible.booleanisPolarPlot()whether renderer should use polar coordinates (x -> interpreted as phi, y as radial coordinate)booleanisVerticalGridLinesVisible()Indicates whether vertical grid lines are visible.javafx.beans.property.BooleanPropertypolarPlotProperty()Sets whether renderer should use polar coordinates (x -> interpreted as phi, y as radial coordinate)javafx.beans.property.ObjectProperty<PolarTickStep>polarStepSizeProperty()protected voidredrawCanvas()(re-)draw canvas (if necessary).protected voidrendererChanged(javafx.collections.ListChangeListener.Change<? extends Renderer> change)voidsetHorizontalGridLinesVisible(boolean value)Sets the value of theverticalGridLinesVisibleProperty().XYChartsetPolarPlot(boolean state)Sets whether renderer should use polar coordinates (x -> interpreted as phi, y as radial coordinate)voidsetPolarStepSize(PolarTickStep step)voidsetVerticalGridLinesVisible(boolean value)Sets the value of theverticalGridLinesVisibleProperty().voidupdateAxisRange()update axes ranges (if necessary).protected static voidupdateNumericAxis(Axis axis, java.util.List<de.gsi.dataset.DataSet> dataSets)javafx.beans.property.BooleanPropertyverticalGridLinesVisibleProperty()Indicates whether vertical grid lines are visible or not.-
Methods inherited from class de.gsi.chart.Chart
addListener, animate, animate, animatedProperty, autoNotificationProperty, axesChangedLocal, axesInvalidated, createChildGroup, dataSetInvalidated, datasetsChanged, executeFireInvalidated, fireInvalidated, getAxes, getAxesAndCanvasPane, getAxesCornerPane, getAxesPane, getCanvas, getCanvasForeground, getClassCssMetaData, getControlCssMetaData, getDatasets, getFirstAxis, getLegend, getLegendSide, getMeasurementBar, getMeasurementBarSide, getPlotArea, getPlotBackground, getPlotForeground, getPlugins, getRenderers, getTitle, getTitleLegendCornerPane, getTitleLegendPane, getTitleSide, getToolBar, getToolBarSide, isAnimated, isAutoNotification, isLegendVisible, isShowing, isToolBarPinned, layoutChildren, layoutPluginsChildren, legendProperty, legendSideProperty, legendVisibleProperty, measurementBarSideProperty, pluginAdded, pluginRemoved, pluginsChanged, registerShowingListener, removeFromAllAxesPanes, removeListener, requestLayout, setAnimated, setAutoNotification, setLegend, setLegendSide, setLegendVisible, setMeasurementBarSide, setTitle, setTitleSide, setToolBarPinned, setToolBarSide, shouldAnimate, showingProperty, titleProperty, titleSideProperty, toolBarPinnedProperty, toolBarSideProperty, toPlotArea, updateLegend, updatePluginsArea
-
Methods inherited from class de.gsi.chart.ui.HiddenSidesPane
animationDelayProperty, animationDurationProperty, bottomProperty, contentProperty, createDefaultSkin, getAnimationDelay, getAnimationDuration, getBottom, getContent, getLeft, getPinnedSide, getRight, getTop, getTriggerDistance, leftProperty, pinnedSideProperty, resizeRelocate, rightProperty, setAnimationDelay, setAnimationDuration, setBottom, setContent, setLeft, setPinnedSide, setRight, setTop, setTriggerDistance, topProperty, triggerDistanceProperty
-
Methods inherited from class javafx.scene.control.Control
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, executeAccessibleAction, getBaselineOffset, getContextMenu, getCssMetaData, getInitialFocusTraversable, getSkin, getTooltip, isResizable, queryAccessibleAttribute, setContextMenu, setSkin, setTooltip, skinProperty, tooltipProperty
-
Methods inherited from class javafx.scene.layout.Region
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, 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
getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, 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, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, 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, 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
-
-
-
-
Field Detail
-
BURST_LIMIT_MS
protected static final int BURST_LIMIT_MS
- See Also:
- Constant Field Values
-
polarPlot
protected javafx.beans.property.BooleanProperty polarPlot
-
gridLineVisibilitychange
protected final javafx.beans.value.ChangeListener<? super java.lang.Boolean> gridLineVisibilitychange
-
-
Method Detail
-
axesChanged
protected void axesChanged(javafx.collections.ListChangeListener.Change<? extends Axis> change)
add XYChart specific axis handling (ie. placement around charts, add new DefaultNumericAxis if one is missing, etc.)- Specified by:
axesChangedin classChart- Parameters:
change- the new axis change that is being added
-
axisSideChanged
protected void axisSideChanged(javafx.beans.value.ObservableValue<? extends Side> change, Side oldValue, Side newValue)
-
checkRendererForRequiredAxes
protected void checkRendererForRequiredAxes(Renderer renderer)
checks whether renderer has required x and y axes and adds the first x or y from the chart itself if necessaryadditionally moves axis from Renderer with defined Side that are not yet in the Chart also to the chart's list
- Parameters:
renderer- to be checked
-
getAllDatasets
public javafx.collections.ObservableList<de.gsi.dataset.DataSet> getAllDatasets()
- Overrides:
getAllDatasetsin classChart- Returns:
- datasets attached to the chart and datasets attached to all renderers
-
getAllShownDatasets
public javafx.collections.ObservableList<de.gsi.dataset.DataSet> getAllShownDatasets()
- Returns:
- datasets attached to the chart and datasets attached to all renderers TODO: change to change listener that add/remove datasets from a global observable list
-
getDataSetForAxis
protected java.util.List<de.gsi.dataset.DataSet> getDataSetForAxis(Axis axis)
-
getGridRenderer
public GridRenderer getGridRenderer()
- Returns:
- nomen est omen
-
getPolarStepSize
public PolarTickStep getPolarStepSize()
-
getXAxis
public Axis getXAxis()
Returns the x axis.- Returns:
- x axis
-
getYAxis
public Axis getYAxis()
Returns the y axis.- Returns:
- y axis
-
horizontalGridLinesVisibleProperty
public final javafx.beans.property.BooleanProperty horizontalGridLinesVisibleProperty()
Indicates whether horizontal grid lines are visible or not.- Returns:
- horizontalGridLinesVisible property
-
isHorizontalGridLinesVisible
public final boolean isHorizontalGridLinesVisible()
Indicates whether horizontal grid lines are visible.- Returns:
trueif horizontal grid lines are visible elsefalse.
-
isPolarPlot
public final boolean isPolarPlot()
whether renderer should use polar coordinates (x -> interpreted as phi, y as radial coordinate)- Returns:
- true if renderer is plotting in polar coordinates
-
isVerticalGridLinesVisible
public final boolean isVerticalGridLinesVisible()
Indicates whether vertical grid lines are visible.- Returns:
trueif vertical grid lines are visible elsefalse.
-
polarPlotProperty
public final javafx.beans.property.BooleanProperty polarPlotProperty()
Sets whether renderer should use polar coordinates (x -> interpreted as phi, y as radial coordinate)- Returns:
- true if renderer is plotting in polar coordinates
-
polarStepSizeProperty
public javafx.beans.property.ObjectProperty<PolarTickStep> polarStepSizeProperty()
-
redrawCanvas
protected void redrawCanvas()
Description copied from class:Chart(re-)draw canvas (if necessary). This is supposed to be implemented in derived classes- Specified by:
redrawCanvasin classChart
-
rendererChanged
protected void rendererChanged(javafx.collections.ListChangeListener.Change<? extends Renderer> change)
- Overrides:
rendererChangedin classChart
-
setHorizontalGridLinesVisible
public final void setHorizontalGridLinesVisible(boolean value)
Sets the value of theverticalGridLinesVisibleProperty().- Parameters:
value-trueto make vertical lines visible
-
setPolarPlot
public final XYChart setPolarPlot(boolean state)
Sets whether renderer should use polar coordinates (x -> interpreted as phi, y as radial coordinate)- Parameters:
state- true if renderer is parallelising sub-functionalities- Returns:
- itself (fluent design)
-
setPolarStepSize
public void setPolarStepSize(PolarTickStep step)
-
setVerticalGridLinesVisible
public final void setVerticalGridLinesVisible(boolean value)
Sets the value of theverticalGridLinesVisibleProperty().- Parameters:
value-trueto make vertical lines visible
-
updateAxisRange
public void updateAxisRange()
Description copied from class:Chartupdate axes ranges (if necessary). This is supposed to be implemented in derived classes- Specified by:
updateAxisRangein classChart
-
verticalGridLinesVisibleProperty
public final javafx.beans.property.BooleanProperty verticalGridLinesVisibleProperty()
Indicates whether vertical grid lines are visible or not.- Returns:
- verticalGridLinesVisible property
-
updateNumericAxis
protected static void updateNumericAxis(Axis axis, java.util.List<de.gsi.dataset.DataSet> dataSets)
-
-