-
Notifications
You must be signed in to change notification settings - Fork 0
/
google_chart.html
38 lines (28 loc) · 1.22 KB
/
google_chart.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<script type="text/javascript">
function Draw() {
// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {'packages':['corechart'], 'callback' : drawChart });
// Set a callback to run when the Google Visualization API is loaded.
// google.setOnLoadCallback(drawChart);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
}
function drawChart() {
// Create the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Отбор');
data.addColumn('number', 'Количество');
for( i = 0; i < arrData.length; i ++ )
{
data.addRows([ arrData[i].name, arrData[i].value ]);
}
// Set chart options
var options = {'title':'Покупки по категориям',
'width':400,
'height':300};
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.PieChart( $('#chart_div')[0] );
chart.draw(data, options);
}
</script>