Eluded 0-time worlds/aliases from world pies #402

This commit is contained in:
Rsl1122 2017-11-29 10:55:39 +02:00
parent ac98c1e9d2
commit 7b33c1a43e
5 changed files with 15 additions and 5 deletions

View File

@ -1,6 +1,7 @@
package main.java.com.djrapitops.plan.utilities.html.graphs;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.Settings;
import main.java.com.djrapitops.plan.WorldAliasSettings;
import main.java.com.djrapitops.plan.data.time.GMTimes;
import main.java.com.djrapitops.plan.data.time.WorldTimes;
@ -21,6 +22,9 @@ public class WorldPieCreator {
* @return String array, index 0: Series data, 1: drilldown data
*/
public static String[] createSeriesData(WorldTimes worldTimes) {
String[] colors = Settings.THEME_GRAPH_WORLD_PIE.toString().split(", ");
int colLenght = colors.length;
StringBuilder seriesBuilder = new StringBuilder("[");
int i = 0;
// WorldTimes Map<String, GMTimes> (GMTimes.getTotal)
@ -34,8 +38,14 @@ public class WorldPieCreator {
int size = playtimePerAlias.size();
for (String alias : worlds) {
Long value = playtimePerAlias.getOrDefault(alias, 0L);
if (value == 0L) {
i++;
continue;
}
seriesBuilder.append("{name:'").append(alias)
.append("',y:").append(playtimePerAlias.getOrDefault(alias, 0L))
.append("',y:").append(value)
.append(",color:").append(colors[i % colLenght])
.append(",drilldown: '").append(alias).append("'");
seriesBuilder.append("}");

View File

@ -98,7 +98,7 @@ public class ServerAccordionCreator {
.append("<div id=\"").append(worldId).append("\" class=\"dashboard-donut-chart\"></div>")
// World Pie data script
.append("<script>")
.append("var ").append(worldId).append("series = {name:'World Playtime',colors: worldPieColors,colorByPoint:true,data:").append(worldData[0]).append("};")
.append("var ").append(worldId).append("series = {name:'World Playtime'," +/*colors: worldPieColors,*/"colorByPoint:true,data:").append(worldData[0]).append("};")
.append("var ").append(worldId).append("gmseries = ").append(worldData[1]).append(";")
.append("</script>")
.append("</div>") // Right col-6

View File

@ -118,7 +118,7 @@ public class SessionTabStructureCreator {
.append("<div id=\"").append(worldId).append("\" class=\"dashboard-donut-chart\"></div>")
// World Pie data script
.append("<script>")
.append("var ").append(worldId).append("series = {name:'World Playtime',colors: worldPieColors,colorByPoint:true,data:").append(worldData[0]).append("};")
.append("var ").append(worldId).append("series = {name:'World Playtime'," +/*colors: worldPieColors,*/"colorByPoint:true,data:").append(worldData[0]).append("};")
.append("var ").append(worldId).append("gmseries = ").append(worldData[1]).append(";")
.append("</script>")
.append("</div>") // Right col-6

View File

@ -602,7 +602,7 @@
var worldSeries = {
name: 'World Playtime',
colorByPoint: true,
colors: worldPieColors,
// colors: worldPieColors,
data: ${worldPieSeries}
};
var gmSeries = ${gmSeries};

View File

@ -1046,7 +1046,7 @@
var worldSeries = {
name: 'World Playtime',
colorByPoint: true,
colors: worldPieColors,
// colors: worldPieColors,
data: ${worldSeries}
};
var gmSeries = ${gmSeries};