Hi,

    I’m using the Google Visualization API to make data summarization
and I found an unusual behavior from the function
google.visualization.data.group. It is adding values which shouldn’t
be added. First, I thought it could be an error in my application, but
I managed to replicate the behavior using the Code Playground (http://
code.google.com/apis/ajax/playground/?type=visualization#group). The
code is the following:

function drawJoin() {
  var dt = new google.visualization.DataTable();
  dt.addColumn('string', 'field');
  dt.addColumn('number', 'a');
  dt.addColumn('number', 'b');
  dt.addColumn('number', 'c');
  dt.addColumn('number', 'd');
  dt.addColumn('number', 'e');
  dt.addColumn('number', 'f');
  dt.addRow(['a', 1, 3, 5, 7, 9, 11]);
  dt.addRow(['b', 2, 4, 6, 8, 10, 12]);

  // Group dt by column 0, and show column 3 aggregated by sum.
  var grouped_dt = google.visualization.data.group(
      dt, [0],
      [{'column': 1, 'aggregation': google.visualization.data.sum,
'type': 'number'},
       {'column': 2, 'aggregation': google.visualization.data.sum,
'type': 'number'},
       {'column': 3, 'aggregation': google.visualization.data.sum,
'type': 'number'},
       {'column': 4, 'aggregation': google.visualization.data.sum,
'type': 'number'},
       {'column': 5, 'aggregation': google.visualization.data.sum,
'type': 'number'},
       {'column': 6, '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);
}

Check the values in the second row of the second table. Am I missing
something or is this really a bug?

Cheers,

Fred

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
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