Class GridRenderer

  • All Implemented Interfaces:
    Renderer, javafx.css.Styleable, javafx.event.EventTarget

    public class GridRenderer
    extends javafx.scene.layout.Pane
    implements Renderer
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected javafx.collections.ObservableList<Axis> axesList  
      • Fields inherited from class javafx.scene.layout.Region

        USE_COMPUTED_SIZE, USE_PREF_SIZE
      • Fields inherited from class javafx.scene.Node

        BASELINE_OFFSET_SAME_AS_HEIGHT
    • Constructor Summary

      Constructors 
      Constructor Description
      GridRenderer()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected static void applyGraphicsStyleFromLineStyle​(javafx.scene.canvas.GraphicsContext gc, javafx.scene.shape.Line style)  
      protected void drawEuclideanGrid​(javafx.scene.canvas.GraphicsContext gc, XYChart xyChart)  
      protected void drawHorizontalMajorGridLines​(javafx.scene.canvas.GraphicsContext gc, Axis yAxis, double xAxisWidthSnapped, double yAxisHeight)  
      protected void drawHorizontalMinorGridLines​(javafx.scene.canvas.GraphicsContext gc, Axis yAxis, double xAxisWidthSnapped, double yAxisHeight)  
      javafx.scene.canvas.Canvas drawLegendSymbol​(de.gsi.dataset.DataSet dataSet, int dsIndex, int width, int height)  
      javafx.beans.property.BooleanProperty drawOnTopProperty()
      Indicates whether grid lines should be drawn on top or beneath graphs
      protected void drawPolarCircle​(javafx.scene.canvas.GraphicsContext gc, Axis yAxis, double yRange, double xCentre, double yCentre, double maxRadius)  
      protected void drawPolarGrid​(javafx.scene.canvas.GraphicsContext gc, XYChart xyChart)  
      protected void drawVerticalMajorGridLines​(javafx.scene.canvas.GraphicsContext gc, Axis xAxis, double xAxisWidth, double yAxisHeightSnapped)  
      protected void drawVerticalMinorGridLines​(javafx.scene.canvas.GraphicsContext gc, Axis xAxis, double xAxisWidth, double yAxisHeightSnapped)  
      javafx.collections.ObservableList<Axis> getAxes()  
      java.util.List<javafx.css.CssMetaData<? extends javafx.css.Styleable,​?>> getCssMetaData()  
      javafx.collections.ObservableList<de.gsi.dataset.DataSet> getDatasets()  
      javafx.collections.ObservableList<de.gsi.dataset.DataSet> getDatasetsCopy()  
      javafx.scene.shape.Line getHorizontalMajorGrid()
      modify this to change drawing of horizontal major grid lines
      javafx.scene.shape.Line getHorizontalMinorGrid()
      modify this to change drawing of horizontal minor grid lines
      javafx.scene.shape.Line getVerticalMajorGrid()
      modify this to change drawing of vertical major grid lines
      javafx.scene.shape.Line getVerticalMinorGrid()
      modify this to change drawing of vertical minor grid lines
      javafx.beans.property.BooleanProperty horizontalGridLinesVisibleProperty()
      Indicates whether horizontal major grid lines are visible or not.
      javafx.beans.property.BooleanProperty horizontalMinorGridLinesVisibleProperty()
      Indicates whether horizontal minor grid lines are visible or not.
      boolean isDrawOnTop()
      Indicates whether grid lines should be drawn on top or beneath graphs
      java.util.List<de.gsi.dataset.DataSet> render​(javafx.scene.canvas.GraphicsContext gc, Chart chart, int dataSetOffset, javafx.collections.ObservableList<de.gsi.dataset.DataSet> datasets)  
      void setDrawOnTop​(boolean state)
      Indicates whether grid lines should be drawn on top or beneath graphs
      Renderer setShowInLegend​(boolean state)
      Sets whether DataSets attached to this renderer shall be shown in the legend
      boolean showInLegend()
      Sets whether DataSets attached to this renderer shall be shown in the legend
      javafx.beans.property.BooleanProperty showInLegendProperty()
      Sets whether DataSets attached to this renderer shall be shown in the legend
      javafx.beans.property.BooleanProperty verticalGridLinesVisibleProperty()
      Indicates whether vertical major grid lines are visible or not.
      javafx.beans.property.BooleanProperty verticalMinorGridLinesVisibleProperty()
      Indicates whether vertical minor grid lines are visible or not.
      • Methods inherited from class javafx.scene.layout.Pane

        getChildren
      • Methods inherited from class javafx.scene.layout.Region

        backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, getBackground, getBorder, getClassCssMetaData, 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, layoutChildren, 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 javafx.css.Styleable

        getStyleableNode
    • Field Detail

      • axesList

        protected final javafx.collections.ObservableList<Axis> axesList
    • Constructor Detail

      • GridRenderer

        public GridRenderer()
    • Method Detail

      • drawEuclideanGrid

        protected void drawEuclideanGrid​(javafx.scene.canvas.GraphicsContext gc,
                                         XYChart xyChart)
      • drawHorizontalMajorGridLines

        protected void drawHorizontalMajorGridLines​(javafx.scene.canvas.GraphicsContext gc,
                                                    Axis yAxis,
                                                    double xAxisWidthSnapped,
                                                    double yAxisHeight)
      • drawHorizontalMinorGridLines

        protected void drawHorizontalMinorGridLines​(javafx.scene.canvas.GraphicsContext gc,
                                                    Axis yAxis,
                                                    double xAxisWidthSnapped,
                                                    double yAxisHeight)
      • drawLegendSymbol

        public javafx.scene.canvas.Canvas drawLegendSymbol​(de.gsi.dataset.DataSet dataSet,
                                                           int dsIndex,
                                                           int width,
                                                           int height)
        Specified by:
        drawLegendSymbol in interface Renderer
        Parameters:
        dataSet - the data set for which the representative icon should be generated
        dsIndex - index within renderer set
        width - requested width of the returning Canvas
        height - requested height of the returning Canvas
        Returns:
        a graphical icon representation of the given data sets
      • drawOnTopProperty

        public final javafx.beans.property.BooleanProperty drawOnTopProperty()
        Indicates whether grid lines should be drawn on top or beneath graphs
        Returns:
        drawOnTop property
      • drawPolarCircle

        protected void drawPolarCircle​(javafx.scene.canvas.GraphicsContext gc,
                                       Axis yAxis,
                                       double yRange,
                                       double xCentre,
                                       double yCentre,
                                       double maxRadius)
      • drawPolarGrid

        protected void drawPolarGrid​(javafx.scene.canvas.GraphicsContext gc,
                                     XYChart xyChart)
      • drawVerticalMajorGridLines

        protected void drawVerticalMajorGridLines​(javafx.scene.canvas.GraphicsContext gc,
                                                  Axis xAxis,
                                                  double xAxisWidth,
                                                  double yAxisHeightSnapped)
      • drawVerticalMinorGridLines

        protected void drawVerticalMinorGridLines​(javafx.scene.canvas.GraphicsContext gc,
                                                  Axis xAxis,
                                                  double xAxisWidth,
                                                  double yAxisHeightSnapped)
      • getAxes

        public javafx.collections.ObservableList<Axis> getAxes()
        Specified by:
        getAxes in interface Renderer
        Returns:
        observable list of axes that are supposed to be used by the renderer
      • getCssMetaData

        public java.util.List<javafx.css.CssMetaData<? extends javafx.css.Styleable,​?>> getCssMetaData()
        Specified by:
        getCssMetaData in interface javafx.css.Styleable
        Overrides:
        getCssMetaData in class javafx.scene.layout.Region
      • getDatasets

        public javafx.collections.ObservableList<de.gsi.dataset.DataSet> getDatasets()
        Specified by:
        getDatasets in interface Renderer
      • getDatasetsCopy

        public javafx.collections.ObservableList<de.gsi.dataset.DataSet> getDatasetsCopy()
        Specified by:
        getDatasetsCopy in interface Renderer
      • getHorizontalMajorGrid

        public javafx.scene.shape.Line getHorizontalMajorGrid()
        modify this to change drawing of horizontal major grid lines
        Returns:
        the Line node to be styled
      • getHorizontalMinorGrid

        public javafx.scene.shape.Line getHorizontalMinorGrid()
        modify this to change drawing of horizontal minor grid lines
        Returns:
        the Line node to be styled
      • getVerticalMajorGrid

        public javafx.scene.shape.Line getVerticalMajorGrid()
        modify this to change drawing of vertical major grid lines
        Returns:
        the Line node to be styled
      • getVerticalMinorGrid

        public javafx.scene.shape.Line getVerticalMinorGrid()
        modify this to change drawing of vertical minor grid lines
        Returns:
        the Line node to be styled
      • horizontalGridLinesVisibleProperty

        public final javafx.beans.property.BooleanProperty horizontalGridLinesVisibleProperty()
        Indicates whether horizontal major grid lines are visible or not.
        Returns:
        verticalGridLinesVisible property
      • horizontalMinorGridLinesVisibleProperty

        public final javafx.beans.property.BooleanProperty horizontalMinorGridLinesVisibleProperty()
        Indicates whether horizontal minor grid lines are visible or not.
        Returns:
        verticalGridLinesVisible property
      • isDrawOnTop

        public final boolean isDrawOnTop()
        Indicates whether grid lines should be drawn on top or beneath graphs
        Returns:
        drawOnTop state
      • render

        public java.util.List<de.gsi.dataset.DataSet> render​(javafx.scene.canvas.GraphicsContext gc,
                                                             Chart chart,
                                                             int dataSetOffset,
                                                             javafx.collections.ObservableList<de.gsi.dataset.DataSet> datasets)
        Specified by:
        render in interface Renderer
        Parameters:
        gc - the Canvas' GraphicsContext the renderer should draw upon
        chart - the corresponding chart
        dataSetOffset - global offset of the last drawn DataSet
        datasets - list of globally (ie. in Chart) stored DataSets
        Returns:
        List of drawn DataSets (N.B. return '0' in case Renderer.showInLegend() is false)
      • setDrawOnTop

        public final void setDrawOnTop​(boolean state)
        Indicates whether grid lines should be drawn on top or beneath graphs
        Parameters:
        state - true: draw on top
      • setShowInLegend

        public Renderer setShowInLegend​(boolean state)
        Description copied from interface: Renderer
        Sets whether DataSets attached to this renderer shall be shown in the legend
        Specified by:
        setShowInLegend in interface Renderer
        Parameters:
        state - true (default) if data sets are supposed to be drawn
        Returns:
        the renderer class
      • showInLegend

        public boolean showInLegend()
        Description copied from interface: Renderer
        Sets whether DataSets attached to this renderer shall be shown in the legend
        Specified by:
        showInLegend in interface Renderer
        Returns:
        true (default) if data sets are supposed to be drawn
      • showInLegendProperty

        public javafx.beans.property.BooleanProperty showInLegendProperty()
        Description copied from interface: Renderer
        Sets whether DataSets attached to this renderer shall be shown in the legend
        Specified by:
        showInLegendProperty in interface Renderer
        Returns:
        true (default) if data sets are supposed to be drawn
      • verticalGridLinesVisibleProperty

        public final javafx.beans.property.BooleanProperty verticalGridLinesVisibleProperty()
        Indicates whether vertical major grid lines are visible or not.
        Returns:
        verticalGridLinesVisible property
      • verticalMinorGridLinesVisibleProperty

        public final javafx.beans.property.BooleanProperty verticalMinorGridLinesVisibleProperty()
        Indicates whether vertical minor grid lines are visible or not.
        Returns:
        verticalGridLinesVisible property
      • applyGraphicsStyleFromLineStyle

        protected static void applyGraphicsStyleFromLineStyle​(javafx.scene.canvas.GraphicsContext gc,
                                                              javafx.scene.shape.Line style)