diff --git a/Plan/src/main/java/com/djrapitops/plan/system/settings/Settings.java b/Plan/src/main/java/com/djrapitops/plan/system/settings/Settings.java index fc2a5c33f..537619e87 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/settings/Settings.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/settings/Settings.java @@ -35,6 +35,7 @@ public enum Settings { WEBSERVER_DISABLED("WebServer.DisableWebServer"), FORMAT_DATE_RECENT_DAYS("Customization.Formatting.Dates.RecentDays"), DISPLAY_PLAYER_IPS("Customization.Display.PlayerIPs"), + DISPLAY_GAPS_IN_GRAPH_DATA("Customization.Display.GapsInGraphData"), // Integer WEBSERVER_PORT("WebServer.Port"), diff --git a/Plan/src/main/java/com/djrapitops/plan/system/settings/network/NetworkSettings.java b/Plan/src/main/java/com/djrapitops/plan/system/settings/network/NetworkSettings.java index 659dc88c3..6ca0411b7 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/settings/network/NetworkSettings.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/settings/network/NetworkSettings.java @@ -147,7 +147,7 @@ public class NetworkSettings { Settings.MAX_PLAYERS_PLAYERS_PAGE, Settings.PLAYERTABLE_FOOTER, Settings.FORMAT_DATE_RECENT_DAYS, Settings.FORMAT_DATE_RECENT_DAYS_PATTERN, Settings.FORMAT_DATE_CLOCK, Settings.FORMAT_DATE_NO_SECONDS, Settings.FORMAT_DATE_FULL, Settings.DISPLAY_PLAYER_IPS, Settings.ACTIVE_LOGIN_THRESHOLD, - Settings.ACTIVE_PLAY_THRESHOLD + Settings.ACTIVE_PLAY_THRESHOLD, Settings.DISPLAY_GAPS_IN_GRAPH_DATA }; Log.debug("NetworkSettings: Adding Config Values.."); for (Settings setting : sameStrings) { diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/html/graphs/line/AbstractLineGraph.java b/Plan/src/main/java/com/djrapitops/plan/utilities/html/graphs/line/AbstractLineGraph.java index b67ed05a8..94cbbf593 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/html/graphs/line/AbstractLineGraph.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/html/graphs/line/AbstractLineGraph.java @@ -5,9 +5,11 @@ */ package com.djrapitops.plan.utilities.html.graphs.line; +import com.djrapitops.plan.system.settings.Settings; import com.djrapitops.plan.utilities.html.graphs.HighChart; import com.djrapitops.plan.utilities.html.graphs.line.alg.DouglasPeuckerAlgorithm; import com.djrapitops.plan.utilities.html.graphs.line.alg.ReduceGapTriangles; +import com.djrapitops.plugin.api.TimeAmount; import java.util.ArrayList; import java.util.Collection; @@ -45,10 +47,16 @@ public class AbstractLineGraph implements HighChart { } int size = points.size(); + Long lastX = null; + boolean addMissingPoints = Settings.DISPLAY_GAPS_IN_GRAPH_DATA.isTrue(); for (int i = 0; i < size; i++) { Point point = points.get(i); Double y = point.getY(); long date = (long) point.getX(); + if (addMissingPoints && lastX != null && date - lastX > TimeAmount.MINUTE.ms() * 3L) { + addMissingPoints(arrayBuilder, lastX, date); + } + lastX = date; arrayBuilder.append("[").append(date).append(",").append(y).append("]"); if (i < size - 1) { arrayBuilder.append(","); @@ -59,6 +67,14 @@ public class AbstractLineGraph implements HighChart { return arrayBuilder.toString(); } + private void addMissingPoints(StringBuilder arrayBuilder, Long lastX, long date) { + long iterate = lastX + TimeAmount.MINUTE.ms(); + while (iterate < date) { + arrayBuilder.append("[").append(iterate).append(",null],"); + iterate += TimeAmount.MINUTE.ms() * 30L; + } + } + public void reduceGapTriangles() { this.reduceGapTriangles = true; } diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/html/graphs/line/Point.java b/Plan/src/main/java/com/djrapitops/plan/utilities/html/graphs/line/Point.java index 29e44b5ac..4e8ae4191 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/html/graphs/line/Point.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/html/graphs/line/Point.java @@ -15,6 +15,10 @@ public class Point { this.y = y; } + public Point(double x, double y) { + this(x, (Double) y); + } + public double getX() { return x; } diff --git a/Plan/src/main/resources/bungeeconfig.yml b/Plan/src/main/resources/bungeeconfig.yml index 6876d7ec7..f720bb9d4 100644 --- a/Plan/src/main/resources/bungeeconfig.yml +++ b/Plan/src/main/resources/bungeeconfig.yml @@ -74,6 +74,7 @@ Customization: MaxPlayersPlayersPage: 25000 PlayerTableFooter: true PlayerIPs: true + GapsInGraphData: false Formatting: DecimalPoints: '#.##' Dates: diff --git a/Plan/src/main/resources/config.yml b/Plan/src/main/resources/config.yml index 2416111bd..89f0421e5 100644 --- a/Plan/src/main/resources/config.yml +++ b/Plan/src/main/resources/config.yml @@ -88,6 +88,7 @@ Customization: MaxPlayersPlayersPage: 25000 PlayerTableFooter: true PlayerIPs: true + GapsInGraphData: false Formatting: DecimalPoints: '#.##' # Dates settings use Java SimpleDateFormat. diff --git a/Plan/src/main/resources/web/js/charts/playerGraph.js b/Plan/src/main/resources/web/js/charts/playerGraph.js index 69cd1071f..13fff8f91 100644 --- a/Plan/src/main/resources/web/js/charts/playerGraph.js +++ b/Plan/src/main/resources/web/js/charts/playerGraph.js @@ -23,6 +23,10 @@ function playersChart(id, playersOnlineSeries, sel) { text: 'All' }] }, + yAxis: { + softMax: 2, + softMin: 0 + }, title: {text: ''}, plotOptions: { areaspline: { diff --git a/Plan/src/main/resources/web/js/charts/playerGraphNoNav.js b/Plan/src/main/resources/web/js/charts/playerGraphNoNav.js index cb1914b3a..2b08045d5 100644 --- a/Plan/src/main/resources/web/js/charts/playerGraphNoNav.js +++ b/Plan/src/main/resources/web/js/charts/playerGraphNoNav.js @@ -26,6 +26,10 @@ function playersChartNoNav(id, playersOnlineSeries) { navigator: { enabled: false }, + yAxis: { + softMax: 2, + softMin: 0 + }, title: {text: ''}, plotOptions: { areaspline: {