table displaying

48 views
Skip to first unread message

sk

unread,
May 24, 2012, 3:51:29 AM5/24/12
to google-visua...@googlegroups.com
hi
i want to display the details of the state in table if we click on the particular state of the geochart by using select events
plz help me

asgallant

unread,
May 24, 2012, 9:10:48 AM5/24/12
to google-visua...@googlegroups.com
Sure, you can do this.  You'll need to hook up a 'select' event listener for the GeoChart that gets the state and filters the data used to draw the Table:

/*
 *  assumes:
 *    data is the DataTable used to draw the GeoChart
 *    tableData is the DataTable containing the data for the state
 *    state is in column 0 in both tables
 *    tableView is a DataView based on tableData, used to draw the Table
 *
 *  this can be simplified a bit if the DataTable used for the Table  
 *  is the same one used for the GeoChart
 */
google.visualization.events.addListener(geochart'select'function ({
    var row geochart.getSelection()[0].row;
    var state data.getValue(row0);
    var rows tableData.getFilteredRows([{column0valuestate}]);
    tableView.setRows(rows);
    table.draw(tableViewoptions);
}); 
Reply all
Reply to author
Forward
0 new messages