Fixed color management in country chart.

This commit is contained in:
Christian P. MOMON 2021-01-16 11:12:11 +01:00
parent ee67a18f0d
commit 979ebac18d

View file

@ -295,9 +295,12 @@ public class Htmlizer
PieChart pie = new PieChart("Pays des membres"); PieChart pie = new PieChart("Pays des membres");
int index = 0; int index = 0;
int maxIndex = ChartColor.values().length;
for (String country : stats.keySet()) for (String country : stats.keySet())
{ {
pie.add(country, stats.get(country), ChartColor.values()[index]); pie.add(country, stats.get(country), ChartColor.values()[index % maxIndex]);
index += 1;
} }
pie.setLegendPosition(Position.RIGHT); pie.setLegendPosition(Position.RIGHT);
@ -373,7 +376,7 @@ public class Htmlizer
PieChart pie = new PieChart("Pays des services"); PieChart pie = new PieChart("Pays des services");
int index = 0; int index = 0;
int maxIndex = stats.keySet().size(); int maxIndex = ChartColor.values().length;
for (String country : stats.keySet()) for (String country : stats.keySet())
{ {
pie.add(country, stats.get(country), ChartColor.values()[index % maxIndex]); pie.add(country, stats.get(country), ChartColor.values()[index % maxIndex]);