Search in sources :

Example 1 with XYseries

use of org.dussan.vaadin.dcharts.base.elements.XYseries in project cia by Hack23.

the class AdminChartDataManagerImpl method createApplicationActionEventPageElementDailySummaryChart.

@Override
public void createApplicationActionEventPageElementDailySummaryChart(final AbstractOrderedLayout content, final String page, final String elementId) {
    final List<ViewApplicationActionEventPageElementDailySummary> list = getApplicationActionEventPageElementDailySummaryList(page, elementId);
    final DataSeries dataSeries = new DataSeries();
    final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DD_MMM_YYYY, Locale.ENGLISH);
    final Series series = new Series();
    series.addSeries(new XYseries().setLabel(PAGE_HITS));
    dataSeries.newSeries();
    for (final ViewApplicationActionEventPageElementDailySummary item : list) {
        if (item != null) {
            dataSeries.add(simpleDateFormat.format(item.getEmbeddedId().getCreatedDate()), item.getHits());
        }
    }
    series.addSeries(new XYseries().setLabel(PAGE_RANK));
    dataSeries.newSeries();
    for (final ViewApplicationActionEventPageElementDailySummary item : list) {
        if (item != null) {
            dataSeries.add(simpleDateFormat.format(item.getEmbeddedId().getCreatedDate()), item.getRank());
        }
    }
    addChart(content, "Page element Action Events daily Summary", new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsXYDateFloatLogYAxisLegendOutside(series)).show(), true);
}
Also used : DataSeries(org.dussan.vaadin.dcharts.data.DataSeries) Series(org.dussan.vaadin.dcharts.options.Series) ViewApplicationActionEventPageElementDailySummary(com.hack23.cia.model.internal.application.data.impl.ViewApplicationActionEventPageElementDailySummary) DataSeries(org.dussan.vaadin.dcharts.data.DataSeries) DCharts(org.dussan.vaadin.dcharts.DCharts) XYseries(org.dussan.vaadin.dcharts.base.elements.XYseries) SimpleDateFormat(java.text.SimpleDateFormat)

Example 2 with XYseries

use of org.dussan.vaadin.dcharts.base.elements.XYseries in project cia by Hack23.

the class AdminChartDataManagerImpl method createApplicationActionEventPageDailySummaryChart.

@Override
public void createApplicationActionEventPageDailySummaryChart(final AbstractOrderedLayout content) {
    final Map<String, List<ViewApplicationActionEventPageDailySummary>> map = getApplicationActionEventPageDailySummaryMap();
    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<ViewApplicationActionEventPageDailySummary>> entry : map.entrySet()) {
        if (entry.getKey() != null) {
            series.addSeries(new XYseries().setLabel(entry.getKey()));
            dataSeries.newSeries();
            final List<ViewApplicationActionEventPageDailySummary> list = entry.getValue();
            for (final ViewApplicationActionEventPageDailySummary viewRiksdagenVoteDataBallotPartySummaryDaily : list) {
                if (viewRiksdagenVoteDataBallotPartySummaryDaily != null) {
                    dataSeries.add(simpleDateFormat.format(viewRiksdagenVoteDataBallotPartySummaryDaily.getEmbeddedId().getCreatedDate()), viewRiksdagenVoteDataBallotPartySummaryDaily.getHits());
                }
            }
        }
    }
    addChart(content, "Application Action Events daily Summary", new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsXYDateFloatLogYAxisLegendOutside(series)).show(), true);
}
Also used : DataSeries(org.dussan.vaadin.dcharts.data.DataSeries) Series(org.dussan.vaadin.dcharts.options.Series) List(java.util.List) DataSeries(org.dussan.vaadin.dcharts.data.DataSeries) ViewApplicationActionEventPageDailySummary(com.hack23.cia.model.internal.application.data.impl.ViewApplicationActionEventPageDailySummary) DCharts(org.dussan.vaadin.dcharts.DCharts) XYseries(org.dussan.vaadin.dcharts.base.elements.XYseries) SimpleDateFormat(java.text.SimpleDateFormat)

Example 3 with XYseries

use of org.dussan.vaadin.dcharts.base.elements.XYseries in project cia by Hack23.

the class BallotChartDataManagerImpl method createChart.

