Added host server distribution stats graphics. Improved and fixed stats.
This commit is contained in:
parent
c858a23e0d
commit
0b44e9629e
9 changed files with 155 additions and 36 deletions
|
@ -299,6 +299,21 @@ public class Service extends PathPropertyList
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the host server distribution.
|
||||
*
|
||||
* @return the host server distribution
|
||||
*/
|
||||
public String getHostServerDistribution()
|
||||
{
|
||||
String result;
|
||||
|
||||
result = get("host.server.distribution");
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the host server type.
|
||||
*
|
||||
|
|
|
@ -273,6 +273,68 @@ public class ChartHtmlizer
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize host server distribution chart.
|
||||
*
|
||||
* @param services
|
||||
* the services
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public static String htmlizeHostServerDistributionChart(final Services services) throws StatoolInfosException
|
||||
{
|
||||
String result;
|
||||
|
||||
ChartColors colors = ChartColor.valueList();
|
||||
colors.remove(ChartColor.BLUE);
|
||||
|
||||
StringCounters counters = new StringCounters();
|
||||
long unknowns = 0;
|
||||
for (Service service : services)
|
||||
{
|
||||
if (StringUtils.isBlank(service.getHostServerDistribution()))
|
||||
{
|
||||
unknowns += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
counters.inc(StringUtils.capitalize(service.getHostServerDistribution().toLowerCase()));
|
||||
}
|
||||
}
|
||||
|
||||
StringCounterList list = counters.toList().sortByCounter().reverse();
|
||||
|
||||
PieChart pie = new PieChart("Distributions serveur");
|
||||
pie.setLegendPosition(Position.RIGHT);
|
||||
|
||||
int index = 0;
|
||||
while ((index < list.size() && (index < 7)))
|
||||
{
|
||||
ChartColor color = colors.get(index);
|
||||
StringCounter counter = list.get(index);
|
||||
pie.add(counter.getString(), counter.getCounter(), color);
|
||||
|
||||
index += 1;
|
||||
}
|
||||
|
||||
int others = 0;
|
||||
while (index < list.size())
|
||||
{
|
||||
StringCounter counter = list.get(index);
|
||||
others += counter.getCounter();
|
||||
|
||||
index += 1;
|
||||
}
|
||||
pie.add("Autres", others, ChartColor.GREY);
|
||||
pie.add("Inconnus", unknowns, ChartColor.BLUE);
|
||||
|
||||
result = DoughnutChartView.build(pie);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Htmlize host server type chart.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -28,6 +28,8 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import fr.devinsy.statoolinfos.HtmlizerContext;
|
||||
import fr.devinsy.statoolinfos.core.Federation;
|
||||
import fr.devinsy.statoolinfos.core.Organizations;
|
||||
import fr.devinsy.statoolinfos.core.Services;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.stats.StatAgent;
|
||||
import fr.devinsy.statoolinfos.stats.services.RegistrationStats;
|
||||
|
@ -60,23 +62,28 @@ public class FederationStatsPage
|
|||
// CrawlCache cache = HtmlizerContext.instance().getCache();
|
||||
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
|
||||
|
||||
Organizations organizations = federation.getActiveOrganizations();
|
||||
Services services = federation.getActiveServices();
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
|
||||
data.setContent("federationHeaderView", FederationHeaderView.htmlize(federation));
|
||||
|
||||
data.setContent("turnoutChart", ChartHtmlizer.htmlizeOrganizationTurnoutChart(federation.getActiveOrganizations()));
|
||||
data.setContent("organizationCountryChart", ChartHtmlizer.htmlizeOrganizationCountryChart(federation.getActiveOrganizations()));
|
||||
data.setContent("turnoutChart", ChartHtmlizer.htmlizeOrganizationTurnoutChart(organizations));
|
||||
data.setContent("organizationCountryChart", ChartHtmlizer.htmlizeOrganizationCountryChart(organizations));
|
||||
data.setContent("organizationCountChart", ChartHtmlizer.htmlizeOrganizationCountChart(federation));
|
||||
data.setContent("organizationInOutChart", ChartHtmlizer.htmlizeOrganizationInOutChart(federation));
|
||||
|
||||
data.setContent("hostServerTypeChart", ChartHtmlizer.htmlizeHostServerTypeChart(federation.getServices()));
|
||||
data.setContent("hostProviderTypeChart", ChartHtmlizer.htmlizeHostProviderTypeChart(federation.getServices()));
|
||||
data.setContent("serviceInstallTypeChart", ChartHtmlizer.htmlizeServiceInstallTypeChart(federation.getServices()));
|
||||
data.setContent("serviceCountryChart", ChartHtmlizer.htmlizeServiceCountryChart(federation.getServices()));
|
||||
data.setContent("hostServerDistributionChart", ChartHtmlizer.htmlizeHostServerDistributionChart(services));
|
||||
data.setContent("hostServerTypeChart", ChartHtmlizer.htmlizeHostServerTypeChart(services));
|
||||
data.setContent("hostProviderTypeChart", ChartHtmlizer.htmlizeHostProviderTypeChart(services));
|
||||
data.setContent("serviceCountryChart", ChartHtmlizer.htmlizeServiceCountryChart(services));
|
||||
|
||||
data.setContent("hostNameChart", ChartHtmlizer.htmlizeHostNamePieChart(services));
|
||||
data.setContent("serviceInstallTypeChart", ChartHtmlizer.htmlizeServiceInstallTypeChart(services));
|
||||
|
||||
//
|
||||
{
|
||||
RegistrationStats stats = StatAgent.statRegistrationTypes(federation.getServices());
|
||||
RegistrationStats stats = StatAgent.statRegistrationTypes(services);
|
||||
|
||||
data.setContent("registrationTypeChart", ChartHtmlizer.htmlizeRegistrationBarChart(stats));
|
||||
data.setContent("registrationNoneTypeChart", ChartHtmlizer.htmlizeRegistrationNonePieChart(stats));
|
||||
|
@ -86,14 +93,12 @@ public class FederationStatsPage
|
|||
}
|
||||
|
||||
data.setContent("serviceCountYearChart", ChartHtmlizer.htmlizeServiceCountYearChart(federation));
|
||||
data.setContent("serviceDateStatusChart", ChartHtmlizer.htmlizeServiceDateStatusChart(federation.getServices()));
|
||||
data.setContent("serviceDateStatusChart", ChartHtmlizer.htmlizeServiceDateStatusChart(services));
|
||||
|
||||
data.setContent("softwareDistributionChart", ChartHtmlizer.htmlizeSoftwareDistributionChart());
|
||||
data.setContent("softwareDistributionPieChart", ChartHtmlizer.htmlizeSoftwareDistributionPieChart(federation.getServicesAll()));
|
||||
data.setContent("softwareDistributionPieChart", ChartHtmlizer.htmlizeSoftwareDistributionPieChart(services));
|
||||
data.setContent("categoryDistributionChart", ChartHtmlizer.htmlizeCategoryDistributionChart());
|
||||
data.setContent("categoryDistributionPieChart", ChartHtmlizer.htmlizeCatergoryDistributionPieChart(federation.getServicesAll()));
|
||||
|
||||
data.setContent("hostNameChart", ChartHtmlizer.htmlizeHostNamePieChart(federation.getServices()));
|
||||
data.setContent("categoryDistributionPieChart", ChartHtmlizer.htmlizeCatergoryDistributionPieChart(services));
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/federationStats.xhtml", data).toString();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -24,6 +24,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.Organization;
|
||||
import fr.devinsy.statoolinfos.core.Services;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.stats.StatAgent;
|
||||
import fr.devinsy.statoolinfos.stats.services.RegistrationStats;
|
||||
|
@ -63,19 +64,19 @@ public class OrganizationStatsPage
|
|||
data.setContent("headerView", OrganizationHeaderView.htmlize(organization));
|
||||
|
||||
//
|
||||
data.setContent("serviceCountYearChart", ChartHtmlizer.htmlizeServiceCountYearChart(organization));
|
||||
data.setContent("serviceDateStatusChart", ChartHtmlizer.htmlizeServiceDateStatusChart(organization.getServices()));
|
||||
|
||||
data.setContent("turnoutChart", ChartHtmlizer.htmlizeOrganizationTurnoutChart(organization));
|
||||
|
||||
data.setContent("hostServerTypeChart", ChartHtmlizer.htmlizeHostServerTypeChart(organization.getServices()));
|
||||
data.setContent("hostProviderTypeChart", ChartHtmlizer.htmlizeHostProviderTypeChart(organization.getServices()));
|
||||
data.setContent("serviceInstallTypeChart", ChartHtmlizer.htmlizeServiceInstallTypeChart(organization.getServices()));
|
||||
data.setContent("serviceCountryChart", ChartHtmlizer.htmlizeServiceCountryChart(organization.getServices()));
|
||||
Services services = organization.getActiveServices();
|
||||
data.setContent("hostServerDistributionChart", ChartHtmlizer.htmlizeHostServerDistributionChart(services));
|
||||
data.setContent("hostServerTypeChart", ChartHtmlizer.htmlizeHostServerTypeChart(services));
|
||||
data.setContent("hostProviderTypeChart", ChartHtmlizer.htmlizeHostProviderTypeChart(services));
|
||||
data.setContent("serviceCountryChart", ChartHtmlizer.htmlizeServiceCountryChart(services));
|
||||
|
||||
data.setContent("hostNameChart", ChartHtmlizer.htmlizeHostNamePieChart(services));
|
||||
data.setContent("serviceInstallTypeChart", ChartHtmlizer.htmlizeServiceInstallTypeChart(services));
|
||||
|
||||
//
|
||||
{
|
||||
RegistrationStats stats = StatAgent.statRegistrationTypes(organization.getServices());
|
||||
RegistrationStats stats = StatAgent.statRegistrationTypes(services);
|
||||
|
||||
data.setContent("registrationTypeChart", ChartHtmlizer.htmlizeRegistrationBarChart(stats));
|
||||
data.setContent("registrationNoneTypeChart", ChartHtmlizer.htmlizeRegistrationNonePieChart(stats));
|
||||
|
@ -84,6 +85,9 @@ public class OrganizationStatsPage
|
|||
data.setContent("registrationClientTypeChart", ChartHtmlizer.htmlizeRegistrationClientPieChart(stats));
|
||||
}
|
||||
|
||||
data.setContent("serviceDateStatusChart", ChartHtmlizer.htmlizeServiceDateStatusChart(services));
|
||||
data.setContent("serviceCountYearChart", ChartHtmlizer.htmlizeServiceCountYearChart(organization));
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/organizationStatsPage.xhtml", data).toString();
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -60,16 +60,17 @@ public class ServiceStatsView
|
|||
//
|
||||
data.setContent("turnoutChart", ChartHtmlizer.htmlizeOrganizationTurnoutChart(service));
|
||||
|
||||
Services mock = Services.of(service);
|
||||
Services services = Services.of(service);
|
||||
data.setContent("hostServerDistributionChart", ChartHtmlizer.htmlizeHostServerDistributionChart(services));
|
||||
data.setContent("hostServerTypeChart", ChartHtmlizer.htmlizeHostServerTypeChart(services));
|
||||
data.setContent("hostProviderTypeChart", ChartHtmlizer.htmlizeHostProviderTypeChart(services));
|
||||
data.setContent("serviceCountryChart", ChartHtmlizer.htmlizeServiceCountryChart(services));
|
||||
|
||||
data.setContent("hostServerTypeChart", ChartHtmlizer.htmlizeHostServerTypeChart(mock));
|
||||
data.setContent("hostProviderTypeChart", ChartHtmlizer.htmlizeHostProviderTypeChart(mock));
|
||||
data.setContent("serviceInstallTypeChart", ChartHtmlizer.htmlizeServiceInstallTypeChart(mock));
|
||||
data.setContent("serviceCountryChart", ChartHtmlizer.htmlizeServiceCountryChart(mock));
|
||||
data.setContent("hostNameChart", ChartHtmlizer.htmlizeHostNamePieChart(services));
|
||||
data.setContent("serviceInstallTypeChart", ChartHtmlizer.htmlizeServiceInstallTypeChart(services));
|
||||
|
||||
//
|
||||
{
|
||||
RegistrationStats stats = StatAgent.statRegistrationTypes(mock);
|
||||
RegistrationStats stats = StatAgent.statRegistrationTypes(services);
|
||||
|
||||
data.setContent("registrationTypeChart", ChartHtmlizer.htmlizeRegistrationBarChart(stats));
|
||||
data.setContent("registrationNoneTypeChart", ChartHtmlizer.htmlizeRegistrationNonePieChart(stats));
|
||||
|
@ -78,8 +79,8 @@ public class ServiceStatsView
|
|||
data.setContent("registrationClientTypeChart", ChartHtmlizer.htmlizeRegistrationClientPieChart(stats));
|
||||
}
|
||||
|
||||
data.setContent("serviceCountYearChart", ChartHtmlizer.htmlizeServiceCountYearChart(mock));
|
||||
data.setContent("serviceDateStatusChart", ChartHtmlizer.htmlizeServiceDateStatusChart(mock));
|
||||
data.setContent("serviceCountYearChart", ChartHtmlizer.htmlizeServiceCountYearChart(services));
|
||||
data.setContent("serviceDateStatusChart", ChartHtmlizer.htmlizeServiceDateStatusChart(services));
|
||||
|
||||
//
|
||||
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceStatsView.xhtml", data).toString();
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
<div id="organizationInOutChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
</div>
|
||||
<div>
|
||||
<div id="hostServerDistributionChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
<div id="hostServerTypeChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
<div id="hostProviderTypeChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
<div id="serviceCountryChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
|
|
|
@ -19,11 +19,15 @@
|
|||
<div id="turnoutChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
</div>
|
||||
<div>
|
||||
<div id="hostServerDistributionChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
<div id="hostServerTypeChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
<div id="hostProviderTypeChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
<div id="serviceInstallTypeChart" class="chartborder" style="width: 250px; height: 230px; display: inline-block; vertical-align: top;"/>
|
||||
<div id="serviceCountryChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
</div>
|
||||
<div>
|
||||
<div id="hostNameChart" class="chartborder" style="width: 500px; height: 250px; display: inline-block;"/>
|
||||
<div id="serviceInstallTypeChart" class="chartborder" style="width: 500px; height: 250px; display: inline-block; vertical-align: top;"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div id="registrationTypeChart" class="column chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
<div class="column">
|
||||
|
|
|
@ -17,11 +17,15 @@
|
|||
<div id="turnoutChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
</div>
|
||||
<div>
|
||||
<div id="hostServerDistributionChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
<div id="hostServerTypeChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
<div id="hostProviderTypeChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
<div id="serviceInstallTypeChart" class="chartborder" style="width: 250px; height: 230px; display: inline-block; vertical-align: top;"/>
|
||||
<div id="serviceCountryChart" class="chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
</div>
|
||||
<div>
|
||||
<div id="hostNameChart" class="chartborder" style="width: 500px; height: 250px; display: inline-block;"/>
|
||||
<div id="serviceInstallTypeChart" class="chartborder" style="width: 500px; height: 250px; display: inline-block; vertical-align: top;"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div id="registrationTypeChart" class="column chartborder" style="width: 250px; height: 200px; display: inline-block;"/>
|
||||
<div class="column">
|
||||
|
|
|
@ -260,6 +260,29 @@ public class StatAgent
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stat host server distribution.
|
||||
*
|
||||
* @param services
|
||||
* the services
|
||||
* @return the host server type stats
|
||||
*/
|
||||
public static HostServerTypeStats statHostServerDistribution(final Services services)
|
||||
{
|
||||
HostServerTypeStats result;
|
||||
|
||||
result = new HostServerTypeStats();
|
||||
|
||||
//
|
||||
for (Service service : services)
|
||||
{
|
||||
result.inc(service.getHostServerType());
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stat host server type.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue