Class LineSeries


  • public class LineSeries
    extends AbstractLineSeries
    The LineSeries represents the data found on a typical line graph - a collection of sampled values. Samples are set using the set(double, double) method. For example, to plot a simple LineGraph:
     LineSeries series = new LineSeries("Samples");
     series.set(1, 10);
     series.set(3, 12);
     series.set(7, 5);
     axesgraph.addSeries(series);
     
    See the DateAxis API documentation to see how to plot dates on a LineSeries.
    See Also:
    DateAxis, AreaSeries
    • Constructor Detail

      • LineSeries

        public LineSeries​(String name)
        Create a new LineSeries
        Parameters:
        name - the name of the series
    • Method Detail

      • set

        public void set​(double x,
                        double y)
        Set a value on the graph. The x parameter specifies the horizontal position on the graph, and must be a real number. The y parameter specifies the vertical position, and may be a real number or Double.NaN, which will result in a gap in the line where that point would have been.
        Parameters:
        x - the X co-ordinate of the sample
        y - the Y co-ordinate of the sample
      • getData

        public SortedMap<Double,​Double> getData()
        Return a SortedMap containing a copy of all the data points of this LineSeries, where the X and Y values are the Key and Value, stored as Doubles.
        Since:
        2.3.4
      • setMaxDataPoints

        public void setMaxDataPoints​(int points)
        Set the maximum number of data points that will be drawn with this LineSeries. This method is useful when plotting very large series - for example, when plotting data to a bitmap image 100 pixels wide, there is no point in plotting thousands of points. This method attempts to drop less significant points from the series, leaving peaks and troughs intact if possible. The default value is 0, which means all points will be plotted.
        Parameters:
        points - the maximum number of data points to plot in this series, or 0 to not set a maximum
        Since:
        2.0.1