Commit 7a153a78 authored by s7_spruge_k's avatar s7_spruge_k
Browse files

graphs done

parent b5d311f0
......@@ -247,11 +247,38 @@ public class GraphController {
}
else if(statHelper.getStatMethod().equals("Analysis by day"))
{
ArrayList<Integer> eventCountThisMonth = new ArrayList<>();
LocalDate now = LocalDate.now();
for (int i = 1; i <= now.lengthOfMonth(); i++) {
int temp = 0;
for (Event e : allEventsInCal) {
if(e.getStartDate().getDayOfMonth() == i && now.getYear() == e.getStartDate().getYear())
{
temp++;
}
}
eventCountThisMonth.add(temp);
}
JsonArray eventArray = new JsonArray();
for (int i = 0; i < eventCountThisMonth.size(); i++) {
JsonObject eventJson = new JsonObject();
eventJson.addProperty("name", i+1);
eventJson.addProperty("eventCount", eventCountThisMonth.get(i));
eventArray.add(eventJson);
}
String title = "Event count this month by days: " + statHelper.getChosenCalendar();
models.addAttribute("name", title);
models.addAttribute("allEvents", eventArray);
}
models.addAttribute("graphType", statHelper.getGraphMethod());
//models.addAttribute("statHelper", statHelper);
return "statsTest";
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment