Search in sources :

Example 1 with StackGraph

use of com.djrapitops.plan.delivery.rendering.json.graphs.stack.StackGraph in project Plan by plan-player-analytics.

the class GraphJSONCreator method createActivityGraphJSON.

public Map<String, Object> createActivityGraphJSON(DateMap<Map<String, Integer>> activityData) {
    Map.Entry<Long, Map<String, Integer>> lastActivityEntry = activityData.lastEntry();
    Pie activityPie = graphs.pie().activityPie(lastActivityEntry != null ? lastActivityEntry.getValue() : Collections.emptyMap());
    StackGraph activityStackGraph = graphs.stack().activityStackGraph(activityData);
    return Maps.builder(String.class, Object.class).put("activity_series", activityStackGraph.getDataSets()).put("activity_labels", activityStackGraph.getLabels()).put("activity_pie_series", activityPie.getSlices()).build();
}
Also used : StackGraph(com.djrapitops.plan.delivery.rendering.json.graphs.stack.StackGraph) Map(java.util.Map) NavigableMap(java.util.NavigableMap) WorldMap(com.djrapitops.plan.delivery.rendering.json.graphs.special.WorldMap) DateMap(com.djrapitops.plan.delivery.domain.DateMap) Pie(com.djrapitops.plan.delivery.rendering.json.graphs.pie.Pie) WorldPie(com.djrapitops.plan.delivery.rendering.json.graphs.pie.WorldPie)

Aggregations

DateMap (com.djrapitops.plan.delivery.domain.DateMap)1 Pie (com.djrapitops.plan.delivery.rendering.json.graphs.pie.Pie)1 WorldPie (com.djrapitops.plan.delivery.rendering.json.graphs.pie.WorldPie)1 WorldMap (com.djrapitops.plan.delivery.rendering.json.graphs.special.WorldMap)1 StackGraph (com.djrapitops.plan.delivery.rendering.json.graphs.stack.StackGraph)1 Map (java.util.Map)1 NavigableMap (java.util.NavigableMap)1