Search in sources :

Example 1 with ViewRiksdagenDocumentTypeDailySummary

use of com.hack23.cia.model.internal.application.data.document.impl.ViewRiksdagenDocumentTypeDailySummary in project cia by Hack23.

the class DocumentChartDataManagerImpl method addDataSeries.

/**
 * Adds the data series.
 *
 * @param simpleDateFormat the simple date format
 * @param parseInputDateFormat the parse input date format
 * @param dataSeries the data series
 * @param series the series
 * @param entry the entry
 */
private static void addDataSeries(final SimpleDateFormat simpleDateFormat, final SimpleDateFormat parseInputDateFormat, final DataSeries dataSeries, final Series series, final Entry<String, List<ViewRiksdagenDocumentTypeDailySummary>> entry) {
    series.addSeries(new XYseries().setLabel(entry.getKey()));
    dataSeries.newSeries();
    for (final ViewRiksdagenDocumentTypeDailySummary item : entry.getValue()) {
        if (item != null && item.getEmbeddedId().getPublicDate().length() > 0) {
            try {
                dataSeries.add(simpleDateFormat.format(parseInputDateFormat.parse(item.getEmbeddedId().getPublicDate())), item.getTotal());
            } catch (final ParseException e) {
                LOGGER.warn("Problem parsing date:{}", item.getEmbeddedId().getPublicDate());
            }
        }
    }
}
Also used : ViewRiksdagenDocumentTypeDailySummary(com.hack23.cia.model.internal.application.data.document.impl.ViewRiksdagenDocumentTypeDailySummary) ParseException(java.text.ParseException) XYseries(org.dussan.vaadin.dcharts.base.elements.XYseries)

Aggregations

ViewRiksdagenDocumentTypeDailySummary (com.hack23.cia.model.internal.application.data.document.impl.ViewRiksdagenDocumentTypeDailySummary)1 ParseException (java.text.ParseException)1 XYseries (org.dussan.vaadin.dcharts.base.elements.XYseries)1