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);
}
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);
}
Aggregations