To access DataTable elements

36 views
Skip to first unread message

sanj

unread,
Jun 12, 2012, 5:12:46 PM6/12/12
to google-visua...@googlegroups.com
Hi All,

I am trying to display a line of text with a particular member in a the DataTable that is used to draw a visualization.

For Example:
I want to display a string at the bottom of the chart that says:

In 2008 Germany's Coffee Consumption was 19830493 

This is how far I got with the extra code needed to do this, but I am having difficulty passing this data through the DOM.
........
        var textdata 'In 2008 Germany's Coffee Consumption was' data.[5,5];
        document.getElementById('txt') textdata; 
........

  <body style="font-family: Arial;border: 0 none;">
    <div id="visualization" style="width: 600px; height: 400px;"></div>
    <div id="txt"</div>

  </body> 

Any help in this issue is very much appreciated.

Thank you,

asgallant

unread,
Jun 12, 2012, 5:18:26 PM6/12/12
to google-visua...@googlegroups.com
What you want to use is the DataTable's #getValue method.  To get Germany's value from 2008 in that example, you would use:

// 2008 is row 5, Germany is column 6
var textdata "In 2008 Germany's Coffee Consumption was" data.getValue(56);
document.getElementById('txt').innerHTML textdata;

sanj

unread,
Jun 12, 2012, 5:32:08 PM6/12/12
to google-visua...@googlegroups.com
Thank you, it works fine now.
Reply all
Reply to author
Forward
0 new messages