Made Geolocation Map relative of screen width and height

Javadocs
This commit is contained in:
Rsl1122 2017-07-27 18:19:19 +03:00
parent 81a2c26832
commit 882fe3dad3
3 changed files with 44 additions and 8 deletions

View File

@ -20,7 +20,7 @@ import java.util.stream.Collectors;
* Contains following place-holders: totallogins, uniquejoinsday,
* uniquejoinsweek, uniquejoinsmonth, avguniquejoins, avguniquejoinsday,
* avguniquejoinsweek, avguniquejoinsmonth, npday, npweek, npmonth,
* npdataday, npdataweek, npdatamonth, newperday, newperdayday, newperdayweek, newpermonth
* npdataday, npdataweek, npdatamonth, newperday, newperdayday, newperdayweek, newperdaymonth
*
* @author Rsl1122
* @since 3.5.2

View File

@ -5,8 +5,22 @@ import main.java.com.djrapitops.plan.utilities.analysis.Point;
import java.util.List;
import java.util.stream.Collectors;
/**
* Class for creating scatter graph data from Registration epoch dates.
*
* @author Rsl1122
* @since 3.6.0
*/
public class NewPlayersGraphCreator {
/**
* Creates a scatter data string from given data.
*
* @param registered Registration dates of players
* @param scale Scale which the graph should reside within. (Milliseconds)
* @param now Current epoch ms.
* @return Scatter Graph data string for ChartJs
*/
public static String buildScatterDataString(List<Long> registered, long scale, long now) {
List<Long> filtered = registered.stream()
.filter(date -> date >= now - scale).collect(Collectors.toList());
@ -17,6 +31,13 @@ public class NewPlayersGraphCreator {
return ScatterGraphCreator.scatterGraph(points, true);
}
/**
* Counts registration amounts of certain date.
*
* @param filtered Filtered registration list (Filtered to scale)
* @param lookFor Look for this date
* @return How many were on the list.
*/
private static long getCount(List<Long> filtered, long lookFor) {
return filtered.stream().filter(date -> lookFor == date).count();
}

View File

@ -278,6 +278,7 @@
}
}
</style>
</head>
<body onload="countUpTimer()">
@ -382,7 +383,8 @@
<i class="fa fa-calendar-plus-o" aria-hidden="true"></i> Total Login times:
%totallogins%<br/>
<i class="fa fa-user-circle-o" aria-hidden="true"></i> Average Unique Players/Day:
%avguniquejoins% | <i class="fa fa-user-plus" aria-hidden="true"></i> Average New/Day: %newperday%<br>
%avguniquejoins% | <i class="fa fa-user-plus" aria-hidden="true"></i> Average New/Day:
%newperday%<br>
<b><i class="fa fa-crosshairs" aria-hidden="true"></i></b> Player kills: %playerkills% | <i
class="fa fa-crosshairs" aria-hidden="true"></i> Mob kills: %mobkills% | <i
class="fa fa-meh-o" aria-hidden="true"></i> Deaths: %deaths%</p>
@ -499,8 +501,9 @@
</div>
<canvas id="playerChartWeek" width="1000" height="350" style="width: 95%;"></canvas>
<p><i class="fa fa-user-circle" aria-hidden="true"></i> Unique Players: %uniquejoinsweek% | <i
class="fa fa-user-circle-o" aria-hidden="true"></i> Unique/Day: %avguniquejoinsweek% | <i
class="fa fa-user-plus" aria-hidden="true"></i> New/Day: %newperdayweek%
class="fa fa-user-circle-o" aria-hidden="true"></i> Unique/Day: %avguniquejoinsweek% |
<i
class="fa fa-user-plus" aria-hidden="true"></i> New/Day: %newperdayweek%
</p>
</div>
<div class=" box column">
@ -525,8 +528,9 @@
</div>
<canvas id="playerChartMonth" width="1000" height="350" style="width: 95%;"></canvas>
<p><i class="fa fa-user-circle" aria-hidden="true"></i> Unique Players: %uniquejoinsmonth% | <i
class="fa fa-user-circle-o" aria-hidden="true"></i> Unique/Day: %avguniquejoinsmonth% | <i
class="fa fa-user-plus" aria-hidden="true"></i> New/Day: %newperdaymonth%
class="fa fa-user-circle-o" aria-hidden="true"></i> Unique/Day: %avguniquejoinsmonth% |
<i
class="fa fa-user-plus" aria-hidden="true"></i> New/Day: %newperdaymonth%
</p>
</div>
</div>
@ -919,6 +923,7 @@
setTimeout('countUpTimer()', 1000);
}
</script>
<script src="https://www.kryogenix.org/code/browser/sorttable/sorttable.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.bundle.js"></script>
@ -1183,6 +1188,7 @@
}
});
</script>
<script>
// TPS Graph 7d
@ -1281,6 +1287,7 @@
}
});
</script>
<script>
// TPS Graph 24h
@ -1379,6 +1386,7 @@
}
});
</script>
<script>
// CPU Graph 24h
@ -1442,6 +1450,7 @@
}
});
</script>
<script>
// CPU Graph 7d
@ -1504,6 +1513,7 @@
}
}
});
</script>
<script>
// ActivityPie Graph
@ -1531,6 +1541,7 @@
}
});
</script>
<script>
// GMPie Graph
@ -1558,6 +1569,7 @@
}
});
</script>
<script>
// Session start puchcard bubblechart
@ -1639,6 +1651,7 @@
}
});
</script>
<script>
// Session length distribution barchart
@ -1691,6 +1704,7 @@
}
});
</script>
<script>
// Geolocation map
@ -1722,7 +1736,9 @@
}];
var layout = {
title: '',
autosize: true,
autosize: false,
width: window.innerWidth*0.7,
height: window.innerHeight*0.7,
geo:{
showframe: false,
showcoastlines: false,
@ -1732,7 +1748,6 @@
}
};
Plotly.plot(CLOROPLETH, data, layout, {showLink: false});
</script>
</div>
</body>