Okay so I can not seem to find the literature on the VIEW aspect/option.
Can I use it for tableCharts? Can I use it to distinguish between two
separate tables in a spreadsheet in the same dataset? Or must I have two
separate datasets/queries in the same dashboard? How would I accomplish
such a thing?
I saw the example for 'view' in the pieChart part of the Dashboard
documentation, but could not find the corresponding write up with more
details on 'view'. I have my table properly functioning, in JSFiddle and
the source spreadsheet, but added another table to the source spreadsheet
that I would like to use specifically for a pieChart on the same Dashboard.
I tried expanding my queryString to include the additional columns (N,O)
then changed my &range=A1:F25 to A1:O25, to accommodate the new table
further in the spreadsheet. Adding in the 'view': {'columns': []} to the
table and piechart to account each using a specific column range. None of
that worked.
*note* The new table in my source Google Spreadsheet is generated by a
QUERY(), if that changes anything.
My original code, that works, is as follows (the pieChart doesn't display
the information I want but pops up, whenever I add the 'view' clause it
doesn't show up at all):
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<div id='dashboard_div'>
<div id='chart_div'></div>
<p></p>
<div id='table_div'></div>
<div id='control_div'></div>
</div>
google.load('visualization', '1.0',
{'packages': ['table', 'controls']});
google.setOnLoadCallback(queryData);
function queryData()
{
var queryString = encodeURIComponent('SELECT A,B,C,D,E,F');
var gidInfoRange = '/gviz/tq?gid=2013544456&headers=1&range=A1:F25&tq=';
var query = new google.visualization.Query(
'personalLink' + gidInfoRange + queryString);
query.send(handleQueryResponse);
};
function handleQueryResponse(response)
{
if (response.isError())
{
alert('Error in query: ' + response.getMessage() + ' ' +
response.getDetailedMessage());
return;
}
var data = response.getDataTable();
var dashboard = new google.visualization.Dashboard(
document.getElementById('dashboard_div'));
var tableCategoryFilter = new google.visualization.ControlWrapper({
'controlType': 'CategoryFilter',
'containerId': 'control_div',
'options': {
'filterColumnIndex': 0
}
});
//Define Table from spreadsheet data
var tableChart = new google.visualization.ChartWrapper({
'chartType': 'Table',
'containerId': 'table_div'
});
//Define first chart (material bar Chart)
var pieChart = new google.visualization.ChartWrapper({
'chartType': 'PieChart',
'containerId': 'chart_div',
'options': {
'width': 300,
'height': 300,
'pieSliceText': 'value'
}
});
dashboard.bind([tableCategoryFilter],[tableChart]);
dashboard.draw(data);
};
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/47763d87-e814-4aff-82ef-f51ee7bb484d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.