Search in sources :

Example 1 with PingMutator

use of com.djrapitops.plan.delivery.domain.mutators.PingMutator in project Plan by plan-player-analytics.

the class GraphJSONCreator method pingGraphsJSON.

public String pingGraphsJSON(ServerUUID serverUUID) {
    Database db = dbSystem.getDatabase();
    long now = System.currentTimeMillis();
    List<Ping> pings = db.query(PingQueries.fetchPingDataOfServer(now - TimeUnit.DAYS.toMillis(180L), now, serverUUID));
    // TODO Optimize in query
    PingGraph pingGraph = graphs.line().pingGraph(new PingMutator(pings).mutateToByMinutePings().all());
    return "{\"min_ping_series\":" + pingGraph.getMinGraph().toHighChartsSeries() + ",\"avg_ping_series\":" + pingGraph.getAvgGraph().toHighChartsSeries() + ",\"max_ping_series\":" + pingGraph.getMaxGraph().toHighChartsSeries() + ",\"colors\":{" + "\"min\":\"" + theme.getValue(ThemeVal.GRAPH_MIN_PING) + "\"," + "\"avg\":\"" + theme.getValue(ThemeVal.GRAPH_AVG_PING) + "\"," + "\"max\":\"" + theme.getValue(ThemeVal.GRAPH_MAX_PING) + "\"" + "}}";
}
Also used : PingGraph(com.djrapitops.plan.delivery.rendering.json.graphs.line.PingGraph) Ping(com.djrapitops.plan.gathering.domain.Ping) Database(com.djrapitops.plan.storage.database.Database) PingMutator(com.djrapitops.plan.delivery.domain.mutators.PingMutator)

Aggregations

PingMutator (com.djrapitops.plan.delivery.domain.mutators.PingMutator)1 PingGraph (com.djrapitops.plan.delivery.rendering.json.graphs.line.PingGraph)1 Ping (com.djrapitops.plan.gathering.domain.Ping)1 Database (com.djrapitops.plan.storage.database.Database)1