How to interact with a table in a dashboard?

190 views
Skip to first unread message

byteME

unread,
Aug 13, 2012, 4:45:50 PM8/13/12
to google-visua...@googlegroups.com
When I run the code below I get an error - Uncaught TypeError: Object #<X> has no method 'getSelection'

Any idea how I can interact with a table drawn within a dashboard.. Thanks..

/----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

      var dashboard, table, data;
 
 function drawVisualization() {
        
var array = new Array(['ticker','time','bid','open','high','low','volume']);
var ticker, time, bid, open, high, low, volume;
$.get('php/getdata.php', {input: 'stocklist'}, function(data1){
$.each(data1, function(index, value){
ticker = value.ticker;
time = value.time;
bid = parseFloat(value.bid);
open = parseFloat(value.open);
high = parseFloat(value.high);
low = parseFloat(value.low);
volume = parseFloat(value.volume);
array.push([ticker, time, bid, open, high, low, volume]);
});
        data = google.visualization.arrayToDataTable(array);

        var stringFilter = new google.visualization.ControlWrapper({
          'controlType': 'StringFilter',
          'containerId': 'control1',
          'options': {
            'filterColumnLabel': 'ticker'
          }
        });

        table = new google.visualization.ChartWrapper({
          'chartType': 'Table',
          'containerId': 'chart1',
          'options': {'showRowNumber': false, 'height': '130px', 'width': '1000px'}
        });

        dashboard = new google.visualization.Dashboard(document.getElementById('dashboard'))
dashboard.bind(stringFilter, table);
dashboard.draw(data);
 
google.visualization.events.addListener(table, 'select', selectHandler);
      }, "json");
 }
 
 function selectHandler() {
var selection = table.getSelection();
      alert();
    }
      
      google.setOnLoadCallback(drawVisualization);
 
 
  

Jinji

unread,
Aug 14, 2012, 7:09:46 AM8/14/12
to google-visua...@googlegroups.com
As you can see from ChartWrapper's documentation, it doesn't support the getSelection function. Specifically, see ChartWrapper's 'select' event: "To learn what has been selected, call ChartWrapper.getChart().getSelection()"

 
 
  

--
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/-/1RIjEKYPhlkJ.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.

Reply all
Reply to author
Forward
0 new messages