Skip to main content

crosstab/pivot table ideas

No replies
shahbaz
Offline
Joined: 2005-01-16
Points: 0

Hi,
I'm planning on extending or augmenting JTable to allow crosstab/pivot table functionality (which I don't mind submitting to JDNC). If someone has any insight, I'd love to hear it.

First of all, by crosstab I mean the ability to move a number of columns with small cardinality to the column header (x-axis of the table 'grid.') So normally a JTable containing customers, their state of residence, sales attributed to them and their tax might be 4 columns in a table.

[Customer | State | Sales | Tax]

I would like to allow the 'state' column to be dragged to the (perhaps modified) column header which will change the jtable to have one column for customer names, 50 major columns with state names and two sub column saltes,tax for each state (so total of 101 columns).

[ | MI | NJ | NY |...]
[Customer |Sale|Tax |Sale|Tax |Sale|Tax |...]

(formatting is messed up in html!)
(Obviously I'm mainly thinking of Excel's pivot table or crosstabs in statistical packages).

We currently have a JTreeTable which expands a row into detail data, should the same mechanism be used by allowing columns to be expanded? (I mean using the same java method, logically it doesn't make sense to collapse sales and tax into the same column without a great deal of business information available).

Once we have a prototype of this component, I believe a number of simpler extensions (column filters, show/hide columns, etc.) will prove very useful for a growing number of applications.

Thanks, look forward to reading some ideas!

Shahbaz
c_shahbazAThotmailDOTcom