public interface PivotTable extends ReportComponent
Pivot Table interface
A pivot table has a layout like:
Males | Females | ||||||
Region | Country | Elephants | Rhinos | Squirrels | Elephants | Rhinos | Squirrels |
North | Sweden | 1000 | 10 | 4 | 1 | 0 | 0 |
Norway | 0 | 100 | 0 | 0 | 0 | 0 | |
South | Italy | 2000 | 0 | 0 | 0 | 0 | 0 |
East | Romania | 0 | 0 | 0 | 0 | 200 | 0 |
West | France | 300 | 0 | 3000 | 30 | 0 | 0 |
The pivot table accepts all settings of a FlatTable
(input, data columns, group columns, sorting values) and it introduces
two more mandatory settings: .
The typical usage is:
PivotTable table = new PivotTableBuilder(new TextTableInput("./input/expenses.csv", ",")) .addDataColumn(new DefaultDataColumn("Month",0)) .addHeaderRow(new DefaultPivotHeaderRow(1)) .pivotData(new DefaultPivotData(2)) .build(); Report report = new ReportBuilder(new DefaultReportOutput(new FileWriter("/tmp/report.html"))); report.add(table); report.execute();but the pivot table can be also used without a report:
PivotTable table = new PivotTableBuilder(new TextTableInput("./input/expenses.csv", ",")) .addDataColumn(new DefaultDataColumn("Month",0)) .addHeaderRow(new DefaultPivotHeaderRow(1)) .pivotData(new DefaultPivotData(2)) .build(); ReportOutput reportOutput = new DefaultReportOutput(new FileWriter("/tmp/testFlatTable.html")) reportOutput.open(); flatTable.output(table); reportOuptut.close();
PivotTableBuilder
,
TableInput
,
DataColumn
,
GroupColumn
,
PivotData
,
PivotHeaderRow
,
ReportOutput
output
Copyright © 2006–2015. All rights reserved.