New HighCharts Graphs

This commit is contained in:
Rsl1122 2017-07-30 01:24:47 +03:00
parent 652c700d1a
commit fe3395fe7a
7 changed files with 251 additions and 874 deletions

View File

@ -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);

View File

@ -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()

View File

@ -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.
*

View File

@ -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(",");
}

View File

@ -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)

View File

@ -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