tree table

29 views
Skip to first unread message

Marco Megna

unread,
Oct 11, 2011, 5:46:11 AM10/11/11
to google-visua...@googlegroups.com
is possible do something like that
on a table?
 
i mean, imagine a table like this:
 
var data = new google.visualization.DataTable(); 
        data
.addColumn('string', 'Name'); 
        data
.addColumn('number', 'Salary');
        data
.addColumn('boolean', 'Full Time Employee');
        data.addColumn('string', 'type'); 
        data.addRows(4); 
        data
.setCell(0, 0, 'Mike'); 
        data
.setCell(0, 1, 10000, '$10,000'); 
        data
.setCell(0, 2, true);
        data.setCell(0, 3, 'type1');
        data.setCell(1, 0, 'Jim'); 
        data
.setCell(1, 1, 8000, '$8,000'); 
        data
.setCell(1, 2, false); 
        data.setCell(1, 3, 'type2');
data
.setCell(2, 0, 'Alice'); 
        data
.setCell(2, 1, 12500, '$12,500'); 
        data
.setCell(2, 2, true);
        data.setCell(2, 3, 'type1');
         data
.setCell(3, 0, 'Bob'); 
        data
.setCell(3, 1, 7000, '$7,000'); 
        data.setCell(3, 2, true); 
        data.setCell(3, 3, 'type2');
 
i want to group the row with the same "type" value. At first i wanna see only 2 rows (even with subtotal...like the sum of salary for type1 and type2), then when i click on one of them, i see the "sub-rows". In this case i click on type1 and i see "mike" and "alice" rows.
 
would be the top if when i click on the header of one column i could group the rows by the value of that column (like order by column, but instead of order only i could group, and see the subtotal)
 
I hope someone understand my bad english.... :-)
 
Bye,
Marco
 


Reply all
Reply to author
Forward
0 new messages