Package de.gsi.chart

Class 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
    • Field Detail

      • polarPlot

        protected javafx.beans.property.BooleanProperty polarPlot
      • gridLineVisibilitychange

        protected final javafx.beans.value.ChangeListener<? super java.lang.Boolean> gridLineVisibilitychange
    • Constructor Detail

      • XYChart

        public XYChart()
        Construct a new XYChart with the given axes.
      • XYChart

        public XYChart​(Axis... axes)
        Construct a new XYChart with the given axes.
        Parameters:
        axes - All axes to be added to the chart
    • Method Detail

      • getAllDatasets

        public javafx.collections.ObservableList<de.gsi.dataset.DataSet> getAllDatasets()
        Overrides:
        getAllDatasets in class Chart
        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
      • getGridRenderer

        public GridRenderer getGridRenderer()
        Returns:
        nomen est omen
      • 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:
        true if horizontal grid lines are visible else false.
      • 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:
        true if vertical grid lines are visible else false.
      • 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()
      • setHorizontalGridLinesVisible

        public final void setHorizontalGridLinesVisible​(boolean value)
        Sets the value of the verticalGridLinesVisibleProperty().
        Parameters:
        value - true to 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 the verticalGridLinesVisibleProperty().
        Parameters:
        value - true to make vertical lines visible
      • updateAxisRange

        public void updateAxisRange()
        Description copied from class: Chart
        update axes ranges (if necessary). This is supposed to be implemented in derived classes
        Specified by:
        updateAxisRange in class Chart
      • verticalGridLinesVisibleProperty

        public final javafx.beans.property.BooleanProperty verticalGridLinesVisibleProperty()
        Indicates whether vertical grid lines are visible or not.
        Returns:
        verticalGridLinesVisible property
      • 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:
        axesChanged in class Chart
        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 necessary

        additionally 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
      • getDataSetForAxis

        protected java.util.List<de.gsi.dataset.DataSet> getDataSetForAxis​(Axis axis)
      • 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:
        redrawCanvas in class Chart
      • rendererChanged

        protected void rendererChanged​(javafx.collections.ListChangeListener.Change<? extends Renderer> change)
        Overrides:
        rendererChanged in class Chart
      • updateNumericAxis

        protected static void updateNumericAxis​(Axis axis,
                                                java.util.List<de.gsi.dataset.DataSet> dataSets)