Importing Data from spreadsheet

70 views
Skip to first unread message

Shuvashish Chatterjee

unread,
Oct 24, 2013, 12:18:19 AM10/24/13
to google-visua...@googlegroups.com
Dear All

I am looking for assitance to set up a dashboard with controls which will take in data from a URL.  It will be great if you can point me to an example. 
Thank you in Advance.
rgds

The specific code in my case is : 

function drawVisualization () {
    
    query.setQuery('SELECT A, B, C, D ,E, F ');
    
    query.send(function (response) {        
        if (response.isError()) {
            alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
            return;
        }
        var data = response.getDataTable();
      
      var regionFilter = new google.visualization.ControlWrapper({
    'controlType': 'CategoryFilter',
    'containerId': 'control1',
    'options': {
      'filterColumnLabel': 'Region',
      'ui': {
        'allowTyping': false,
        'allowMultiple': false,
        'selectedValuesLayout': 'belowStacked'
      }
    },
    // Define an initial state, i.e. a set of metrics to be initially selected.
    'state': {'selectedValues': ['India']}
  });

    var yearFilter = new google.visualization.ControlWrapper({
    'controlType': 'CategoryFilter',
    'containerId': 'control2',
    'options': {
      'filterColumnLabel': 'Year',
      'ui': {
        'allowTyping': false,
        'allowMultiple': false,
        'selectedValuesLayout': 'belowStacked'
      }
    },
    // Define an initial state, i.e. a set of metrics to be initially selected.
    'state': {'selectedValues': ['2011']}
  });  
      
   var barChart = new google.visualization.ChartWrapper({
    'chartType': 'ColumnChart',
    'containerId': 'chart1',
    'options': {
      'width': 400,
      'height': 180
    },
    'view': {'columns': [3,4]}
  });
       
  // Create the dashboard.
  var dashboard = new google.visualization.Dashboard(document.getElementById('dashboard')).
    // Configure the category picker to affect the gauge chart
    bind(regionFilter, barChart).
    // Draw the dashboard
    draw(data);
      });

asgallant

unread,
Oct 24, 2013, 1:03:25 AM10/24/13
to google-visua...@googlegroups.com
What is the problem you are having?  Glancing over your code, it looks OK, but I can't test it because your spreadsheet isn't published.
Message has been deleted

Shuvashish Chatterjee

unread,
Oct 24, 2013, 2:38:24 AM10/24/13
to google-visua...@googlegroups.com
Thanks for responding.
I am quite a new to scripts, whwen i publish it as a web app  / run the code i get an error : ReferenceError: "google" is not defined. 

rgds

asgallant

unread,
Oct 24, 2013, 10:12:17 AM10/24/13
to google-visua...@googlegroups.com
You are missing the Google jsapi script tag:

<script type="text/javascript" src="//www.google.com/jsapi"></script>

Shuvashish Chatterjee

unread,
Oct 25, 2013, 1:44:16 AM10/25/13
to google-visua...@googlegroups.com
I tried that, however i still continue to get the same error .. Script

asgallant

unread,
Oct 25, 2013, 9:49:51 AM10/25/13
to google-visua...@googlegroups.com
That is an Apps Script environment, not javascript (Apps Script is based on javascript, but they are not completely compatible).  You will need to consult the Visualization API Apps Script Documentation for instructions on proceeding with this.

Shuvashish Chatterjee

unread,
Oct 25, 2013, 10:18:50 AM10/25/13
to google-visua...@googlegroups.com

Thanks for the info. 
rgds


--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/qFl-PTEzeck/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages