I'm working on a site that is calling data from a published Google
Spreadsheet to create multiple visualizations. This, amazingly enough,
was working until I checked today, but now, sadly it isn't.

It seems I need help finding the correct way to:

- load data from a published Google Spreadsheet
- load multiple visualization charts
- load multiple packages


This is the javascript that I am using:

<pre>
google.load("visualization", "1", {packages: ['corechart','table']});
google.setOnLoadCallback(initialize);

function initialize() {

        // portfolio1countries
        var query = new google.visualization.Query('https://
spreadsheets.google.com/ccc?
key=0Am2NmLZ6G0QpdGNiaUJIUmh6TFgwNTFxN2Rob25zRWc&headers=1&range=A26:B45&gid=0&pub=1');
        query.send(portfolio1countries);

        // portfolio1sectors
        var query = new google.visualization.Query('https://
spreadsheets.google.com/ccc?
key=0Am2NmLZ6G0QpdGNiaUJIUmh6TFgwNTFxN2Rob25zRWc&headers=1&range=G26:H43&gid=0&pub=1');
        query.send(portfolio1sectors);

        // portfolio2countries
        var query = new google.visualization.Query('https://
spreadsheets.google.com/ccc?
key=0Am2NmLZ6G0QpdGNiaUJIUmh6TFgwNTFxN2Rob25zRWc&headers=1&range=C26:D45&gid=0&pub=1');
        query.send(portfolio2countries);

        // portfolio2sectors
        var query = new google.visualization.Query('https://
spreadsheets.google.com/ccc?
key=0Am2NmLZ6G0QpdGNiaUJIUmh6TFgwNTFxN2Rob25zRWc&headers=1&range=I26:J43&gid=0&pub=1');
        query.send(portfolio2sectors);

        // portfolio3countries
        var query = new google.visualization.Query('https://
spreadsheets.google.com/ccc?
key=0Am2NmLZ6G0QpdGNiaUJIUmh6TFgwNTFxN2Rob25zRWc&headers=1&range=E26:F45&gid=0&pub=1');
        query.send(portfolio3countries);

        // portfolio3sectors
        var query = new google.visualization.Query('https://
spreadsheets.google.com/ccc?
key=0Am2NmLZ6G0QpdGNiaUJIUmh6TFgwNTFxN2Rob25zRWc&headers=1&range=K26:L43&gid=0&pub=1');
        query.send(portfolio3sectors);

        // portfoliolinechart
        var query = new google.visualization.Query('https://
spreadsheets.google.com/ccc?
key=0Am2NmLZ6G0QpdGNiaUJIUmh6TFgwNTFxN2Rob25zRWc&headers=1&range=A24:D30&gid=1&pub=1');
        query.send(portfoliolinechart);

        // portfoliotablechart
        var query = new google.visualization.Query('https://
spreadsheets.google.com/ccc?
key=0Am2NmLZ6G0QpdGNiaUJIUmh6TFgwNTFxN2Rob25zRWc&headers=1&range=A8:D23&gid=1&pub=1');
        query.send(portfoliotablechart);

}

function portfolio1countries(response) {
        if (response.isError()) {
                alert("Error in query")
        }
        var dataportfolio1countries = response.getDataTable();
        var chartportfolio1countries = new
google.visualization.PieChart(document.getElementById('portfolio1countries'));
        chartportfolio1countries.draw(dataportfolio1countries, {title:
"Portfolio 1 Countries", width: 500, height: 350, 'legend':
'right', reverseCategories: false, is3D: false});
}

function portfolio1sectors(response) {
        if (response.isError()) {
                alert("Error in query")
        }
        var dataportfolio1sectors = response.getDataTable();
        var chartportfolio1sectors = new
google.visualization.PieChart(document.getElementById('portfolio1sectors'));
        chartportfolio1sectors.draw(dataportfolio1sectors, {title: "Portfolio
1 Sectors", width: 500, height: 350, 'legend':
'right', reverseCategories: false, is3D: false});
}

function portfolio2countries(response) {
        if (response.isError()) {
                alert("Error in query")
        }
        var dataportfolio2countries = response.getDataTable();
        var chartportfolio2countries = new
google.visualization.PieChart(document.getElementById('portfolio2countries'));
        chartportfolio2countries.draw(dataportfolio2countries, {title:
"Portfolio 2 Countries", width: 500, height: 350, 'legend':
'right', reverseCategories: false, is3D: false});
}

function portfolio2sectors(response) {
        if (response.isError()) {
                alert("Error in query")
        }
        var dataportfolio2sectors = response.getDataTable();
        var chartportfolio2sectors = new
google.visualization.PieChart(document.getElementById('portfolio2sectors'));
        chartportfolio2sectors.draw(dataportfolio2sectors, {title: "Portfolio
2 Sectors", width: 500, height: 350, 'legend':
'right', reverseCategories: false, is3D: false});
}

function portfolio3countries(response) {
        if (response.isError()) {
                alert("Error in query")
        }
        var dataportfolio3countries = response.getDataTable();
        var chartportfolio3countries = new
google.visualization.PieChart(document.getElementById('portfolio3countries'));
        chartportfolio3countries.draw(dataportfolio3countries, {title:
"Portfolio 3 Countries", width: 500, height: 350, 'legend': 'right',
reverseCategories: false, is3D: false});
}

function portfolio3sectors(response) {
        if (response.isError()) {
                alert("Error in query")
        }
        var dataportfolio3sectors = response.getDataTable();
        var chartportfolio3sectors = new
google.visualization.PieChart(document.getElementById('portfolio3sectors'));
        chartportfolio3sectors.draw(dataportfolio3sectors, {title: "Portfolio
3 Sectors", width: 500, height: 350, 'legend': 'right',
reverseCategories: false, is3D: false});
}

function portfoliolinechart(response) {
        if (response.isError()) {
                alert("Error in query")
        }
        var dataportfoliolinechart = response.getDataTable();
        var chartportfoliolinechart = new
google.visualization.LineChart(document.getElementById('portfoliolinechart'));
        chartportfoliolinechart.draw(dataportfoliolinechart, {title:
"Performance of initially investing $10k", width: 600, height: 371,
legend: 'right', reverseCategories: true, is3D: false, allowCollapse:
true, reverseAxis: true, hasLabelsColumn: true});
}

function portfoliotablechart(response) {
        if (response.isError()) {
                alert("Error in query")
        }
        var dataportfoliotablechart = response.getDataTable();
        var chartportfoliotablechart = new
google.visualization.Table(document.getElementById('portfoliotablechart'));
        chartportfoliotablechart.draw(dataportfoliotablechart, {width: 400,
height: 475, legend: 'right', labelPosition: 'right', hasLabelsColumn:
true, allowHtml: true});
}
</pre>

That is all.

Brad








-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to