Search in sources :

Example 1 with DCharts

use of org.dussan.vaadin.dcharts.DCharts in project Activiti by Activiti.

the class ChartComponent method addChart.

public void addChart(String description, Component chart, String errorMessage) {
    addComponent(new Label(" ", Label.CONTENT_XHTML));
    addComponent(new Label(" ", Label.CONTENT_XHTML));
    // Description
    if (description != null) {
        Label label = new Label(description);
        label.addStyleName(Reindeer.LABEL_H2);
        addComponent(label);
        addComponent(new Label(" ", Label.CONTENT_XHTML));
    }
    // Chart
    if (chart != null) {
        if (chart instanceof DCharts) {
            // DCharts doesn't know how to size itself
            chart.setWidth(600, UNITS_PIXELS);
            chart.setHeight(450, UNITS_PIXELS);
            ((DCharts) chart).show();
        }
        addComponent(chart);
    }
    // Error message
    if (errorMessage != null) {
        Label errorLabel = new Label(errorMessage);
        addComponent(errorLabel);
    }
}
Also used : Label(com.vaadin.ui.Label) DCharts(org.dussan.vaadin.dcharts.DCharts)

Example 2 with DCharts

use of org.dussan.vaadin.dcharts.DCharts 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 3 with DCharts

use of org.dussan.vaadin.dcharts.DCharts 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 4 with DCharts

use of org.dussan.vaadin.dcharts.DCharts 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 5 with DCharts

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 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)

Aggregations

DCharts (org.dussan.vaadin.dcharts.DCharts)21 DataSeries (org.dussan.vaadin.dcharts.data.DataSeries)19 Series (org.dussan.vaadin.dcharts.options.Series)18 XYseries (org.dussan.vaadin.dcharts.base.elements.XYseries)16 List (java.util.List)13 SimpleDateFormat (java.text.SimpleDateFormat)12 ViewRiksdagenVoteDataBallotPartySummaryDaily (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPartySummaryDaily)3 DataContainer (com.hack23.cia.service.api.DataContainer)3 AbstractOrderedLayout (com.vaadin.ui.AbstractOrderedLayout)3 Locale (java.util.Locale)3 Map (java.util.Map)3 Entry (java.util.Map.Entry)3 Objects (java.util.Objects)3 Collectors (java.util.stream.Collectors)3 Service (org.springframework.stereotype.Service)3 ViewRiksdagenCommitteeDecisionTypeDailySummary (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeDecisionTypeDailySummary)2 GovernmentBodyAnnualSummary (com.hack23.cia.service.external.esv.api.GovernmentBodyAnnualSummary)2 Label (com.vaadin.ui.Label)2 ArrayList (java.util.ArrayList)2 StringUtils (org.apache.commons.lang.StringUtils)2