Module xaos.ui.plot

Class LineChartFX<X,​Y>

  • Type Parameters:
    X - Type of X values.
    Y - Type of Y values.
    All Implemented Interfaces:
    Pluggable, Styleable, EventTarget

    public class LineChartFX<X,​Y>
    extends LineChart<X,​Y>
    implements Pluggable
    A thin extension of the FX LineChart supporting custom plugin implementations.
    Author:
    Grzegorz Kruk (original author)., claudio.rosati@esss.se
    • Constructor Detail

      • LineChartFX

        public LineChartFX​(Axis<X> xAxis,
                           Axis<Y> yAxis)
        Construct a new line chart with the given axis and data.
        Parameters:
        xAxis - The x axis to use.
        yAxis - The y axis to use.
        See Also:
        LineChart(Axis, Axis)
      • LineChartFX

        public LineChartFX​(Axis<X> xAxis,
                           Axis<Y> yAxis,
                           ObservableList<XYChart.Series<X,​Y>> data)
        Construct a new line chart with the given axis and data.
        Parameters:
        xAxis - The x axis to use.
        yAxis - The y axis to use.
        data - The data to use, this is the actual list used so any changes to it will be reflected in the chart.
        See Also:
        LineChart(Axis, Axis, ObservableList)
    • Method Detail

      • of

        public static LineChartFX<Number,​Number> of​(ObservableList<Double> data,
                                                          String seriesName)
        Quick way of creating a line chart showing the given data. X axis will contain the index in the data point in the given list.
        Parameters:
        data - The data list to be charted.
        seriesName - The name of the XYChart.Series created from the given data.
        Returns:
        A LineChartFX chart.
      • addChartPlugins

        public void addChartPlugins​(ObservableList<Plugin> plugins)
        More robust method for adding plugins to chart.

        Note: Only necessary if more than one plugin is being added at once.

        Parameters:
        plugins - List of Plugins to be added.
      • getChart

        public Chart getChart()
        Specified by:
        getChart in interface Pluggable
        Returns:
        The "pluggable" chart.
      • isNotShownInLegend

        public boolean isNotShownInLegend​(String name)
        Description copied from interface: Pluggable
        Returns whether the series with the given name is displayed in chart Legend or not.
        Specified by:
        isNotShownInLegend in interface Pluggable
        Parameters:
        name - The name of the series to be checked.
        Returns:
        true if the series with the given name is not shown in chart Legend.
      • isSeriesDrawn

        public boolean isSeriesDrawn​(String name)
      • setSeriesDrawn

        public void setSeriesDrawn​(String name,
                                   boolean flag)
      • setHVLSeries

        public final void setHVLSeries​(int horizontal,
                                       int vertical,
                                       int longitudinal)
        Sets which series has to be considered "horizontal", "vertical" and "longitudinal". Special colors will be used to represent horizontal (red), vertical (blue) and longitudinal (green) series.
        Parameters:
        horizontal - Index of the horizontal series. Use -1 if no horizontal series exists.
        vertical - Index of the vertical series. Use -1 if no vertical series exists.
        longitudinal - Index of the longitudinal series. Use -1 if no longitudinal series exists.
      • setNotShownInLegend

        public final void setNotShownInLegend​(String name)
        Description copied from interface: Pluggable
        Specifies a series to not be shown in chart Legend.
        Specified by:
        setNotShownInLegend in interface Pluggable
        Parameters:
        name - The name of the series to not be shown in chart Legend.
      • seriesChanged

        protected void seriesChanged​(ListChangeListener.Change<? extends XYChart.Series> c)
        Make sure the series is assigned the right style when added. Also make sure to use setSeriesDrawn if you want to make sure the plot is not plotted.
        Overrides:
        seriesChanged in class LineChart<X,​Y>
        Parameters:
        c -
      • setSeriesColor

        public void setSeriesColor​(XYChart.Series series,
                                   Color color)
        Set the color used by a series
        Parameters:
        series - the series
        color -
      • setShowLine

        public void setShowLine​(XYChart.Series series,
                                boolean flag)
        Toggle display line option for the specified series and update the plot By default, lines are shown in LineChartFX
        Parameters:
        series - the series
        flag - True to enable line, False to disable
      • setLinesWidth

        public void setLinesWidth​(float width)
      • setShowMarker

        public void setShowMarker​(XYChart.Series series,
                                  boolean flag)
        Toggle display markers for the specified series and update the plot By default, markers are not shown in LineChartFX
        Parameters:
        series - the series
        flag - True to enable markers, False to disable
      • setShowMarkers

        public void setShowMarkers​(boolean flag)
        Set the flag to enable/disable showing symbols on the plot. Use this method instead of setCreateSymbols because the create Symbols flags must always be enabled in this chart. Enabling/disabling symbols is done by CSS styling.
        Parameters:
        flag -
      • getShowMarkers

        public boolean getShowMarkers()
        Get the flag to enable/disable showing symbols on the plot.
        Returns:
      • setDefaultLineColors

        public void setDefaultLineColors()
        Replace default JavaFX colors by XAOS default colors
      • clear

        public void clear()
        Clear all the data in the plot and the styling