Class ServerGraphDataSource

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

public abstract class ServerGraphDataSource extends Object
Return value for Server/Network graph from GraphProvider annotated method.
  • Constructor Details

    • ServerGraphDataSource

      public ServerGraphDataSource()
  • Method Details

    • getPoint

      public abstract Optional<DataPoint> getPoint(long currentTimestamp)
      Implement this method to return newest datapoint.

      DataPoint should return value for X axis and all values for Y axis.

      Parameters:
      currentTimestamp - Epoch millisecond of method call time.
      Returns:
      Optional.empty() if there's no new point to add.
    • getPointHistory

      public List<DataPoint> getPointHistory(long currentTimestamp)
      Override this method to return point history for your data.

      History data method is called along with other server extension methods.

      Only return history if necessary and not too much at once to avoid server running out of memory.

      Parameters:
      currentTimestamp - Epoch millisecond of method call time.
      Returns:
      List of points to add to Plan, each DataPoint including value for X axis and all values for Y axis.
    • getSeriesMetadata

      public abstract List<SeriesMetadata> getSeriesMetadata()
      Implement this method to return SeriesMetadata for each Y axis value.

      This method will be called when Extension is registered, and any time DataPoint has more values than previously.

      Index in List defines which series metadata is for - if series stops getting data return null in that index.

      Returns:
      List.of({metadata for Y series of DataPoint#values[0]}, {metadata for Y series of DataPoint#values[1]}, ...etc)
      Throws:
      NotReadyException - If you can't call this yet - empty metadata will be given.
      RuntimeException - Data source registration will fail.