Hi,
I can't get this to work even if I take a simple barchart example on from
code playground. Dispite adding view: {columns: [0,2,4]} all table columns
are shown.
Any ideas?
function drawVisualization() {
// Create and populate the data table.
var data = google.visualization.arrayToDataTable([
['Year', 'Austria', 'Belgium', 'Czech Republic', 'Finland', 'France',
'Germany'],
['2003', 1336060, 3817614, 974066, 1104797, 6651824,
15727003],
['2004', 1538156, 3968305, 928875, 1151983, 5940129,
17356071],
['2005', 1576579, 4063225, 1063414, 1156441, 5714009,
16716049],
['2006', 1600652, 4604684, 940478, 1167979, 6190532,
18542843],
['2007', 1968113, 4013653, 1037079, 1207029, 6420270,
19564053],
['2008', 1901067, 6792087, 1037327, 1284795, 6240921,
19830493]
]);
// Create and draw the visualization.
new google.visualization.ColumnChart(document.getElementById(
'visualization')).
draw(data,
{title:"Yearly Coffee Consumption by Country",
width:600, height:400,
view: {columns: [0,2,4]},
hAxis: {title: "Year"}}
);
}
Den fredagen den 20:e maj 2011 kl. 15:07:33 UTC+2 skrev Riccardo Govoni:
>
> That won't really work. If i understand correctly, he is trying to
> assemble a dashboard where the controls use some columns
> (manufacturer,region) while the charts require some other (region should be
> exclude), but the controls and chart should still be bound together so that
> playing with the controls updates the chart.
>
> In which case, there's a 'view' setting for the ChartWrapper specification
> that lets you choose which columns should the chart receive, out of a
> possibly wider set of columns powering the entire dashboard.
>
> Something like:
>
> var manuControl = new google.visualization.ControlWrapper({
> controlType: 'CategoryFilter',
> options: {
> filterColumnLabel: 'Manufacturer',
> ...
> });
>
> var regionControl = new google.visualization.ControlWrapper({
> controlType: 'CategoryFilter',
> options: {
> filterColumnLabel: 'Region',
> ...
> });
>
> var chart = new google.visualization.ChartWrapper({
> chartType: 'BarChart',
> options: {
> ... // whatever
> },
> * // skips column 1 "Region". Ensures the chart only gets the chosen
> columns out of the entire datatable*
> * view: {columns: [0, 2, 3, 4]} *
> });
>
> new google.visualization.Dashboard(...).bind([manuControl, regionControl],
> chart).draw(data);
>
> The dashboard gets the entire table. The controls pick their column each.
> The chart picks only the columns it needs to display properly.
>
> Would that work?
> The documentation for the 'view' parameter is not in the chart
> documentation at the moment ( I thought it was there a few days ago), I'm
> looking into this.
>
--
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
http://groups.google.com/group/google-visualization-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.