| 15077 |
anikendra |
1 |
<h1>Admin Dashboard</h1>
|
|
|
2 |
<div id="registrations_chart_div" style="width:1200; height:300"></div>
|
| 15654 |
anikendra |
3 |
<div id="activeusers_chart_div" style="width:1200; height:300"></div>
|
|
|
4 |
<div id="activebuyers_chart_div" style="width:1200; height:300"></div>
|
| 15077 |
anikendra |
5 |
<div id="clicks_chart_div" style="width:1200px; height:300px"></div>
|
|
|
6 |
<div id="orders_chart_div" style="width:1200px; height:300px"></div>
|
| 15093 |
anikendra |
7 |
<div id="brand_preferences_chart_div" style="width:1200px; height:300px"></div>
|
| 15128 |
anikendra |
8 |
<div class="row">
|
|
|
9 |
<div id="devices_chart_div" class="col-xs-6" style="width:400px; height:300px"></div>
|
|
|
10 |
<div id="preferences_chart_div" class="col-xs-6" style="width:400px; height:300px"></div>
|
|
|
11 |
</div>
|
| 15077 |
anikendra |
12 |
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
|
|
|
13 |
<script type="text/javascript">
|
|
|
14 |
var dailysignups = [];
|
|
|
15 |
<?php foreach ($userbase as $key => $value):?>
|
|
|
16 |
var temp = [new Date('<?php echo $value[0]['date'];?>') , <?php echo $value[0]['count'];?>];
|
|
|
17 |
dailysignups.push(temp);
|
|
|
18 |
<?php endforeach;?>
|
| 15654 |
anikendra |
19 |
var dailyactiveusers = [];
|
|
|
20 |
<?php foreach ($activeUsers as $key => $value):?>
|
|
|
21 |
var temp = [new Date('<?php echo $value[0]['date'];?>') , <?php echo $value[0]['count'];?>];
|
|
|
22 |
dailyactiveusers.push(temp);
|
|
|
23 |
<?php endforeach;?>
|
|
|
24 |
var dailyactivebuyers = [];
|
|
|
25 |
<?php foreach ($activeBuyers as $key => $value):?>
|
|
|
26 |
var temp = [new Date('<?php echo $value[0]['date'];?>') , <?php echo $value[0]['count'];?>];
|
|
|
27 |
dailyactivebuyers.push(temp);
|
|
|
28 |
<?php endforeach;?>
|
| 15077 |
anikendra |
29 |
var dailyclicks = [];
|
|
|
30 |
<?php foreach ($clicks as $key => $value):?>
|
|
|
31 |
var temp = [new Date('<?php echo $value[0]['date'];?>') , <?php echo $value[0]['count'];?>];
|
|
|
32 |
dailyclicks.push(temp);
|
|
|
33 |
<?php endforeach;?>
|
|
|
34 |
var dailyorders = [];
|
|
|
35 |
<?php foreach ($orders as $key => $value):?>
|
|
|
36 |
var temp = [new Date('<?php echo $value[0]['date'];?>') , <?php echo $value[0]['count'];?>];
|
|
|
37 |
dailyorders.push(temp);
|
|
|
38 |
<?php endforeach;?>
|
|
|
39 |
var devices = [];
|
|
|
40 |
devices.push(['Version Code','Number of Devices']);
|
| 15607 |
anikendra |
41 |
<?php
|
|
|
42 |
foreach ($devices as $key => $value):?>
|
|
|
43 |
var temp = ["<?php echo $value['a']['versioncode'];?>" , <?php echo $value[0]['count'];?>];
|
| 15077 |
anikendra |
44 |
devices.push(temp);
|
| 15128 |
anikendra |
45 |
<?php endforeach;?>
|
| 15093 |
anikendra |
46 |
var brandpreferences = [];
|
|
|
47 |
<?php foreach ($preferences_set as $key => $value):?>
|
| 15128 |
anikendra |
48 |
var temp = [new Date("<?php echo $value[0]['date'];?>") , <?php echo $value[0]['count'];?>];
|
| 15093 |
anikendra |
49 |
brandpreferences.push(temp);
|
|
|
50 |
<?php endforeach;?>
|
| 15128 |
anikendra |
51 |
var preferences = [];
|
| 15193 |
anikendra |
52 |
preferences.push(['Preferences','Yes','No']);
|
|
|
53 |
preferences.push(['Brands',<?php echo $usersWithBrandPreferencesSet[0][0]['count'];?>,<?php echo ($totalUsers[0][0]['count'] - $usersWithBrandPreferencesSet[0][0]['count']);?>]);
|
| 15128 |
anikendra |
54 |
|
|
|
55 |
google.load('visualization', '1', {packages: ['corechart', 'line']});
|
| 15077 |
anikendra |
56 |
google.setOnLoadCallback(drawBasic);
|
|
|
57 |
|
|
|
58 |
function drawBasic() {
|
|
|
59 |
var data = new google.visualization.DataTable();
|
|
|
60 |
data.addColumn('date', 'Date');
|
|
|
61 |
data.addColumn('number', 'Signups');
|
|
|
62 |
data.addRows(dailysignups);
|
|
|
63 |
var options1 = {
|
|
|
64 |
hAxis: {
|
|
|
65 |
title: 'Date',
|
|
|
66 |
},
|
|
|
67 |
vAxis: {
|
| 15128 |
anikendra |
68 |
title: 'Daily User activations'
|
| 15077 |
anikendra |
69 |
}
|
|
|
70 |
};
|
|
|
71 |
|
|
|
72 |
var chart1 = new google.visualization.LineChart(document.getElementById('registrations_chart_div'));
|
|
|
73 |
chart1.draw(data, options1);
|
|
|
74 |
|
|
|
75 |
var clicksdata = new google.visualization.DataTable();
|
|
|
76 |
clicksdata.addColumn('date', 'Date');
|
|
|
77 |
clicksdata.addColumn('number', 'Clicks');
|
|
|
78 |
clicksdata.addRows(dailyclicks);
|
|
|
79 |
var options2 = {
|
|
|
80 |
hAxis: {
|
|
|
81 |
title: 'Date',
|
|
|
82 |
},
|
|
|
83 |
vAxis: {
|
| 15128 |
anikendra |
84 |
title: 'Daily clicks'
|
| 15077 |
anikendra |
85 |
}
|
|
|
86 |
};
|
|
|
87 |
|
| 15654 |
anikendra |
88 |
var data = new google.visualization.DataTable();
|
|
|
89 |
data.addColumn('date', 'Date');
|
|
|
90 |
data.addColumn('number', 'Active Users');
|
|
|
91 |
data.addRows(dailyactiveusers);
|
|
|
92 |
var options_dau = {
|
|
|
93 |
hAxis: {
|
|
|
94 |
title: 'Date',
|
|
|
95 |
},
|
|
|
96 |
vAxis: {
|
|
|
97 |
title: 'Daily Active Users'
|
|
|
98 |
}
|
|
|
99 |
};
|
|
|
100 |
var chart_dau = new google.visualization.LineChart(document.getElementById('activeusers_chart_div'));
|
|
|
101 |
chart_dau.draw(data, options_dau);
|
|
|
102 |
|
|
|
103 |
var data = new google.visualization.DataTable();
|
|
|
104 |
data.addColumn('date', 'Date');
|
|
|
105 |
data.addColumn('number', 'Active Buyers');
|
|
|
106 |
data.addRows(dailyactivebuyers);
|
|
|
107 |
var options_dab = {
|
|
|
108 |
hAxis: {
|
|
|
109 |
title: 'Date',
|
|
|
110 |
},
|
|
|
111 |
vAxis: {
|
|
|
112 |
title: 'Daily Active Buyers'
|
|
|
113 |
}
|
|
|
114 |
};
|
|
|
115 |
var chart_dau = new google.visualization.LineChart(document.getElementById('activebuyers_chart_div'));
|
|
|
116 |
chart_dau.draw(data, options_dab);
|
|
|
117 |
|
|
|
118 |
var clicksdata = new google.visualization.DataTable();
|
|
|
119 |
clicksdata.addColumn('date', 'Date');
|
|
|
120 |
clicksdata.addColumn('number', 'Clicks');
|
|
|
121 |
clicksdata.addRows(dailyclicks);
|
|
|
122 |
var options2 = {
|
|
|
123 |
hAxis: {
|
|
|
124 |
title: 'Date',
|
|
|
125 |
},
|
|
|
126 |
vAxis: {
|
|
|
127 |
title: 'Daily clicks'
|
|
|
128 |
}
|
|
|
129 |
};
|
|
|
130 |
|
| 15077 |
anikendra |
131 |
var chart2 = new google.visualization.LineChart(document.getElementById('clicks_chart_div'));
|
|
|
132 |
chart2.draw(clicksdata, options2);
|
|
|
133 |
|
|
|
134 |
var ordersdata = new google.visualization.DataTable();
|
|
|
135 |
ordersdata.addColumn('date', 'Date');
|
|
|
136 |
ordersdata.addColumn('number', 'Orders');
|
|
|
137 |
ordersdata.addRows(dailyorders);
|
|
|
138 |
var options3 = {
|
|
|
139 |
hAxis: {
|
|
|
140 |
title: 'Date',
|
|
|
141 |
},
|
|
|
142 |
vAxis: {
|
| 15128 |
anikendra |
143 |
title: 'Daily orders'
|
| 15077 |
anikendra |
144 |
}
|
|
|
145 |
};
|
|
|
146 |
|
|
|
147 |
var chart3 = new google.visualization.LineChart(document.getElementById('orders_chart_div'));
|
|
|
148 |
chart3.draw(ordersdata, options3);
|
|
|
149 |
|
| 15093 |
anikendra |
150 |
|
|
|
151 |
var brandpreferencesdata = new google.visualization.DataTable();
|
|
|
152 |
brandpreferencesdata.addColumn('date', 'Date');
|
|
|
153 |
brandpreferencesdata.addColumn('number', 'Brand Preferences Set');
|
| 15128 |
anikendra |
154 |
brandpreferencesdata.addRows(brandpreferences);
|
| 15093 |
anikendra |
155 |
var options5 = {
|
|
|
156 |
hAxis: {
|
|
|
157 |
title: 'Date',
|
|
|
158 |
},
|
|
|
159 |
vAxis: {
|
| 15128 |
anikendra |
160 |
title: 'Daily brand preferences'
|
| 15093 |
anikendra |
161 |
}
|
|
|
162 |
};
|
|
|
163 |
|
|
|
164 |
var chart5 = new google.visualization.LineChart(document.getElementById('brand_preferences_chart_div'));
|
|
|
165 |
chart5.draw(brandpreferencesdata, options5);
|
|
|
166 |
|
|
|
167 |
|
| 15128 |
anikendra |
168 |
var devicesdata = google.visualization.arrayToDataTable(devices);
|
|
|
169 |
var options4 = {
|
|
|
170 |
title: 'Version Codes'
|
|
|
171 |
};
|
|
|
172 |
var chart4 = new google.visualization.PieChart(document.getElementById('devices_chart_div'));
|
|
|
173 |
chart4.draw(devicesdata, options4);
|
|
|
174 |
|
|
|
175 |
var preferencesdata = google.visualization.arrayToDataTable(preferences);
|
| 15193 |
anikendra |
176 |
// var options6 = {
|
|
|
177 |
// title: 'Preferences Set'
|
|
|
178 |
// };
|
| 15128 |
anikendra |
179 |
var options6 = {
|
| 15193 |
anikendra |
180 |
title: 'Preferences Set',
|
|
|
181 |
chartArea: {width: '50%'},
|
|
|
182 |
isStacked: true,
|
|
|
183 |
hAxis: {
|
|
|
184 |
title: 'Total Users',
|
|
|
185 |
minValue: 0,
|
|
|
186 |
},
|
|
|
187 |
vAxis: {
|
|
|
188 |
title: 'Type'
|
|
|
189 |
}
|
| 15128 |
anikendra |
190 |
};
|
| 15193 |
anikendra |
191 |
var chart6 = new google.visualization.BarChart(document.getElementById('preferences_chart_div'));
|
| 15128 |
anikendra |
192 |
chart6.draw(preferencesdata, options6);
|
| 15077 |
anikendra |
193 |
}
|
|
|
194 |
</script>
|