use of com.djrapitops.plan.delivery.rendering.json.graphs.line.LineGraphFactory in project Plan by plan-player-analytics.
the class GraphJSONCreator method uniqueAndNewGraphJSON.
public String uniqueAndNewGraphJSON(ServerUUID serverUUID) {
Database db = dbSystem.getDatabase();
LineGraphFactory lineGraphs = graphs.line();
long now = System.currentTimeMillis();
long halfYearAgo = now - TimeUnit.DAYS.toMillis(180L);
int timeZoneOffset = config.getTimeZone().getOffset(now);
NavigableMap<Long, Integer> uniquePerDay = db.query(PlayerCountQueries.uniquePlayerCounts(halfYearAgo, now, timeZoneOffset, serverUUID));
NavigableMap<Long, Integer> newPerDay = db.query(PlayerCountQueries.newPlayerCounts(halfYearAgo, now, timeZoneOffset, serverUUID));
return createUniqueAndNewJSON(lineGraphs, uniquePerDay, newPerDay, TimeUnit.DAYS.toMillis(1L));
}
use of com.djrapitops.plan.delivery.rendering.json.graphs.line.LineGraphFactory in project Plan by plan-player-analytics.
the class GraphJSONCreator method performanceGraphJSON.
public String performanceGraphJSON(ServerUUID serverUUID) {
long now = System.currentTimeMillis();
Database db = dbSystem.getDatabase();
LineGraphFactory lineGraphs = graphs.line();
long halfYearAgo = now - TimeUnit.DAYS.toMillis(180);
TPSMutator tpsMutator = new TPSMutator(db.query(TPSQueries.fetchTPSDataOfServer(halfYearAgo, now, serverUUID)));
return '{' + "\"playersOnline\":" + lineGraphs.playersOnlineGraph(tpsMutator).toHighChartsSeries() + ",\"tps\":" + lineGraphs.tpsGraph(tpsMutator).toHighChartsSeries() + ",\"cpu\":" + lineGraphs.cpuGraph(tpsMutator).toHighChartsSeries() + ",\"ram\":" + lineGraphs.ramGraph(tpsMutator).toHighChartsSeries() + ",\"entities\":" + lineGraphs.entityGraph(tpsMutator).toHighChartsSeries() + ",\"chunks\":" + lineGraphs.chunkGraph(tpsMutator).toHighChartsSeries() + ",\"disk\":" + lineGraphs.diskGraph(tpsMutator).toHighChartsSeries() + ",\"colors\":{" + "\"playersOnline\":\"" + theme.getValue(ThemeVal.GRAPH_PLAYERS_ONLINE) + "\"," + "\"cpu\":\"" + theme.getValue(ThemeVal.GRAPH_CPU) + "\"," + "\"ram\":\"" + theme.getValue(ThemeVal.GRAPH_RAM) + "\"," + "\"entities\":\"" + theme.getValue(ThemeVal.GRAPH_ENTITIES) + "\"," + "\"chunks\":\"" + theme.getValue(ThemeVal.GRAPH_CHUNKS) + "\"," + "\"low\":\"" + theme.getValue(ThemeVal.GRAPH_TPS_LOW) + "\"," + "\"med\":\"" + theme.getValue(ThemeVal.GRAPH_TPS_MED) + "\"," + "\"high\":\"" + theme.getValue(ThemeVal.GRAPH_TPS_HIGH) + "\"}" + ",\"zones\":{" + "\"tpsThresholdMed\":" + config.get(DisplaySettings.GRAPH_TPS_THRESHOLD_MED) + ',' + "\"tpsThresholdHigh\":" + config.get(DisplaySettings.GRAPH_TPS_THRESHOLD_HIGH) + ',' + "\"diskThresholdMed\":" + config.get(DisplaySettings.GRAPH_DISK_THRESHOLD_MED) + ',' + "\"diskThresholdHigh\":" + config.get(DisplaySettings.GRAPH_DISK_THRESHOLD_HIGH) + "}}";
}
use of com.djrapitops.plan.delivery.rendering.json.graphs.line.LineGraphFactory in project Plan by plan-player-analytics.
the class GraphJSONCreator method hourlyUniqueAndNewGraphJSON.
public String hourlyUniqueAndNewGraphJSON() {
Database db = dbSystem.getDatabase();
LineGraphFactory lineGraphs = graphs.line();
long now = System.currentTimeMillis();
long weekAgo = now - TimeUnit.DAYS.toMillis(7L);
int timeZoneOffset = config.getTimeZone().getOffset(now);
NavigableMap<Long, Integer> uniquePerDay = db.query(PlayerCountQueries.hourlyUniquePlayerCounts(weekAgo, now, timeZoneOffset));
NavigableMap<Long, Integer> newPerDay = db.query(PlayerCountQueries.hourlyNewPlayerCounts(weekAgo, now, timeZoneOffset));
return createUniqueAndNewJSON(lineGraphs, uniquePerDay, newPerDay, TimeUnit.HOURS.toMillis(1L));
}
use of com.djrapitops.plan.delivery.rendering.json.graphs.line.LineGraphFactory in project Plan by plan-player-analytics.
the class GraphJSONCreator method hourlyUniqueAndNewGraphJSON.
public String hourlyUniqueAndNewGraphJSON(ServerUUID serverUUID) {
Database db = dbSystem.getDatabase();
LineGraphFactory lineGraphs = graphs.line();
long now = System.currentTimeMillis();
long weekAgo = now - TimeUnit.DAYS.toMillis(7L);
int timeZoneOffset = config.getTimeZone().getOffset(now);
NavigableMap<Long, Integer> uniquePerDay = db.query(PlayerCountQueries.hourlyUniquePlayerCounts(weekAgo, now, timeZoneOffset, serverUUID));
NavigableMap<Long, Integer> newPerDay = db.query(PlayerCountQueries.newPlayerCounts(weekAgo, now, timeZoneOffset, serverUUID));
return createUniqueAndNewJSON(lineGraphs, uniquePerDay, newPerDay, TimeUnit.HOURS.toMillis(1L));
}
use of com.djrapitops.plan.delivery.rendering.json.graphs.line.LineGraphFactory in project Plan by plan-player-analytics.
the class GraphJSONCreator method uniqueAndNewGraphJSON.
public String uniqueAndNewGraphJSON() {
Database db = dbSystem.getDatabase();
LineGraphFactory lineGraphs = graphs.line();
long now = System.currentTimeMillis();
long halfYearAgo = now - TimeUnit.DAYS.toMillis(180L);
int timeZoneOffset = config.getTimeZone().getOffset(now);
NavigableMap<Long, Integer> uniquePerDay = db.query(PlayerCountQueries.uniquePlayerCounts(halfYearAgo, now, timeZoneOffset));
NavigableMap<Long, Integer> newPerDay = db.query(PlayerCountQueries.newPlayerCounts(halfYearAgo, now, timeZoneOffset));
return createUniqueAndNewJSON(lineGraphs, uniquePerDay, newPerDay, TimeUnit.DAYS.toMillis(1L));
}
Aggregations