use of org.dussan.vaadin.dcharts.DCharts in project cia by Hack23.
the class DecisionChartDataManagerImpl method createDecisionTypeChart.
@Override
public void createDecisionTypeChart(final AbstractOrderedLayout content, final String org) {
final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DD_MMM_YYYY, Locale.ENGLISH);
final DataSeries dataSeries = new DataSeries();
final Series series = new Series();
final Map<String, List<ViewRiksdagenCommitteeDecisionTypeOrgDailySummary>> allMap = getCommitteeDecisionTypeOrgMap();
final List<ViewRiksdagenCommitteeDecisionTypeOrgDailySummary> itemList = allMap.get(org.toUpperCase(Locale.ENGLISH).replace(UNDER_SCORE, EMPTY_STRING).trim());
if (itemList != null) {
final Map<String, List<ViewRiksdagenCommitteeDecisionTypeOrgDailySummary>> map = itemList.parallelStream().filter(t -> t != null && t.getEmbeddedId().getDecisionDate() != null).collect(Collectors.groupingBy(t -> t.getEmbeddedId().getDecisionType()));
addDecisionTypeByOrgData(simpleDateFormat, dataSeries, series, map);
}
addChart(content, "Org Decision type daily summary", new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsXYDateFloatLegendInsideOneColumn(series)).show(), true);
}
use of org.dussan.vaadin.dcharts.DCharts in project cia by Hack23.
the class GovernmentBodyChartDataManagerImpl method createMinistryGovernmentBodyHeadcountSummaryChart.
@Override
public void createMinistryGovernmentBodyHeadcountSummaryChart(final AbstractOrderedLayout content, final String name) {
final Map<Integer, List<GovernmentBodyAnnualSummary>> map = esvApi.getDataPerMinistry(name);
final List<String> governmentBodyNames = esvApi.getGovernmentBodyNames(name);
final DataSeries dataSeries = new DataSeries();
final Series series = new Series();
for (final String govBodyName : governmentBodyNames) {
series.addSeries(new XYseries().setLabel(govBodyName));
dataSeries.newSeries();
for (final Entry<Integer, List<GovernmentBodyAnnualSummary>> entry : map.entrySet()) {
final List<GovernmentBodyAnnualSummary> item = entry.getValue();
final Integer totalHeadcount = item.stream().filter((final GovernmentBodyAnnualSummary p) -> p.getName().equalsIgnoreCase(govBodyName)).mapToInt(GovernmentBodyAnnualSummary::getHeadCount).sum();
if (entry.getKey() != null && totalHeadcount > 0) {
dataSeries.add(FIRST_OF_JAN + entry.getKey(), totalHeadcount);
}
}
}
addChart(content, name + ANNUAL_HEADCOUNT_SUMMARY_ALL_GOVERNMENT_BODIES, new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsXYDateFloatLogYAxisLegendOutside(series)).show(), true);
}
use of org.dussan.vaadin.dcharts.DCharts in project cia by Hack23.
the class OrgDocumentChartDataManagerImpl method createDocumentHistoryChartByOrg.
@Override
public void createDocumentHistoryChartByOrg(final AbstractOrderedLayout content, final String org) {
final String searchOrg = org.toUpperCase(Locale.ENGLISH).replace(UNDER_SCORE, EMPTY_STRING).replace(MINUS_SIGN, EMPTY_STRING).trim();
final DataSeries dataSeries = new DataSeries();
final Series series = new Series();
final Map<String, List<ViewRiksdagenOrgDocumentDailySummary>> allMap = getViewRiksdagenOrgDocumentDailySummaryMap();
final List<ViewRiksdagenOrgDocumentDailySummary> itemList = allMap.get(searchOrg);
if (itemList != null) {
addDocumentHistoryByOrgData(dataSeries, series, itemList);
}
addChart(content, DOCUMENT_HISTORY_BY_ORG, new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsXYDateFloatLegendInsideOneColumn(series)).show(), true);
}
use of org.dussan.vaadin.dcharts.DCharts in project cia by Hack23.
the class PartyChartDataManagerImpl method createPartyWinnerChart.
@Override
public void createPartyWinnerChart(final AbstractOrderedLayout content) {
final Map<String, List<ViewRiksdagenVoteDataBallotPartySummaryDaily>> map = getPartyMap();
final DataSeries dataSeries = new DataSeries();
final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DD_MMM_YYYY, Locale.ENGLISH);
final Series series = new Series();
for (final Entry<String, List<ViewRiksdagenVoteDataBallotPartySummaryDaily>> entry : map.entrySet()) {
series.addSeries(new XYseries().setLabel(getPartyName(entry.getKey())));
dataSeries.newSeries();
final List<ViewRiksdagenVoteDataBallotPartySummaryDaily> list = entry.getValue();
for (final ViewRiksdagenVoteDataBallotPartySummaryDaily viewRiksdagenVoteDataBallotPartySummaryDaily : list) {
if (viewRiksdagenVoteDataBallotPartySummaryDaily != null) {
dataSeries.add(simpleDateFormat.format(viewRiksdagenVoteDataBallotPartySummaryDaily.getEmbeddedId().getVoteDate()), viewRiksdagenVoteDataBallotPartySummaryDaily.getPartyWonPercentage());
}
}
}
series.addSeries(new XYseries().setLabel(NUMBER_BALLOTS));
dataSeries.newSeries();
final List<ViewRiksdagenVoteDataBallotPartySummaryDaily> list = getMaxSizeViewRiksdagenVoteDataBallotPartySummaryDaily();
for (final ViewRiksdagenVoteDataBallotPartySummaryDaily viewRiksdagenVoteDataBallotPartySummaryDaily : list) {
if (viewRiksdagenVoteDataBallotPartySummaryDaily != null) {
dataSeries.add(simpleDateFormat.format(viewRiksdagenVoteDataBallotPartySummaryDaily.getEmbeddedId().getVoteDate()), viewRiksdagenVoteDataBallotPartySummaryDaily.getNumberBallots());
}
}
addChart(content, "Party winner by daily ballot average", new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsXYDateFloatLegendInsideOneColumn(series)).show(), true);
}
use of org.dussan.vaadin.dcharts.DCharts in project cia by Hack23.
the class PersonDocumentChartDataManagerImpl method createPersonDocumentHistoryChart.
@Override
public void createPersonDocumentHistoryChart(final AbstractOrderedLayout content, final String personId) {
final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DD_MMM_YYYY, Locale.ENGLISH);
final DataSeries dataSeries = new DataSeries();
final Series series = new Series();
final Map<String, List<ViewRiksdagenPoliticianDocumentDailySummary>> allMap = getViewRiksdagenPoliticianDocumentDailySummaryMap();
final List<ViewRiksdagenPoliticianDocumentDailySummary> itemList = allMap.get(personId.toUpperCase(Locale.ENGLISH).replace(UNDER_SCORE, EMPTY_STRING).trim());
if (itemList != null) {
final Map<String, List<ViewRiksdagenPoliticianDocumentDailySummary>> map = itemList.parallelStream().filter(Objects::nonNull).collect(Collectors.groupingBy(t -> StringUtils.defaultIfBlank(t.getEmbeddedId().getDocumentType(), NO_INFO)));
addDocumentHistoryByPersonData(simpleDateFormat, dataSeries, series, map);
}
addChart(content, DOCUMENT_HISTORY, new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsXYDateFloatLegendInsideOneColumn(series)).show(), true);
}
Aggregations