diff --git a/src/fr/devinsy/statoolinfos/htmlize/FederationStatsPage.java b/src/fr/devinsy/statoolinfos/htmlize/FederationStatsPage.java index e04d8c7..70a6154 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/FederationStatsPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/FederationStatsPage.java @@ -69,6 +69,7 @@ public class FederationStatsPage data.setContent("turnoutChart", Htmlizer.htmlizeOrganizationTurnoutChart(federation.getOrganizations())); data.setContent("organizationCountryChart", Htmlizer.htmlizeOrganizationCountryChart(federation.getOrganizations())); + data.setContent("organizationCountChart", Htmlizer.htmlizeOrganizationCountChart(federation)); data.setContent("hostServerTypeChart", Htmlizer.htmlizeHostServerTypeChart(federation.getAllServices())); data.setContent("hostProviderTypeChart", Htmlizer.htmlizeHostProviderTypeChart(federation.getAllServices())); diff --git a/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java b/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java index 7ac5da4..616febb 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java +++ b/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java @@ -29,17 +29,20 @@ import org.slf4j.LoggerFactory; import fr.devinsy.statoolinfos.HtmlizerContext; import fr.devinsy.statoolinfos.core.Category; import fr.devinsy.statoolinfos.core.Configuration; +import fr.devinsy.statoolinfos.core.Federation; import fr.devinsy.statoolinfos.core.Organization; import fr.devinsy.statoolinfos.core.Organizations; import fr.devinsy.statoolinfos.core.Services; import fr.devinsy.statoolinfos.core.StatoolInfosException; import fr.devinsy.statoolinfos.core.StatoolInfosUtils; import fr.devinsy.statoolinfos.htmlize.charts.BarChart; +import fr.devinsy.statoolinfos.htmlize.charts.BarChartView; import fr.devinsy.statoolinfos.htmlize.charts.ChartColor; import fr.devinsy.statoolinfos.htmlize.charts.DoughnutChartView; import fr.devinsy.statoolinfos.htmlize.charts.PieChart; import fr.devinsy.statoolinfos.htmlize.charts.PieChart.Position; import fr.devinsy.statoolinfos.htmlize.charts.PieChartView; +import fr.devinsy.statoolinfos.properties.PathProperty; import fr.devinsy.statoolinfos.stats.StatAgent; import fr.devinsy.statoolinfos.stats.country.CountryStats; import fr.devinsy.statoolinfos.stats.organizations.OrganizationTurnoutStats; @@ -248,6 +251,36 @@ public class Htmlizer return result; } + /** + * Htmlize organization count chart. + * + * @param federation + * the federation + * @return the string + * @throws StatoolInfosException + * the statool infos exception + */ + public static String htmlizeOrganizationCountChart(final Federation federation) throws StatoolInfosException + { + String result; + + BarChart chart; + + chart = new BarChart("Nombre de membres"); + for (PathProperty property : federation.getByPrefix("metrics.federation.members.count")) + { + if (property.getLeaf().matches("\\d\\d\\d\\d")) + { + chart.add(property.getLeaf(), Double.parseDouble(property.getValue()), ChartColor.GREEN); + } + } + + result = BarChartView.build(chart); + + // + return result; + } + /** * @param organizations * @return diff --git a/src/fr/devinsy/statoolinfos/htmlize/federationStats.xhtml b/src/fr/devinsy/statoolinfos/htmlize/federationStats.xhtml index 16e79d3..025debd 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/federationStats.xhtml +++ b/src/fr/devinsy/statoolinfos/htmlize/federationStats.xhtml @@ -18,6 +18,7 @@
+