Class AreaSeries


  • public class AreaSeries
    extends Series
    An AreaSeries is used to plot several AbstractLineSeries, one on top of eachother, with the space under each line filled. So, for example, to plot two sets of data:
     LineSeries series1 = new LineSeries("First");
     series1.set(0,0);
     series1.set(5,5);
     LineSeries series2 = new LineSeries("Second");
     series1.set(0,2);
     series1.set(5,4);
    
     AreaSeries series = new AreaSeries("Both");
     series.add(series1);
     series.add(series2);
     
    • Constructor Detail

      • AreaSeries

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

      • setPreAccumulated

        public void setPreAccumulated​(boolean on)
        Sets whether the values in the Line series have already been totaled up. For instance, if the first series has f(x)=4 and the second series has f(x)=6, when this flag is set then the values will be plotted exactly as specified - 4 and 6. If this flag is false (the default), the value from the first series will be plotted at 4, and the second at 10.
        Parameters:
        on - whether to consider the values in the series as already accumulated. Default is false
      • setAwayFromZero

        public void setAwayFromZero​(boolean on)

        Sets how negative and positive values in the Line Series making up this Area Series are accumulated.

        • If true (the default), negative and positive values are handled separately: they will both grow away from zero, so the data doesn't overlap.

          For example, lets say there are 4 LineSeries in this AreaSeries, with values of -2, 3, -4 and 5. With this value set to true, the first series will be drawn from 0 to -2; the second from 0 to 3; the third from -2 to -6 and the fourth from 3 to 8.

        • If false, negative and positive values are added together and may overlap. This is how we did things in release 2.4.6 and earlier, and how other software may still do things.

          For example, with the same four values described above, the first series will be drawn from 0 to -2, the second from -2 to 1, the third from 1 to -3 and the fourth from -3 to 2.

        Parameters:
        on - whether to accumulate positive and negative values separately (the default)
        Since:
        2.4.9
      • setZeroStart

        public void setZeroStart​(boolean on)
        When plotting data with negative values, this setting controls how the space under the data is filled. If true, the y-value "0" is considered to be the bottom (or top) of the area, and the filled area will be above or below that line. If false, the minimum Y value will be the baseline, and the graph will only grow up.
        Parameters:
        on - whether to treat y=0 as the baseline of the area series. The default is true.
        Since:
        2.4.9