Class DataPoint

java.lang.Object
com.djrapitops.plan.extension.graph.DataPoint

public class DataPoint extends Object
Represents series of values at point x.

x can be timestamp in milliseconds, time, or a value, depending on XAxisType chosen with GraphProvider.xAxisType().

Values can be integers, longs or doubles, even though they're stored as doubles in the database. VALUES OF SAME SERIES OF DATA NEED TO BE AT SAME INDEX ALL THE TIME.

Series are defined by index in the array. If you want more series, you need to add more data to the array.

nulls can be inserted in the middle if some series suddenly stops having data.

Requires capability DATA_EXTENSION_GRAPH_API.

  • Constructor Details

    • DataPoint

      public DataPoint(long x, Number... values)
      Create a new datapoint.

      Supports nulls in values.

      Parameters:
      x - value of x on the x-axis for this value.
      values - 1 to n numbers (double/long/int etc) - index determines series, series need to remain at same index every time forever.
    • DataPoint

      public DataPoint(long x, List<Number> values)
      Create a new datapoint with a List.

      Supports nulls in values.

      Parameters:
      x - value of x on the x-axis for this value.
      values - 1 to n numbers (double/long/int etc) - index determines series, series need to remain at same index every time forever.
  • Method Details

    • getX

      public long getX()
      Get the x value.
      Returns:
      long
    • getValues

      public List<Double> getValues()
      Get the values for this datapoint.
      Returns:
      List of doubles.