From 979ebac18db6304fae4b84767286c11a3b9af97a Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Sat, 16 Jan 2021 11:12:11 +0100 Subject: [PATCH] Fixed color management in country chart. --- src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java b/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java index 4490ba0..7bf6f97 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java +++ b/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java @@ -295,9 +295,12 @@ public class Htmlizer PieChart pie = new PieChart("Pays des membres"); int index = 0; + int maxIndex = ChartColor.values().length; 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); @@ -373,7 +376,7 @@ public class Htmlizer PieChart pie = new PieChart("Pays des services"); int index = 0; - int maxIndex = stats.keySet().size(); + int maxIndex = ChartColor.values().length; for (String country : stats.keySet()) { pie.add(country, stats.get(country), ChartColor.values()[index % maxIndex]);