Your aggregation column needs to be a number type:
var GroupedData = google.visualization.data.group(Data,[2],[{
column: 2,
type: 'number',
label: Data.getColumnLabel(2),
aggregation: google.visualization.data.count
}]);
You may need to change the source column to something other than 2, since
that is what you are grouping by, but I may be thinking of a different use
case.
On Thursday, October 9, 2014 2:52:27 AM UTC-4, [email protected] wrote:
>
> Hi,
>
> I have a table with some data and from that data I would like to count the
> number of records for column 'Verantwoordelijke'
> The result I would like to show in a pie chart under the table.
> My idea was to group the data on that column and use the count to get
> those numbers
> If i run the code I get an error:
> +++++++++++++++
> Foutdetails webpagina
> Gebruikersagent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64;
> Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR
> 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; .NET CLR 1.1.4322;
> InfoPath.3)
> Tijdstempel: Thu, 9 Oct 2014 06:48:09 UTC
>
> Bericht: Script error
> Regel: 0
> Teken: 0
> Code: 0
> URI:
> https://www.google.com/uds/api/visualization/1.0/dee027d0b48a2e0a0a0375d00d7dd635/format+nl,default+nl,ui+nl,corechart+nl.I.js
> +++++++++++++++
> If I remove the code for the groupeddata the table shows normal.
>
> I am sure I am overlooking something. I read the documentation but the
> solution has not dawned yet.
> Does anyone have a suggestion?
> The code I have now is:
>
>
> <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' '
> http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'><html xmlns='
> http://www.w3.org/1999/xhtml' xml:lang='nl' lang='nl'>
> <html><head><title>Monitor</title>
> <meta http-equiv="Content-Type"content="text/html; charset=utf-8">
>
> <script type='text/javascript' src='https://www.google.com/jsapi
> '></script>
> <script type='text/javascript'>
> google.load('visualization', '1', {packages:['corechart']});
> google.setOnLoadCallback(drawStuff);
>
> function drawStuff() {
> var Data = new google.visualization.DataTable();
> Data.addColumn('string', 'Nummer');
> Data.addColumn('string', 'Datum');
> Data.addColumn('string', 'Verantwoordelijke');
> Data.addColumn('string', 'Titel');
> Data.addRows([
> ['189646','08-08-2014 12:42:58','Ine Bastings','Record nummer
> 1'],
> ['190002','12-08-2014 14:40:07','Ine Bastings','Record nummer
> 2'],
> ['191870','01-09-2014 09:02:40','Ine Bastings','Record nummer
> 3'],
> ['192327','03-09-2014 13:41:33','Patrick van der
> Linden','Record nummer 4'],
> ['193141','12-09-2014 14:40:47','Barbera de Graaf','Record
> nummer 5'],
> ['193235','15-09-2014 12:49:44','Barbera de Graaf','Record
> nummer 6'],
> ['192333','03-09-2014 14:03:36','Patrick van der
> Linden','Record nummer 7'],
> ['192542','05-09-2014 12:57:21','Patrick van der
> Linden','Record nummer 8'],
> ['192328','03-09-2014 13:49:00','Patrick van der
> Linden','Record nummer 9'],
> ['193243','15-09-2014 13:13:01','Barbera de Graaf','Record
> nummer 10']
> ]);
> var GroupedData = google.visualization.data.group(Data,[2],[{
> column: 2,
> type: 'string',
> label: Data.getColumnLabel(2),
> aggregation: google.visualization.data.count
> }]);
> var Pieview = new google.visualization.DataView(GroupedData);
> Pieview.setColumns([1,0]);
>
> var table = new
> google.visualization.Table(document.getElementById('table_div'));
> table.draw(Data, {showRowNumber: false,width: '300',allowHtml:
> true});
> var Piechart = new
> google.visualization.PieChart(document.getElementById('pie_div'));
> Piechart.draw(Pieview);
> }
>
> </script>
> </head>
> <body>
> <div id='table_div' style='width: 1200px;'></div>
> <div id='piechart_div' style='width: 1200px; height: 500px;'></div>
>
> <a href=monitor.html>Terug naar hoofdscherm van monitor</a>
> </body></html>
>
>
--
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/d/optout.