Search in sources :

Example 1 with PivotChartContent

use of org.activityinfo.legacy.shared.reports.content.PivotChartContent in project activityinfo by bedatadriven.

the class PivotChartGenerator method generate.

@Override
public void generate(User user, PivotChartReportElement element, Filter inheritedFilter, DateRange dateRange) {
    Filter filter = GeneratorUtils.resolveElementFilter(element, dateRange);
    Filter effectiveFilter = inheritedFilter == null ? new Filter(filter, new Filter()) : new Filter(inheritedFilter, filter);
    PivotTableData data = generateData(user.getId(), user.getLocaleObject(), element, effectiveFilter, element.getCategoryDimensions(), element.getSeriesDimensions());
    ScaleUtil.Scale scale = computeScale(element, data);
    PivotChartContent content = new PivotChartContent();
    content.setXAxisTitle(composeXAxisTitle(element));
    content.setYAxisTitle(composeYAxisTitle(element));
    content.setEffectiveFilter(filter);
    content.setFilterDescriptions(generateFilterDescriptions(filter, element.allDimensionTypes(), user));
    content.setYMin(scale.getValmin());
    content.setYStep(scale.getStep());
    content.setData(data);
    element.setContent(content);
}
Also used : Filter(org.activityinfo.legacy.shared.command.Filter) PivotTableData(org.activityinfo.legacy.shared.reports.content.PivotTableData) PivotChartContent(org.activityinfo.legacy.shared.reports.content.PivotChartContent)

Example 2 with PivotChartContent

use of org.activityinfo.legacy.shared.reports.content.PivotChartContent in project activityinfo by bedatadriven.

the class ChartOFCView method show.

/**
 * Updates the view to the given PivotChartContent
 *
 * @param element
 */
@Override
public void show(PivotChartReportElement element) {
    if (isRendered()) {
        el().unmask();
    }
    PivotChartContent content = element.getContent();
    PivotTableData table = element.getContent().getData();
    if (gridPanel != null) {
        gridPanel.show(element);
    }
    List<PivotTableData.Axis> categories = table.getRootRow().getLeaves();
    List<PivotTableData.Axis> series = table.getRootColumn().getLeaves();
    ChartModel cm = new ChartModel();
    cm.setBackgroundColour(TRANSPARENT_BG);
    cm.setNumDecimals(0);
    cm.setDecimalSeparatorComma(true);
    cm.setXAxis(createXAxis(categories));
    cm.setYAxis(createYAxis(content, table));
    switch(element.getType()) {
        case Bar:
        case StackedBar:
        case ClusteredBar:
            addBarSeries(cm, categories, series);
            break;
        case Pie:
            addPieChart(cm, categories, series);
            break;
        case Line:
            addLineSeries(cm, categories, series);
            break;
    }
    setModel(cm);
}
Also used : PivotTableData(org.activityinfo.legacy.shared.reports.content.PivotTableData) ChartModel(com.extjs.gxt.charts.client.model.ChartModel) XAxis(com.extjs.gxt.charts.client.model.axis.XAxis) YAxis(com.extjs.gxt.charts.client.model.axis.YAxis) PivotChartContent(org.activityinfo.legacy.shared.reports.content.PivotChartContent)

Aggregations

PivotChartContent (org.activityinfo.legacy.shared.reports.content.PivotChartContent)2 PivotTableData (org.activityinfo.legacy.shared.reports.content.PivotTableData)2 ChartModel (com.extjs.gxt.charts.client.model.ChartModel)1 XAxis (com.extjs.gxt.charts.client.model.axis.XAxis)1 YAxis (com.extjs.gxt.charts.client.model.axis.YAxis)1 Filter (org.activityinfo.legacy.shared.command.Filter)1