@Override
public void createChart(final Tab tab, final AbstractOrderedLayout content, final List<ViewRiksdagenVoteDataBallotPartySummary> partyList) {
    final DataSeries dataSeries = new DataSeries();
    final Series series = new Series();
    series.addSeries(new XYseries().setLabel("Yes"));
    series.addSeries(new XYseries().setLabel("No"));
    series.addSeries(new XYseries().setLabel("Abstain"));
    series.addSeries(new XYseries().setLabel("Absent"));
    String caption = null;
    for (final ViewRiksdagenVoteDataBallotPartySummary viewRiksdagenVoteDataBallotPartySummary : partyList) {
        if (caption == null) {
            caption = "Party Summary : " + viewRiksdagenVoteDataBallotPartySummary.getEmbeddedId().getIssue() + " " + viewRiksdagenVoteDataBallotPartySummary.getEmbeddedId().getConcern();
            content.setCaption(caption);
            tab.setCaption(caption);
        }
        dataSeries.newSeries().add(getPartyName(viewRiksdagenVoteDataBallotPartySummary.getEmbeddedId().getParty()), viewRiksdagenVoteDataBallotPartySummary.getPartyYesVotes()).add(getPartyName(viewRiksdagenVoteDataBallotPartySummary.getEmbeddedId().getParty()), viewRiksdagenVoteDataBallotPartySummary.getPartyNoVotes()).add(getPartyName(viewRiksdagenVoteDataBallotPartySummary.getEmbeddedId().getParty()), viewRiksdagenVoteDataBallotPartySummary.getPartyAbstainVotes()).add(getPartyName(viewRiksdagenVoteDataBallotPartySummary.getEmbeddedId().getParty()), viewRiksdagenVoteDataBallotPartySummary.getPartyAbsentVotes());
    }
    addChart(content, caption + " ( 4 circles Yes/No/Abstain/Absent votes by party )", new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsDonoutChartWithSeries(series)).show(), true);
}
Also used : DataSeries(org.dussan.vaadin.dcharts.data.DataSeries) Series(org.dussan.vaadin.dcharts.options.Series) ViewRiksdagenVoteDataBallotPartySummary(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPartySummary) DataSeries(org.dussan.vaadin.dcharts.data.DataSeries) DCharts(org.dussan.vaadin.dcharts.DCharts) XYseries(org.dussan.vaadin.dcharts.base.elements.XYseries)

Example 4 with XYseries

use of org.dussan.vaadin.dcharts.base.elements.XYseries in project cia by Hack23.

the class DecisionChartDataManagerImpl method createDecisionTypeChart.

@Override
public void createDecisionTypeChart(final AbstractOrderedLayout content) {
    final Map<String, List<ViewRiksdagenCommitteeDecisionTypeDailySummary>> map = getCommitteeDecisionTypeMap();
    final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DD_MMM_YYYY, Locale.ENGLISH);
    final DataSeries dataSeries = new DataSeries();
    final Series series = new Series();
    for (final Entry<String, List<ViewRiksdagenCommitteeDecisionTypeDailySummary>> entry : map.entrySet()) {
        if (entry.getKey() != null) {
            series.addSeries(new XYseries().setLabel(entry.getKey()));
            dataSeries.newSeries();
            final List<ViewRiksdagenCommitteeDecisionTypeDailySummary> list = entry.getValue();
            for (final ViewRiksdagenCommitteeDecisionTypeDailySummary item : list) {
                if (item != null) {
                    dataSeries.add(simpleDateFormat.format(item.getEmbeddedId().getDecisionDate()), item.getTotal());
                }
            }
        }
    }
    addChart(content, "Decision type daily summary", new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsXYDateFloatLegendInsideOneColumn(series)).show(), true);
}
Also used : DataSeries(org.dussan.vaadin.dcharts.data.DataSeries) Series(org.dussan.vaadin.dcharts.options.Series) ViewRiksdagenCommitteeDecisionTypeDailySummary(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeDecisionTypeDailySummary) List(java.util.List) DataSeries(org.dussan.vaadin.dcharts.data.DataSeries) DCharts(org.dussan.vaadin.dcharts.DCharts) XYseries(org.dussan.vaadin.dcharts.base.elements.XYseries) SimpleDateFormat(java.text.SimpleDateFormat)

Example 5 with XYseries

use of org.dussan.vaadin.dcharts.base.elements.XYseries 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

XYseries (org.dussan.vaadin.dcharts.base.elements.XYseries)19 DCharts (org.dussan.vaadin.dcharts.DCharts)13 DataSeries (org.dussan.vaadin.dcharts.data.DataSeries)13 Series (org.dussan.vaadin.dcharts.options.Series)13 List (java.util.List)11 SimpleDateFormat (java.text.SimpleDateFormat)9 ViewRiksdagenVoteDataBallotPartySummaryDaily (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPartySummaryDaily)3 GovernmentBodyAnnualSummary (com.hack23.cia.service.external.esv.api.GovernmentBodyAnnualSummary)2 ParseException (java.text.ParseException)2 ArrayList (java.util.ArrayList)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 Country (com.hack23.cia.model.external.worldbank.data.impl.Country)1 WorldBankData (com.hack23.cia.model.external.worldbank.data.impl.WorldBankData)1 ViewRiksdagenCommitteeDecisionTypeDailySummary (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeDecisionTypeDailySummary)1 ViewRiksdagenCommitteeDecisionTypeOrgDailySummary (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeDecisionTypeOrgDailySummary)1 ViewRiksdagenVoteDataBallotPartySummary (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPartySummary)1 ViewRiksdagenVoteDataBallotPoliticianSummaryDaily (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPoliticianSummaryDaily)1 ViewRiksdagenDocumentTypeDailySummary (com.hack23.cia.model.internal.application.data.document.impl.ViewRiksdagenDocumentTypeDailySummary)1 ViewRiksdagenOrgDocumentDailySummary (com.hack23.cia.model.internal.application.data.document.impl.ViewRiksdagenOrgDocumentDailySummary)1 ViewRiksdagenPartyDocumentDailySummary (com.hack23.cia.model.internal.application.data.document.impl.ViewRiksdagenPartyDocumentDailySummary)1