The query returns the value of the cell as calculated by the spreadsheet at
the time of the query - the formula is lost. You either have to manually
recalculate affected cells, or you can use a DataView to create the
calculated column instead of querying it.
Here's an example DataView that creates a third column that contains the
sum of the first two columns:
var view = new google.visualization.DataView(data);
view.setColumns([0, 1, {
type: 'number',
label: 'Sum of columns 0 and 1',
calc: function (dt, row) {
return dt.getValue(row, 0) + dt.getValue(row, 1);
}
}]);
With a DataView, the calculated column will always reflect the current
contents of the DataTable it is built from, so you don't need to update the
view when the data changes.
On Monday, August 5, 2013 10:22:47 PM UTC-4, Chris wrote:
>
> I'm currently working on a prototype which is using a data source from
> Google Spreadsheet. In the Spreadsheet i have simple calculations which
> works like the sample below:
>
> C1 = A1 + B1
>
> I've added functionality to allow the user to change the value by using a
> dial in the visualization chart, which changes A1 value (using
> setValue(rowIndex,
> columnIndex, value): ). I am able to see the changes in the chart when
> the dial was moved, but the value of C1 remains unchanged.
>
> Does anyone out there knows how i can refresh/recalculate all the formulas
> in the visualization chart?
>
> Thanks,
>
> Chris.
>
--
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.
For more options, visit https://groups.google.com/groups/opt_out.