Search in sources :

Example 1 with LineGraphFactory

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));
}
Also used : Database(com.djrapitops.plan.storage.database.Database) LineGraphFactory(com.djrapitops.plan.delivery.rendering.json.graphs.line.LineGraphFactory) Point(com.djrapitops.plan.delivery.rendering.json.graphs.line.Point)

Example 2 with LineGraphFactory

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) + "}}";
}
Also used : Database(com.djrapitops.plan.storage.database.Database) LineGraphFactory(com.djrapitops.plan.delivery.rendering.json.graphs.line.LineGraphFactory) TPSMutator(com.djrapitops.plan.delivery.domain.mutators.TPSMutator)

Example 3 with LineGraphFactory

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));
}
Also used : Database(com.djrapitops.plan.storage.database.Database) LineGraphFactory(com.djrapitops.plan.delivery.rendering.json.graphs.line.LineGraphFactory) Point(com.djrapitops.plan.delivery.rendering.json.graphs.line.Point)

Example 4 with LineGraphFactory

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));
}
Also used : Database(com.djrapitops.plan.storage.database.Database) LineGraphFactory(com.djrapitops.plan.delivery.rendering.json.graphs.line.LineGraphFactory) Point(com.djrapitops.plan.delivery.rendering.json.graphs.line.Point)

Example 5 with LineGraphFactory

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));
}
Also used : Database(com.djrapitops.plan.storage.database.Database) LineGraphFactory(com.djrapitops.plan.delivery.rendering.json.graphs.line.LineGraphFactory) Point(com.djrapitops.plan.delivery.rendering.json.graphs.line.Point)

Aggregations

LineGraphFactory (com.djrapitops.plan.delivery.rendering.json.graphs.line.LineGraphFactory)5 Database (com.djrapitops.plan.storage.database.Database)5 Point (com.djrapitops.plan.delivery.rendering.json.graphs.line.Point)4 TPSMutator (com.djrapitops.plan.delivery.domain.mutators.TPSMutator)1