If I use the following I get the right number row, but how do I sum of the
data
google.visualization.events.addListener(control, 'statechange',
function(event) {
var data2 = data.getFilteredRows([{column: 0, minValue:
control.getState().range.start, maxValue: control.getState().range.end}]);
document.getElementById('veight').value = data2.length;
});
Den torsdag den 24. oktober 2013 10.30.47 UTC+2 skrev Steen Horshauge:
>
> I have a ControlWrapper and a Bar Chart
>
> var data = new google.visualization.DataTable();
> data.addColumn('date', 'Dato');
> data.addColumn('number', 'Vægt forandring');
> data.addColumn('number', 'Samled vægt');
>
>
> data.addRow([new Date(2012,05,02), 2.00,27.20]);
> data.addRow([new Date(2012,05,03), 0.20,32.10]);
> data.addRow([new Date(2012,05,04), -0.30,31.80]);
> data.addRow([new Date(2012,05,05), 0.01,31.80]);
> data.addRow([new Date(2012,05,06), -0.40,31.40]);
> data.addRow([new Date(2012,05,07), 0.00,31.40]);
> data.addRow([new Date(2012,05,08), -0.30,31.10]);
> data.addRow([new Date(2012,05,09), -0.30,30.80]);
> data.addRow([new Date(2012,05,10), -0.50,30.30]);
>
>
> I have a event that give my the start and end of selected data.
> how do I get the sum of selected data
>
> For example, if the first and last one is the start and end.
>
> data.addRow([new Date(2012,05,04), -0.30,31.80]);
> data.addRow([new Date(2012,05,05), 0.01,31.80]);
> data.addRow([new Date(2012,05,06), -0.40,31.40]);
> data.addRow([new Date(2012,05,07), 0.00,31.40]);
>
> so that the first is not used.
> I would like to have 0.01 + -0.4 + 0.00 = -0.39
>
> How do I do it?
>
>
> google.visualization.events.addListener(control, 'statechange',
> function(event) {
>
> //document.getElementById('veight').value
> =control.getState()["range"]["end"];
> document.getElementById('veight').value
> =control.getState()["range"]["start"];
> //document.getElementById('veight').value = 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 http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.