Sorry if this question seems long. I've been struggling with this for 
awhile now and I want to be as clear as possible.

I have a dashboard that is hooked to a DataTable(lots of data in it), one 
TableChart and multiple controls. I also have a pie chart I draw separately 
from the dashboard. The reason it is separate is so I can perform an 
aggregation function on my data and feed the result to my pie chart. 
Upon filtering, the TableChart automatically updates of course. In 
addition, I have an event set as follows: 

    drawOnReady = google.visualization.events.addListener(dashboard,'ready',
function() {
    // get DataTable that is fed to table after filtering
    var tableView = tableChart.getDataTable(); 
    // get sum of grouped columns
    var grouped_data = google.visualization.data.group(tableView, [1], [{
'column':columnView, 'aggregation':google.visualization.data.sum, 'type': 
'number'}]);
    // update the pie chart and draw
    myChart.setDataTable(grouped_data);
        myChart.draw()



This makes it so every time I filter something, from the data table hooked 
up to my dashboard, the changes get applied to my pie chart as well.

(Anyone looking for more info on this trick heres a link:
http://stackoverflow.com/questions/6397270/google-dashboard-with-filters-from-grouped-data-how-to-chart-grouped-data?rq=1
)

Now I am trying to create a ScatterChart and employ the same method. 
A small sample of my data looks like this:


    Year     Modality     Study Count
    1997      OT              5
    1997      CR              10
    1997      MR              4
    1998      OT              11
    1998      CR              7
    1998      MR              15
    1999      OT              9
    1999      CR              18
    1999      MR              2


I need to get it to look like this:

    Year    OT     CR    MR
    1997    5      10    4
    1998    11     7     15
    1999    9      18    2

I was going to write a for loop through the filtered DataTable, but the 
filtered DataTable looks odd. 
I ran  object = JSON.parse(tableView.toJSON()) in my console. Here's a 
snippet of what I object looked like:

    Object {columns: Array[22], rows: Array[456]}
        -> columns: Array[22]
             0: 0
             1: 1
             2: 2


As you can see, there seems to be no data. 
So now I'm turning to google.visualization methods for manipulating data (
https://developers.google.com/chart/interactive/docs/reference#data-manipulation-methods),
 
but I've had very little luck with it so far. 
Can anyone give me some insight into why `tableView' (the filtered 
DataTable) looks the way it does, or lend me a hand with using one of 
googles method to get the data formatted the way I want?
Also, does anyone know how to convert a DataTable to an array(a possible 
solution to my problem if the array comes out with data)?

Thanks in advance!

Isaiah

-- 
You received this message because you are subscribed to the Google Groups 
"Google Chart API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-chart-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-chart-api@googlegroups.com.
Visit this group at http://groups.google.com/group/google-chart-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to