use of com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeDecisionTypeOrgDailySummary 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 com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeDecisionTypeOrgDailySummary in project cia by Hack23.
the class DecisionChartDataManagerImpl method addDecisionTypeByOrgData.
/**
* Adds the decision type by org data.
*
* @param simpleDateFormat
* the simple date format
* @param dataSeries
* the data series
* @param series
* the series
* @param map
* the map
*/
private static void addDecisionTypeByOrgData(final SimpleDateFormat simpleDateFormat, final DataSeries dataSeries, final Series series, final Map<String, List<ViewRiksdagenCommitteeDecisionTypeOrgDailySummary>> map) {
for (final Entry<String, List<ViewRiksdagenCommitteeDecisionTypeOrgDailySummary>> entry : map.entrySet()) {
if (!EMPTY_STRING.equals(entry.getKey())) {
final XYseries label = new XYseries();
label.setLabel(entry.getKey());
series.addSeries(label);
dataSeries.newSeries();
for (final ViewRiksdagenCommitteeDecisionTypeOrgDailySummary item : entry.getValue()) {
if (item != null) {
dataSeries.add(simpleDateFormat.format(item.getEmbeddedId().getDecisionDate()), item.getTotal());
}
}
}
}
}
Aggregations