Class LinePlot


  • public class LinePlot
    extends Plot
    Implements a LinePlot.
    • Constructor Detail

      • LinePlot

        public LinePlot​(int[] xs,
                        String xLabel,
                        String yLabel)
        Creates a new LinePlot
        Parameters:
        xs - Values of the x axis
        xLabel - Label of the x axis
        yLabel - Label of the y axis
      • LinePlot

        public LinePlot​(int[] xs,
                        String xLabel,
                        String yLabel,
                        boolean hideLegend)
        Creates a new LinePlot
        Parameters:
        xs - Values of the x axis
        xLabel - Label of the x axis
        yLabel - Label of the y axis
        hideLegend - Indicates if the legend must be hidden. False by default.
      • LinePlot

        public LinePlot​(double[] xs,
                        String xLabel,
                        String yLabel)
        Creates a new LinePlot
        Parameters:
        xs - Values of the x axis
        xLabel - Label of the x axis
        yLabel - Label of the y axis
      • LinePlot

        public LinePlot​(double[] xs,
                        String xLabel,
                        String yLabel,
                        boolean hideLegend)
        Creates a new LinePlot
        Parameters:
        xs - Values of the x axis
        xLabel - Label of the x axis
        yLabel - Label of the y axis
        hideLegend - Indicates if the legend must be hidden. False by default.
    • Method Detail

      • addSeries

        public LinePlot addSeries​(String seriesName)
        Adds a new empty series to the plot. All series values are initialized to 0.
        Parameters:
        seriesName - Series name
        Returns:
        Self LinePlot instance
      • addSeries

        public LinePlot addSeries​(String seriesName,
                                  double value)
        Adds a new series to the plot initializing all the values to a constant one.
        Parameters:
        seriesName - Series name
        value - Constant value
        Returns:
        Self LinePlot instance
      • addSeries

        public LinePlot addSeries​(String seriesName,
                                  double[] y)
        Adds a new series to the plot. y values positions must be correlated with xs values.
        Parameters:
        seriesName - Series name
        y - Values
        Returns:
        Self LinePlot instance
      • setValue

        public LinePlot setValue​(String seriesName,
                                 int x,
                                 double y)
        Sets a single value of a series
        Parameters:
        seriesName - Series name
        x - x value. Must exists in xs.
        y - y value
        Returns:
        Self LinePlot instance
      • setValue

        public LinePlot setValue​(String seriesName,
                                 double x,
                                 double y)
        Sets a single value of a series
        Parameters:
        seriesName - Series name
        x - x value. Must exists in xs.
        y - y value
        Returns:
        Self LinePlot instance
      • getDataHeaders

        protected String[] getDataHeaders()
        Description copied from class: Plot
        Returns an String array with the headers of the plot's data
        Specified by:
        getDataHeaders in class Plot
        Returns:
        Headers of the plot's data
      • getDataContent

        protected String[][] getDataContent​(String xAxisTicksFormat,
                                            String yAxisTicksFormat)
        Description copied from class: Plot
        Returns an String matrix with the content of the plot's data. First dimension denotes the row and second dimension denotes the column that must be correlated with the header returned by getDataHeaders().
        Specified by:
        getDataContent in class Plot
        Parameters:
        xAxisTicksFormat - Number format for the values of the x axis
        yAxisTicksFormat - Number format for the values of the x axis
        Returns:
        String matrix with the content of the plot's data
      • getGralPlot

        protected de.erichseifert.gral.plots.AbstractPlot getGralPlot()
        Description copied from class: Plot
        Gets an AbstractPlot using GRAL
        Specified by:
        getGralPlot in class Plot
        Returns:
        GRAL's AbstractPlot