I got a little further
Below code gives me 3 columns but I need just 2 to draw a pie chart. How do
I combine 2 columns?
Answer Vendor Answer
noB,D2
yesA,C,E3
<html>
<head>
<script type="text/javascript"
src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
function getValues(values) {
return String(values);
}
google.load("visualization", "1", {packages:["corechart","table"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data1 = google.visualization.arrayToDataTable([
['Vendor', 'Answer'],
['A', 'yes'],
['B', 'no'],
['C', 'yes'],
['D', 'no'],
['E', 'yes']
]);
var result = google.visualization.data.group(data1, [1],[{column:0,
'aggregation':getValues, type:'string'},{'column': 1, 'aggregation':
google.visualization.data.count, 'type': 'number'}])
var options = {
title: 'Vendor analysis'
};
//var chart = new
google.visualization.PieChart(document.getElementById('piechart'));
var table = new
google.visualization.Table(document.getElementById('piechart'));
//chart.draw(data, options);
table.draw(result, {showRowNumber: true});
}
</script>
</head>
<body>
<div id="piechart" style="width: 900px; height: 500px;"></div>
</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.