mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-04 01:39:35 +01:00
New HighCharts Graphs
This commit is contained in:
parent
652c700d1a
commit
fe3395fe7a
@ -56,6 +56,12 @@ public class TPSPart extends RawData {
|
||||
addValue("tpsscatterday", tpsScatterDay);
|
||||
addValue("tpsscatterweek", tpsScatterWeek);
|
||||
|
||||
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("cpuscatterday", cpuScatterDay);
|
||||
addValue("cpuscatterweek", cpuScatterWeek);
|
||||
addValue("ramscatterday", ramScatterDay);
|
||||
|
@ -16,6 +16,13 @@ public class CPUGraphCreator {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
public static String buildSeriesDataString(List<TPS> tpsData) {
|
||||
List<Point> points = tpsData.stream()
|
||||
.map(tps -> new Point(tps.getDate(), tps.getCPUUsage()))
|
||||
.collect(Collectors.toList());
|
||||
return SeriesCreator.seriesGraph(points, true);
|
||||
}
|
||||
|
||||
public static String buildScatterDataString(List<TPS> tpsData, long scale) {
|
||||
long now = MiscUtils.getTime();
|
||||
List<Point> points = tpsData.stream()
|
||||
|
@ -23,6 +23,13 @@ public class RamGraphCreator {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
public static String buildSeriesDataString(List<TPS> tpsData) {
|
||||
List<Point> points = tpsData.stream()
|
||||
.map(tps -> new Point(tps.getDate(), tps.getUsedMemory()))
|
||||
.collect(Collectors.toList());
|
||||
return SeriesCreator.seriesGraph(points, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a scatter data string from given data.
|
||||
*
|
||||
|
@ -69,7 +69,7 @@ public class SeriesCreator {
|
||||
Point point = points.get(i);
|
||||
double y = point.getY();
|
||||
long date = (long) point.getX();
|
||||
arrayBuilder.append("[").append(date).append(",").append(y).append("]");
|
||||
arrayBuilder.append("{x:").append(date).append(",y:").append(y).append("}");
|
||||
if (i < size - 1) {
|
||||
arrayBuilder.append(",");
|
||||
}
|
||||
|
@ -21,7 +21,14 @@ public class TPSGraphCreator {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
public static String buildScatterDataStringTPS(List<TPS> tpsData, long scale) {
|
||||
public static String buildSeriesDataString(List<TPS> tpsData) {
|
||||
long now = MiscUtils.getTime();
|
||||
List<Point> points = tpsData.stream()
|
||||
.map(tps -> new Point(tps.getDate(), tps.getTps()))
|
||||
.collect(Collectors.toList());
|
||||
return ScatterGraphCreator.scatterGraph(points, true);
|
||||
|
||||
}public static String buildScatterDataStringTPS(List<TPS> tpsData, long scale) {
|
||||
long now = MiscUtils.getTime();
|
||||
List<Point> points = tpsData.stream()
|
||||
.filter(tps -> tps.getDate() >= now - scale)
|
||||
|
@ -16,6 +16,20 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
public class WorldLoadGraphCreator {
|
||||
|
||||
public static String buildSeriesDataStringEntities(List<TPS> tpsData) {
|
||||
List<Point> points = tpsData.stream()
|
||||
.map(tps -> new Point(tps.getDate(), tps.getEntityCount()))
|
||||
.collect(Collectors.toList());
|
||||
return SeriesCreator.seriesGraph(points, true);
|
||||
}
|
||||
|
||||
public static String buildSeriesDataStringChunks(List<TPS> tpsData) {
|
||||
List<Point> points = tpsData.stream()
|
||||
.map(tps -> new Point(tps.getDate(), tps.getChunksLoaded()))
|
||||
.collect(Collectors.toList());
|
||||
return SeriesCreator.seriesGraph(points, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor used to hide the public constructor
|
||||
*/
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user