Search in sources :

Example 1 with ChartModel

use of com.extjs.gxt.charts.client.model.ChartModel 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

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 PivotChartContent (org.activityinfo.legacy.shared.reports.content.PivotChartContent)1 PivotTableData (org.activityinfo.legacy.shared.reports.content.PivotTableData)1