mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-15 05:41:51 +08:00
Added option for displaying gaps in graph data #534
This commit is contained in:
parent
a9e7260c92
commit
e44fc781e4
@ -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"),
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -74,6 +74,7 @@ Customization:
|
||||
MaxPlayersPlayersPage: 25000
|
||||
PlayerTableFooter: true
|
||||
PlayerIPs: true
|
||||
GapsInGraphData: false
|
||||
Formatting:
|
||||
DecimalPoints: '#.##'
|
||||
Dates:
|
||||
|
@ -88,6 +88,7 @@ Customization:
|
||||
MaxPlayersPlayersPage: 25000
|
||||
PlayerTableFooter: true
|
||||
PlayerIPs: true
|
||||
GapsInGraphData: false
|
||||
Formatting:
|
||||
DecimalPoints: '#.##'
|
||||
# Dates settings use Java SimpleDateFormat.
|
||||
|
@ -23,6 +23,10 @@ function playersChart(id, playersOnlineSeries, sel) {
|
||||
text: 'All'
|
||||
}]
|
||||
},
|
||||
yAxis: {
|
||||
softMax: 2,
|
||||
softMin: 0
|
||||
},
|
||||
title: {text: ''},
|
||||
plotOptions: {
|
||||
areaspline: {
|
||||
|
@ -26,6 +26,10 @@ function playersChartNoNav(id, playersOnlineSeries) {
|
||||
navigator: {
|
||||
enabled: false
|
||||
},
|
||||
yAxis: {
|
||||
softMax: 2,
|
||||
softMin: 0
|
||||
},
|
||||
title: {text: ''},
|
||||
plotOptions: {
|
||||
areaspline: {
|
||||
|
Loading…
Reference in New Issue
Block a user