forked from angular-google-chart/angular-google-chart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample.js
68 lines (57 loc) · 1.68 KB
/
sample.js
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
'use strict';
google.setOnLoadCallback(function () {
angular.bootstrap(document.body, ['google-chart-sample']);
});
google.load('visualization', '1', {packages: ['corechart']});
angular.module('google-chart-sample', ['googlechart.directives']).controller("SampleCtrl", function ($scope) {
var chart1 = {};
chart1.type = "AreaChart";
chart1.displayed = false;
chart1.cssStyle = "height:600px; width:100%;";
chart1.data = {"cols": [
{id: "month", label: "Month", type: "string"},
{id: "laptop-id", label: "Laptop", type: "number"},
{id: "desktop-id", label: "Desktop", type: "number"},
{id: "server-id", label: "Server", type: "number"}
], "rows": [
{c: [
{v: "January"},
{v: 19, f: "42 items"},
{v: 12, f: "Ony 12 items"},
{v: 7, f: "7 servers"}
]},
{c: [
{v: "February"},
{v: 13},
{v: 1, f: "1 unit (Out of stock this month)"},
{v: 12}
]},
{c: [
{v: "March"},
{v: 24},
{v: 5},
{v: 11}
]}
]};
chart1.options = {
"title": "Sales per month",
"isStacked": "true",
"fill": 20,
"displayExactValues": true,
"vAxis": {
"title": "Sales unit", "gridlines": {"count": 10}
},
"hAxis": {
"title": "Date"
}
};
$scope.chart = chart1;
$scope.hideServer = false;
$scope.selectionChange = function () {
if($scope.hideServer) {
$scope.chart.view = {columns: [0,1,2]};
} else {
$scope.chart.view = {};
}
}
});