Add support for percentages in the Pivot Grid, so a user can see the percentages just like in the AQReport
|
63 KB
|
9 KB
We could add to CPivotTablePane something like :
protected DataTable createDataTable() { return new DataTable(this) { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component component = super.getCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (component instanceof JComponent) { ((JComponent) component).setToolTipText("test"); } return component; } }; }
The Jide Pivot Table is displayed in PivotTablePaneView.java.
Anytime the user changes fields or sorts, the pivot table calls several event methods (fieldsUpdate(), bothHeadersUpdated(), etc). We've overridden these methods to call refreshChart(), which loads the updated pivot table data into the chart.
refreshChart() would be a good place to put code that needs to handle changes to the pivot table data.
However, if you just want to calculate the percentage on-the-fly, you probably won't need to do anything when the data changes. For example, if the percentage is calculated based on the current cell divided by the total for the column, then you could calculate that in getTableCellRendererComponent or in JTable.prepareRenderer or in a mouse move listener.
The Jide Pivot Table is displayed in PivotTablePaneView.java.
Anytime the user changes fields or sorts, the pivot table calls several event methods (fieldsUpdate(), bothHeadersUpdated(), etc). We've overridden these methods to call refreshChart(), which loads the updated pivot table data into the chart.
refreshChart() would be a good place to put code that needs to handle changes to the pivot table data.
However, if you just want to calculate the percentage on-the-fly, you probably won't need to do anything when the data changes. For example, if the percentage is calculated based on the current cell divided by the total for the column, then you could calculate that in getTableCellRendererComponent or in JTable.prepareRenderer or in a mouse move listener.
Initial rough implementation checked in as SVN #29677, but commented out. It is best if Fung completes this by applying the logic from CorePivotGridHelper.generatePivotDataPercentage()
Initial rough implementation checked in as SVN #29677, but commented out. It is best if Fung completes this by applying the logic from CorePivotGridHelper.generatePivotDataPercentage()
A pivot cell will have percentage tooltip enabled if all of the followings are true:
(1) Pivot Options dialog: 'Show Total' check box is checked.
(2) If it is not an intersection of a grand total row and a grand total column.
Format:
(a) Grand total row: ">N%"
(b) Grand total column: "^M%"
(c) Non-grand total cell: ">N / ^M%"
A pivot cell will have percentage tooltip enabled if all of the followings are true:
(1) Pivot Options dialog: 'Show Total' check box is checked.
(2) If it is not an intersection of a grand total row and a grand total column.
Format:
(a) Grand total row: ">N%"
(b) Grand total column: "^M%"
(c) Non-grand total cell: ">N / ^M%"
Issue #6291 |
Closed |
Fixed |
Resolved |
Completion |
No due date |
Fixed Build trunk/29725 |
No time estimate |
We could add to CPivotTablePane something like :