renamed GraphCreators

This commit is contained in:
Rsl1122 2017-12-07 18:51:19 +02:00
parent a469a09943
commit e1fa610ad2
21 changed files with 112 additions and 117 deletions

View File

@ -18,12 +18,12 @@ import main.java.com.djrapitops.plan.utilities.analysis.MathUtils;
import main.java.com.djrapitops.plan.utilities.comparators.SessionStartComparator;
import main.java.com.djrapitops.plan.utilities.html.Html;
import main.java.com.djrapitops.plan.utilities.html.HtmlUtils;
import main.java.com.djrapitops.plan.utilities.html.graphs.ActivityStackGraphCreator;
import main.java.com.djrapitops.plan.utilities.html.graphs.PunchCardGraphCreator;
import main.java.com.djrapitops.plan.utilities.html.graphs.WorldMapCreator;
import main.java.com.djrapitops.plan.utilities.html.graphs.ActivityStackGraph;
import main.java.com.djrapitops.plan.utilities.html.graphs.PunchCardGraph;
import main.java.com.djrapitops.plan.utilities.html.graphs.WorldMap;
import main.java.com.djrapitops.plan.utilities.html.graphs.line.*;
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.ActivityPieCreator;
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.WorldPieCreator;
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.ActivityPie;
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.WorldPie;
import main.java.com.djrapitops.plan.utilities.html.structure.AnalysisPluginsTabContentCreator;
import main.java.com.djrapitops.plan.utilities.html.structure.SessionTabStructureCreator;
import main.java.com.djrapitops.plan.utilities.html.tables.CommandUseTableCreator;
@ -143,8 +143,8 @@ public class AnalysisData extends RawData {
Map<String, Set<UUID>> activityNow = activityData.getOrDefault(now, new HashMap<>());
String[] activityStackSeries = ActivityStackGraphCreator.createSeries(activityData);
String activityPieSeries = ActivityPieCreator.createSeriesData(activityNow);
String[] activityStackSeries = ActivityStackGraph.createSeries(activityData);
String activityPieSeries = ActivityPie.createSeries(activityNow);
addValue("activityStackCategories", activityStackSeries[0]);
addValue("activityStackSeries", activityStackSeries[1]);
@ -170,7 +170,7 @@ public class AnalysisData extends RawData {
}
private void geolocationsTab(List<String> geoLocations) {
addValue("geoMapSeries", WorldMapCreator.createDataSeries(geoLocations));
addValue("geoMapSeries", WorldMap.createSeries(geoLocations));
}
private void onlineActivityNumbers(ServerProfile profile, Map<UUID, List<Session>> sessions, List<PlayerProfile> players) {
@ -285,7 +285,7 @@ public class AnalysisData extends RawData {
addValue("tableBodySessions", tables[0]);
addValue("listRecentLogins", tables[1]);
addValue("sessionAverage", FormatUtils.formatTimeAmount(MathUtils.averageLong(allSessions.stream().map(Session::getLength))));
addValue("punchCardSeries", PunchCardGraphCreator.createDataSeries(sessionsMonth));
addValue("punchCardSeries", PunchCardGraph.createSeries(sessionsMonth));
addValue("deaths", ServerProfile.getDeathCount(allSessions));
addValue("mobKillCount", ServerProfile.getMobKillCount(allSessions));
@ -302,7 +302,7 @@ public class AnalysisData extends RawData {
Html.TABLE_PLAYERS_FOOTER.parse(playersTableBody)
: Html.TABLE_PLAYERS.parse(playersTableBody));
addValue("worldTotal", FormatUtils.formatTimeAmount(worldTimes.getTotal()));
String[] seriesData = WorldPieCreator.createSeriesData(worldTimes);
String[] seriesData = WorldPie.createSeries(worldTimes);
addValue("worldSeries", seriesData[0]);
addValue("gmSeries", seriesData[1]);
addValue("lastPeakTime", lastPeak != -1 ? FormatUtils.formatTimeStampYear(lastPeak) : "No Data");
@ -319,12 +319,12 @@ public class AnalysisData extends RawData {
addValue("tpsSpikeWeek", value("tpsSpikeWeek"));
addValue("tpsSpikeDay", value("tpsSpikeDay"));
addValue("playersOnlineSeries", PlayerActivityGraphCreator.buildSeriesDataString(tpsData));
addValue("tpsSeries", TPSGraphCreator.buildSeriesDataString(tpsData));
addValue("cpuSeries", CPUGraphCreator.buildSeriesDataString(tpsData));
addValue("ramSeries", RamGraphCreator.buildSeriesDataString(tpsData));
addValue("entitySeries", WorldLoadGraphCreator.buildSeriesDataStringEntities(tpsData));
addValue("chunkSeries", WorldLoadGraphCreator.buildSeriesDataStringChunks(tpsData));
addValue("playersOnlineSeries", PlayerActivityGraph.createSeries(tpsData));
addValue("tpsSeries", TPSGraph.createSeries(tpsData));
addValue("cpuSeries", CPUGraph.createSeries(tpsData));
addValue("ramSeries", RamGraph.createSeries(tpsData));
addValue("entitySeries", WorldLoadGraph.createSeriesEntities(tpsData));
addValue("chunkSeries", WorldLoadGraph.createSeriesChunks(tpsData));
double averageCPUMonth = MathUtils.averageDouble(tpsDataMonth.stream().map(TPS::getCPUUsage).filter(i -> i != 0));
double averageCPUWeek = MathUtils.averageDouble(tpsDataWeek.stream().map(TPS::getCPUUsage).filter(i -> i != 0));

View File

@ -26,9 +26,9 @@ import main.java.com.djrapitops.plan.utilities.comparators.SessionStartComparato
import main.java.com.djrapitops.plan.utilities.file.FileUtil;
import main.java.com.djrapitops.plan.utilities.html.HtmlStructure;
import main.java.com.djrapitops.plan.utilities.html.HtmlUtils;
import main.java.com.djrapitops.plan.utilities.html.graphs.PunchCardGraphCreator;
import main.java.com.djrapitops.plan.utilities.html.graphs.line.ServerPreferencePieCreator;
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.WorldPieCreator;
import main.java.com.djrapitops.plan.utilities.html.graphs.PunchCardGraph;
import main.java.com.djrapitops.plan.utilities.html.graphs.line.ServerPreferencePie;
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.WorldPie;
import main.java.com.djrapitops.plan.utilities.html.structure.ServerAccordionCreator;
import main.java.com.djrapitops.plan.utilities.html.tables.ActionsTableCreator;
import main.java.com.djrapitops.plan.utilities.html.tables.IpTableCreator;
@ -108,7 +108,7 @@ public class InspectPageParser extends PageParser {
}
Map<UUID, WorldTimes> worldTimesPerServer = profile.getWorldTimesPerServer();
addValue("serverPieSeries", ServerPreferencePieCreator.createSeriesData(serverNames, worldTimesPerServer));
addValue("serverPieSeries", ServerPreferencePie.createSeries(serverNames, worldTimesPerServer));
addValue("worldPieColors", Theme.getValue(ThemeVal.GRAPH_WORLD_PIE));
addValue("gmPieColors", Theme.getValue(ThemeVal.GRAPH_GM_PIE));
addValue("serverPieColors", Theme.getValue(ThemeVal.GRAPH_SERVER_PREF_PIE));
@ -195,11 +195,11 @@ public class InspectPageParser extends PageParser {
List<Action> actions = profile.getAllActions();
addValue("tableBodyActions", ActionsTableCreator.createTable(actions));
String punchCardData = PunchCardGraphCreator.createDataSeries(allSessions);
String punchCardData = PunchCardGraph.createSeries(allSessions);
WorldTimes worldTimes = profile.getWorldTimes();
AnalysisUtils.addMissingWorlds(worldTimes);
String[] worldPieData = WorldPieCreator.createSeriesData(worldTimes);
String[] worldPieData = WorldPie.createSeries(worldTimes);
addValue("worldPieSeries", worldPieData[0]);
addValue("gmSeries", worldPieData[1]);

View File

@ -20,7 +20,7 @@ import main.java.com.djrapitops.plan.utilities.analysis.AnalysisUtils;
import main.java.com.djrapitops.plan.utilities.file.FileUtil;
import main.java.com.djrapitops.plan.utilities.html.HtmlStructure;
import main.java.com.djrapitops.plan.utilities.html.HtmlUtils;
import main.java.com.djrapitops.plan.utilities.html.graphs.line.PlayerActivityGraphCreator;
import main.java.com.djrapitops.plan.utilities.html.graphs.line.PlayerActivityGraph;
import java.sql.SQLException;
import java.util.List;
@ -56,7 +56,7 @@ public class NetworkPageParser extends PageParser {
addValue("timeZone", MiscUtils.getTimeZoneOffsetHours());
addValue("networkName", Settings.BUNGEE_NETWORK_NAME.toString());
addValue("version", plugin.getVersion());
addValue("playersOnlineSeries", PlayerActivityGraphCreator.buildSeriesDataString(networkOnlineData));
addValue("playersOnlineSeries", PlayerActivityGraph.createSeries(networkOnlineData));
addValue("playersGraphColor", Theme.getValue(ThemeVal.GRAPH_PLAYERS_ONLINE));
addValue("playersOnline", plugin.getProxy().getOnlineCount());

View File

@ -13,7 +13,7 @@ import main.java.com.djrapitops.plan.database.Database;
import main.java.com.djrapitops.plan.settings.Settings;
import main.java.com.djrapitops.plan.systems.info.BukkitInformationManager;
import main.java.com.djrapitops.plan.utilities.FormatUtils;
import main.java.com.djrapitops.plan.utilities.html.graphs.line.PlayerActivityGraphCreator;
import main.java.com.djrapitops.plan.utilities.html.graphs.line.PlayerActivityGraph;
import main.java.com.djrapitops.plan.utilities.html.structure.SessionTabStructureCreator;
import main.java.com.djrapitops.plan.utilities.html.tables.SessionsTableCreator;
@ -125,7 +125,7 @@ public class HtmlStructure {
int playerCount = db.getUserInfoTable().getServerUserCount(serverUUID);
String playerData = "[]";
try {
playerData = PlayerActivityGraphCreator.buildSeriesDataString(db.getTpsTable().getTPSData(serverUUID));
playerData = PlayerActivityGraph.createSeries(db.getTpsTable().getTPSData(serverUUID));
} catch (SQLException e) {
Log.toLog(HtmlStructure.class.getClass().getName(), e);
}

View File

@ -7,7 +7,7 @@ package main.java.com.djrapitops.plan.utilities.html.graphs;
import main.java.com.djrapitops.plan.settings.theme.ThemeVal;
import main.java.com.djrapitops.plan.settings.theme.Theme;
import main.java.com.djrapitops.plan.utilities.FormatUtils;
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.ActivityPieCreator;
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.ActivityPie;
import java.util.Map;
import java.util.Set;
@ -19,14 +19,14 @@ import java.util.UUID;
*
* @author Rsl1122
*/
public class ActivityStackGraphCreator {
public class ActivityStackGraph {
private ActivityStackGraphCreator() {
private ActivityStackGraph() {
throw new IllegalStateException("Utility Class");
}
public static String[] createSeries(TreeMap<Long, Map<String, Set<UUID>>> activityData) {
String[] sliceNames = ActivityPieCreator.getSliceNames();
String[] sliceNames = ActivityPie.getSliceNames();
String[] colors = Theme.getValue(ThemeVal.GRAPH_ACTIVITY_PIE).split(", ");
int maxCol = colors.length;

View File

@ -19,12 +19,12 @@ import java.util.stream.Collectors;
* @author Rsl1122
* @since 3.6.0
*/
public class PunchCardGraphCreator {
public class PunchCardGraph {
/**
* Constructor used to hide the public constructor
*/
private PunchCardGraphCreator() {
private PunchCardGraph() {
throw new IllegalStateException("Utility class");
}
@ -34,10 +34,10 @@ public class PunchCardGraphCreator {
* @param sessions Sessions (Unique/Player) to be placed into the PunchCard.
* @return Data array as a string.
*/
public static String createDataSeries(Collection<Session> sessions) {
public static String createSeries(Collection<Session> sessions) {
List<Long> sessionStarts = getSessionStarts(sessions);
List<int[]> daysAndHours = AnalysisUtils.getDaysAndHours(sessionStarts);
int[][] dataArray = createDataArray(daysAndHours);
int[][] dataArray = turnIntoArray(daysAndHours);
int big = findBiggestValue(dataArray);
int[][] scaled = scale(dataArray, big);
StringBuilder arrayBuilder = new StringBuilder("[");
@ -62,7 +62,7 @@ public class PunchCardGraphCreator {
return arrayBuilder.toString();
}
private static int[][] createDataArray(List<int[]> daysAndHours) {
private static int[][] turnIntoArray(List<int[]> daysAndHours) {
int[][] dataArray = createEmptyArray();
for (int[] dAndH : daysAndHours) {
int d = dAndH[0];

View File

@ -4,12 +4,12 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class WorldMapCreator {
public class WorldMap {
/**
* Constructor used to hide the public constructor
*/
private WorldMapCreator() {
private WorldMap() {
throw new IllegalStateException("Utility class");
}
@ -19,7 +19,7 @@ public class WorldMapCreator {
* @param geoLocations The country names of players
* @return The created data series
*/
public static String createDataSeries(List<String> geoLocations) {
public static String createSeries(List<String> geoLocations) {
Map<String, Integer> geoCodeCounts = new HashMap<>();
Map<String, String> geoCodes = getGeoCodes(geoCodeCounts);

View File

@ -6,19 +6,19 @@ import main.java.com.djrapitops.plan.utilities.analysis.Point;
import java.util.List;
import java.util.stream.Collectors;
public class CPUGraphCreator {
public class CPUGraph {
/**
* Constructor used to hide the public constructor
*/
private CPUGraphCreator() {
private CPUGraph() {
throw new IllegalStateException("Utility class");
}
public static String buildSeriesDataString(List<TPS> tpsData) {
public static String createSeries(List<TPS> tpsData) {
List<Point> points = tpsData.stream()
.map(tps -> new Point(tps.getDate(), tps.getCPUUsage()))
.collect(Collectors.toList());
return SeriesCreator.seriesGraph(points, true);
return LineSeries.createSeries(points, true);
}
}

View File

@ -5,7 +5,9 @@
*/
package main.java.com.djrapitops.plan.utilities.html.graphs.line;
import main.java.com.djrapitops.plan.utilities.analysis.DouglasPeuckerAlgorithm;
import main.java.com.djrapitops.plan.utilities.analysis.Point;
import main.java.com.djrapitops.plan.utilities.analysis.ReduceGapTriangles;
import java.util.List;
@ -15,26 +17,26 @@ import java.util.List;
* @author Rsl1122
* @since 3.5.2
*/
public class SeriesCreator {
public class LineSeries {
/**
* Constructor used to hide the public constructor
*/
private SeriesCreator() {
private LineSeries() {
throw new IllegalStateException("Utility class");
}
public static String seriesGraph(List<Point> points, boolean reduceGapTriangles) {
return seriesGraph(points, reduceGapTriangles, true);
public static String createSeries(List<Point> points, boolean reduceGapTriangles) {
return createSeries(points, reduceGapTriangles, true);
}
public static String seriesGraph(List<Point> points, boolean reduceGapTriangles, boolean reducePoints) {
public static String createSeries(List<Point> points, boolean reduceGapTriangles, boolean reducePoints) {
StringBuilder arrayBuilder = new StringBuilder("[");
// if (reducePoints) {
// points = DouglasPeuckerAlgorithm.reducePoints(points, 0);
// }
//
// if (reduceGapTriangles) {
// points = ReduceGapTriangles.reduce(points);
// }

View File

@ -9,19 +9,19 @@ import java.util.stream.Collectors;
/**
* @author Rsl1122
*/
public class PlayerActivityGraphCreator {
public class PlayerActivityGraph {
/**
* Constructor used to hide the public constructor
*/
private PlayerActivityGraphCreator() {
private PlayerActivityGraph() {
throw new IllegalStateException("Utility class");
}
public static String buildSeriesDataString(List<TPS> tpsData) {
public static String createSeries(List<TPS> tpsData) {
List<Point> points = tpsData.stream()
.map(tps -> new Point(tps.getDate(), tps.getPlayers()))
.collect(Collectors.toList());
return SeriesCreator.seriesGraph(points, true);
return LineSeries.createSeries(points, true);
}
}

View File

@ -14,12 +14,12 @@ import java.util.stream.Collectors;
* @see TPSCountTimer
* @since 3.6.0
*/
public class RamGraphCreator {
public class RamGraph {
/**
* Constructor used to hide the public constructor
*/
private RamGraphCreator() {
private RamGraph() {
throw new IllegalStateException("Utility class");
}
@ -29,10 +29,10 @@ public class RamGraphCreator {
* @param tpsData TPS Data collected by TPSCountTimer, one data point for each minute.
* @return Series data for HighCharts
*/
public static String buildSeriesDataString(List<TPS> tpsData) {
public static String createSeries(List<TPS> tpsData) {
List<Point> points = tpsData.stream()
.map(tps -> new Point(tps.getDate(), tps.getUsedMemory()))
.collect(Collectors.toList());
return SeriesCreator.seriesGraph(points, true);
return LineSeries.createSeries(points, true);
}
}

View File

@ -5,13 +5,13 @@ import main.java.com.djrapitops.plan.data.time.WorldTimes;
import java.util.Map;
import java.util.UUID;
public class ServerPreferencePieCreator {
public class ServerPreferencePie {
private ServerPreferencePieCreator() {
private ServerPreferencePie() {
throw new IllegalStateException("Utility Class");
}
public static String createSeriesData(Map<UUID, String> serverNames, Map<UUID, WorldTimes> serverWorldTimes) {
public static String createSeries(Map<UUID, String> serverNames, Map<UUID, WorldTimes> serverWorldTimes) {
StringBuilder seriesBuilder = new StringBuilder("[");
int i = 0;
int size = serverWorldTimes.size();

View File

@ -11,27 +11,20 @@ import java.util.stream.Collectors;
* @author Rsl1122
* @since 3.5.0
*/
public class TPSGraphCreator {
public class TPSGraph {
/**
* Constructor used to hide the public constructor
*/
private TPSGraphCreator() {
private TPSGraph() {
throw new IllegalStateException("Utility class");
}
public static String buildSeriesDataString(List<TPS> tpsData) {
public static String createSeries(List<TPS> tpsData) {
List<Point> points = tpsData.stream()
.map(tps -> new Point(tps.getDate(), tps.getTicksPerSecond()))
.collect(Collectors.toList());
return SeriesCreator.seriesGraph(points, true);
return LineSeries.createSeries(points, true);
}
public static List<TPS> filterTPS(List<TPS> tpsData, long nowMinusScale) {
return tpsData.stream()
.filter(Objects::nonNull)
.filter(t -> t.getDate() >= nowMinusScale)
.collect(Collectors.toList());
}
}

View File

@ -14,12 +14,12 @@ import java.util.stream.Collectors;
* @see TPSCountTimer
* @since 3.6.0
*/
public class WorldLoadGraphCreator {
public class WorldLoadGraph {
/**
* Constructor used to hide the public constructor
*/
private WorldLoadGraphCreator() {
private WorldLoadGraph() {
throw new IllegalStateException("Utility class");
}
@ -29,11 +29,11 @@ public class WorldLoadGraphCreator {
* @param tpsData TPS Data collected by TPSCountTimer, one data point for each minute.
* @return Series data for HighCharts
*/
public static String buildSeriesDataStringEntities(List<TPS> tpsData) {
public static String createSeriesEntities(List<TPS> tpsData) {
List<Point> points = tpsData.stream()
.map(tps -> new Point(tps.getDate(), tps.getEntityCount()))
.collect(Collectors.toList());
return SeriesCreator.seriesGraph(points, true);
return LineSeries.createSeries(points, true);
}
/**
@ -42,10 +42,10 @@ public class WorldLoadGraphCreator {
* @param tpsData TPS Data collected by TPSCountTimer, one data point for each minute.
* @return Series data for HighCharts
*/
public static String buildSeriesDataStringChunks(List<TPS> tpsData) {
public static String createSeriesChunks(List<TPS> tpsData) {
List<Point> points = tpsData.stream()
.map(tps -> new Point(tps.getDate(), tps.getChunksLoaded()))
.collect(Collectors.toList());
return SeriesCreator.seriesGraph(points, true);
return LineSeries.createSeries(points, true);
}
}

View File

@ -14,9 +14,9 @@ import java.util.*;
*
* @author Rsl1122
*/
public class ActivityPieCreator {
public class ActivityPie {
private ActivityPieCreator() {
private ActivityPie() {
throw new IllegalStateException("Utility Class");
}
@ -24,7 +24,7 @@ public class ActivityPieCreator {
return new String[]{"Very Active", "Active", "Regular", "Irregular", "Inactive"};
}
public static String createSeriesData(Map<String, Set<UUID>> activityData) {
public static String createSeries(Map<String, Set<UUID>> activityData) {
String[] colors = Theme.getValue(ThemeVal.GRAPH_ACTIVITY_PIE).split(", ");
int maxCol = colors.length;
@ -38,6 +38,6 @@ public class ActivityPieCreator {
i++;
}
return PieSeriesCreator.createSeriesData(slices);
return PieSeries.createSeries(slices);
}
}

View File

@ -11,12 +11,12 @@ import java.util.List;
*
* @author Rsl1122
*/
public class PieSeriesCreator {
private PieSeriesCreator() {
public class PieSeries {
private PieSeries() {
throw new IllegalStateException("Utility Class");
}
public static String createSeriesData(List<PieSlice> slices) {
public static String createSeries(List<PieSlice> slices) {
StringBuilder seriesBuilder = new StringBuilder("[");
int i = 0;
int size = slices.size();

View File

@ -12,9 +12,9 @@ import main.java.com.djrapitops.plan.utilities.comparators.PieSliceComparator;
import java.util.*;
import java.util.stream.Collectors;
public class WorldPieCreator {
public class WorldPie {
private WorldPieCreator() {
private WorldPie() {
throw new IllegalStateException("Utility Class");
}
@ -24,21 +24,21 @@ public class WorldPieCreator {
* @param worldTimes WorldTimes object.
* @return String array, index 0: Series data, 1: drilldown data
*/
public static String[] createSeriesData(WorldTimes worldTimes) {
List<PieSlice> slices = turnToSlices(worldTimes);
public static String[] createSeries(WorldTimes worldTimes) {
List<PieSlice> slices = turnIntoSlices(worldTimes);
if (Settings.ORDER_WORLD_PIE_BY_PERC.isTrue()) {
slices.sort(new PieSliceComparator());
}
String seriesData = PieSeriesCreator.createSeriesData(slices);
String seriesData = PieSeries.createSeries(slices);
String drilldownData = createDrilldownData(worldTimes);
String drilldownData = createDrilldown(worldTimes);
return new String[]{seriesData, drilldownData};
}
private static List<PieSlice> turnToSlices(WorldTimes worldTimes) {
private static List<PieSlice> turnIntoSlices(WorldTimes worldTimes) {
String[] colors = Theme.getValue(ThemeVal.GRAPH_WORLD_PIE).split(", ");
int colLenght = colors.length;
@ -90,7 +90,7 @@ public class WorldPieCreator {
return playtimePerAlias;
}
private static String createDrilldownData(WorldTimes worldTimes) {
private static String createDrilldown(WorldTimes worldTimes) {
StringBuilder drilldownBuilder = new StringBuilder();
int i = 0;

View File

@ -13,7 +13,7 @@ import main.java.com.djrapitops.plan.settings.theme.ThemeVal;
import main.java.com.djrapitops.plan.utilities.FormatUtils;
import main.java.com.djrapitops.plan.utilities.analysis.AnalysisUtils;
import main.java.com.djrapitops.plan.utilities.analysis.MathUtils;
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.WorldPieCreator;
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.WorldPie;
import java.util.List;
import java.util.Map;
@ -66,7 +66,7 @@ public class ServerAccordionCreator {
String worldId = "worldPieServer" + sanitizedServerName;
AnalysisUtils.addMissingWorlds(worldTimes);
String[] worldData = WorldPieCreator.createSeriesData(worldTimes);
String[] worldData = WorldPie.createSeries(worldTimes);
// Accordion panel header
html.append("<div class=\"panel panel-col-").append(Theme.getValue(ThemeVal.PARSED_SERVER_ACCORDION)).append("\">")

View File

@ -15,7 +15,7 @@ import main.java.com.djrapitops.plan.utilities.FormatUtils;
import main.java.com.djrapitops.plan.utilities.analysis.AnalysisUtils;
import main.java.com.djrapitops.plan.utilities.html.Html;
import main.java.com.djrapitops.plan.utilities.html.HtmlStructure;
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.WorldPieCreator;
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.WorldPie;
import main.java.com.djrapitops.plan.utilities.html.tables.KillsTableCreator;
import main.java.com.djrapitops.plan.utilities.html.tables.SessionsTableCreator;
@ -86,7 +86,7 @@ public class SessionTabStructureCreator {
WorldTimes worldTimes = session.getWorldTimes();
AnalysisUtils.addMissingWorlds(worldTimes);
String[] worldData = WorldPieCreator.createSeriesData(worldTimes);
String[] worldData = WorldPie.createSeries(worldTimes);
String killTable = KillsTableCreator.createTable(session.getPlayerKills());

View File

@ -14,7 +14,7 @@ import main.java.com.djrapitops.plan.systems.cache.SessionCache;
import main.java.com.djrapitops.plan.utilities.FormatUtils;
import main.java.com.djrapitops.plan.utilities.comparators.SessionStartComparator;
import main.java.com.djrapitops.plan.utilities.html.Html;
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.WorldPieCreator;
import main.java.com.djrapitops.plan.utilities.html.graphs.pie.WorldPie;
import java.util.*;
import java.util.stream.Collectors;
@ -113,7 +113,7 @@ public class SessionsTableCreator {
Map<String, Long> playtimePerWorld = session.getWorldTimes().getWorldTimes().entrySet().stream()
.collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().getTotal()));
Map<String, Long> playtimePerAlias = WorldPieCreator.transformToAliases(playtimePerWorld, aliases);
Map<String, Long> playtimePerAlias = WorldPie.transformToAliases(playtimePerWorld, aliases);
WorldTimes worldTimes = session.getWorldTimes();
long total = worldTimes.getTotal();

View File

@ -8,7 +8,7 @@ import main.java.com.djrapitops.plan.data.container.Session;
import main.java.com.djrapitops.plan.data.container.TPS;
import main.java.com.djrapitops.plan.data.time.WorldTimes;
import main.java.com.djrapitops.plan.utilities.analysis.Point;
import main.java.com.djrapitops.plan.utilities.html.graphs.PunchCardGraphCreator;
import main.java.com.djrapitops.plan.utilities.html.graphs.PunchCardGraph;
import main.java.com.djrapitops.plan.utilities.html.graphs.line.*;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.plugin.java.JavaPlugin;
@ -54,34 +54,34 @@ public class GraphTest {
@Test
public void testGraphCreators() {
String expected = "[[0,0.0],[1,1.0],[2,2.0],[3,3.0],[4,4.0],[5,5.0],[6,6.0],[7,7.0],[8,8.0],[9,9.0]]";
assertEquals(expected, CPUGraphCreator.buildSeriesDataString(tpsList));
assertEquals(expected, PlayerActivityGraphCreator.buildSeriesDataString(tpsList));
assertEquals(expected, CPUGraph.createSeries(tpsList));
assertEquals(expected, PlayerActivityGraph.createSeries(tpsList));
// TODO Fix TimeZone Dependency of this test
// assertEquals("[{x:3600000, y:3, z:14, marker: { radius:14}},]", PunchCardGraphCreator.createDataSeries(sessionList));
// assertEquals("[{x:3600000, y:3, z:14, marker: { radius:14}},]", PunchCardGraph.createSeries(sessionList));
assertEquals(expected, RamGraphCreator.buildSeriesDataString(tpsList));
assertEquals(expected, TPSGraphCreator.buildSeriesDataString(tpsList));
assertEquals(expected, WorldLoadGraphCreator.buildSeriesDataStringChunks(tpsList));
assertEquals(expected, WorldLoadGraphCreator.buildSeriesDataStringEntities(tpsList));
// assertEquals("[{'code':'1','value':1},{'code':'2','value':2},{'code':'3','value':3},{'code':'4','value':4},{'code':'5','value':5},{'code':'6','value':6},{'code':'7','value':7},{'code':'8','value':8},{'code':'9','value':9}]", WorldMapCreator.createDataSeries(geoList));
assertEquals(expected, RamGraph.createSeries(tpsList));
assertEquals(expected, TPSGraph.createSeries(tpsList));
assertEquals(expected, WorldLoadGraph.createSeriesChunks(tpsList));
assertEquals(expected, WorldLoadGraph.createSeriesEntities(tpsList));
// assertEquals("[{'code':'1','value':1},{'code':'2','value':2},{'code':'3','value':3},{'code':'4','value':4},{'code':'5','value':5},{'code':'6','value':6},{'code':'7','value':7},{'code':'8','value':8},{'code':'9','value':9}]", WorldMap.createSeries(geoList));
// TODO fix config mock dependency
// assertEquals("[[{name:'WORLD',y:0,drilldown: 'WORLD'}], [{name:'WORLD', id:'WORLD',colors: gmPieColors,data: [['SURVIVAL',0],['SPECTATOR',0],['CREATIVE',0],['ADVENTURE',0]]}]]",
// Arrays.toString(WorldPieCreator.createSeriesData(worldTimes)));
// Arrays.toString(WorldPie.createSeries(worldTimes)));
}
@Test
public void testGraphCreatorsForBracketMistakes() {
String[] series = new String[]{
CPUGraphCreator.buildSeriesDataString(tpsList),
PlayerActivityGraphCreator.buildSeriesDataString(tpsList),
PunchCardGraphCreator.createDataSeries(sessionList),
RamGraphCreator.buildSeriesDataString(tpsList),
TPSGraphCreator.buildSeriesDataString(tpsList),
WorldLoadGraphCreator.buildSeriesDataStringChunks(tpsList),
WorldLoadGraphCreator.buildSeriesDataStringEntities(tpsList),
// WorldMapCreator.createDataSeries(geoList),
CPUGraph.createSeries(tpsList),
PlayerActivityGraph.createSeries(tpsList),
PunchCardGraph.createSeries(sessionList),
RamGraph.createSeries(tpsList),
TPSGraph.createSeries(tpsList),
WorldLoadGraph.createSeriesChunks(tpsList),
WorldLoadGraph.createSeriesEntities(tpsList),
// WorldMap.createSeries(geoList),
// TODO fix config mock dependency
// Arrays.toString(WorldPieCreator.createSeriesData(worldTimes))
// Arrays.toString(WorldPie.createSeries(worldTimes))
};
for (String test : series) {
int opened = StringUtils.countMatches(test, "{");
@ -95,7 +95,7 @@ public class GraphTest {
@Test
public void testSeriesCreator() {
String result = StringUtils.removeAll(SeriesCreator.seriesGraph(points, false, false), "[\\[\\]]");
String result = StringUtils.removeAll(LineSeries.createSeries(points, false, false), "[\\[\\]]");
String[] splittedResult = result.split(",");
Map<String, String> expected = new LinkedHashMap<>();