I was thinking about doing something like this:

function drawJoin() {
  var dt = google.visualization.arrayToDataTable([
    ['Department Number', 'First Name', 'Last Name', 'Sales'],
    [1,                      'john',      'doe',       10],
    [1,                      'jane',      'doe',       100],
    [3,                      'jill',     'jones',      50],
    [3,                      'jack',     'janes',      75],
    [5,                      'al',    'weisenheimer',  500]
  ]);

  // Group dt by column 0, and show column 3 aggregated by sum.
  var grouped_dt = google.visualization.data.group(
      dt, [0, 2],
    [ 
      {'column': 1, 'aggregation': function(ar) { return ar.toString() }, 
'type': 'string'}, 
      {'column': 3, 'aggregation': google.visualization.data.sum, 'type': 
'number'}
    ]);


  var table = new google.visualization.Table(document.getElementById('table'
));
  table.draw(dt, null);

  var grouped_table = new google.visualization.Table(document.getElementById
('grouped_table'));
  grouped_table.draw(grouped_dt, null);
}
​
Will this sort of thing work if I have tooltips/things with roles? Do I 
process them like all the other columns?

On Tuesday, August 14, 2012 10:55:40 PM UTC-4, asgallant wrote:
>
> You can group by any column you want.  What would you like the dataTable 
> to look like after grouping?  Alternatively, what do you want to do with 
> the grouped data?
>
> On Tuesday, August 14, 2012 9:05:32 PM UTC-4, API Developer wrote:
>>
>> Hey guys,
>>
>> Do you know if it's possible to keep the domain the same if you want to 
>> group based off another variable entirely?
>> My data looks like this:
>> var data = google.visualization.arrayToDataTable([
>>       ['ID', 'Life Expectancy', 'Fertility Rate', 'Region',     
>> 'Population'],
>>       ['CAN',    80.66,              1.67,      'North America',  
>> 33739900],
>>       ['DEU',    79.84,              1.36,      'Europe',         
>> 81902307],
>>       ['DNK',    78.6,               1.84,      'Europe',         5523095
>> ],
>>       ['EGY',    72.73,              2.78,      'Middle East',    
>> 79716203],
>>       ['GBR',    80.05,              2,         'Europe',         
>> 61801570],
>>       ['IRN',    72.49,              1.7,       'Middle East',    
>> 73137148],
>>       ['IRQ',    68.09,              4.77,      'Middle East',    
>> 31090763],
>>       ['ISR',    81.55,              2.96,      'Middle East',    7485600
>> ],
>>       ['RUS',    68.6,               1.54,      'Europe',         
>> 141850000],
>>       ['USA',    78.09,              2.05,      'North America',  
>> 307007000]
>>     ]);
>>
>> I want to do a group on Region, is this possible.
>>
>> If not, is there anything I can do so I can keep a list of the ID's that 
>> would go under the region?
>> --My plan would be to make it so it shows in the tooltips
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/5ZbH1EjgQ0QJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to