use of com.djrapitops.plan.delivery.rendering.json.graphs.line.Point in project Plan by plan-player-analytics.
the class MutatorFunctions method addMissing.
public static List<Point> addMissing(List<Point> points, LineGraph.GapStrategy gapStrategy) {
if (points == null || points.isEmpty())
return points;
List<Point> filled = new ArrayList<>();
Long lastX = null;
for (Point point : points) {
long date = (long) point.getX();
if (lastX != null && date - lastX > gapStrategy.acceptableGapMs) {
addMissing(lastX, date, filled, gapStrategy);
}
lastX = date;
filled.add(point);
}
return filled;
}
use of com.djrapitops.plan.delivery.rendering.json.graphs.line.Point in project Plan by plan-player-analytics.
the class GraphJSONCreator method playersOnlineGraph.
public String playersOnlineGraph(ServerUUID serverUUID) {
Database db = dbSystem.getDatabase();
long now = System.currentTimeMillis();
long halfYearAgo = now - TimeUnit.DAYS.toMillis(180L);
List<Point> points = Lists.map(db.query(TPSQueries.fetchPlayersOnlineOfServer(halfYearAgo, now, serverUUID)), Point::fromDateObj);
return "{\"playersOnline\":" + graphs.line().lineGraph(points).toHighChartsSeries() + ",\"color\":\"" + theme.getValue(ThemeVal.GRAPH_PLAYERS_ONLINE) + "\"}";
}
use of com.djrapitops.plan.delivery.rendering.json.graphs.line.Point in project Plan by plan-player-analytics.
the class MutatorFunctions method addMissing.
private static void addMissing(long from, long to, List<Point> points, LineGraph.GapStrategy gapStrategy) {
long iterate = from + gapStrategy.diffToFirstGapPointMs;
while (iterate < to) {
points.add(new Point(iterate, gapStrategy.fillWith));
iterate += gapStrategy.fillFrequencyMs;
}
}