DynamicReportBuilder drb = new DynamicReportBuilder();
//ReportBuilder initialization
//Group and columns creation
DJChartBuilder cb = new DJChartBuilder(); // create a chart builder
DJChart chart = cb.addType(DJChart.PIE_CHART) // define the type of chart (Pie)
.setOperation(DJChart.CALCULATION_SUM) // define the type of operation to be done
.setColumnsGroup(g1) // define the group that will enclose values
.setColumn(columnAmount) // define the column used for series and categories
.build();
drb.addChart(chart); //add the chart to the dynamic report
DJChartBuilder is the builder class, very convenient. To create a chart these parameters are needed
Refer to ChartReportTest for a working example.
Also refer to ChartReportTest2 for a multiple series chart working example.
This code generate a report like this:
