Subversion Repositories SmartDukaan

Rev

Rev 15077 | Rev 15128 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
15077 anikendra 1
<h1>Admin Dashboard</h1>
2
<div id="registrations_chart_div" style="width:1200; height:300"></div>
3
<div id="clicks_chart_div" style="width:1200px; height:300px"></div>
4
<div id="orders_chart_div" style="width:1200px; height:300px"></div>
15093 anikendra 5
<div id="brand_preferences_chart_div" style="width:1200px; height:300px"></div>
15077 anikendra 6
<div id="devices_chart_div" style="width:600px; height:300px"></div>
7
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
8
<script type="text/javascript">
9
	var dailysignups = [];
10
	<?php foreach ($userbase as $key => $value):?>
11
		var temp = [new Date('<?php echo $value[0]['date'];?>') , <?php echo $value[0]['count'];?>];
12
		dailysignups.push(temp);
13
	<?php endforeach;?>
14
	var dailyclicks = [];
15
	<?php foreach ($clicks as $key => $value):?>
16
		var temp = [new Date('<?php echo $value[0]['date'];?>') , <?php echo $value[0]['count'];?>];
17
		dailyclicks.push(temp);
18
	<?php endforeach;?>
19
	var dailyorders = [];
20
	<?php foreach ($orders as $key => $value):?>
21
		var temp = [new Date('<?php echo $value[0]['date'];?>') , <?php echo $value[0]['count'];?>];
22
		dailyorders.push(temp);
23
	<?php endforeach;?>
24
	var devices = [];
25
	devices.push(['Version Code','Number of Devices']);	
26
	<?php foreach ($devices as $key => $value):?>
27
		var temp = ["<?php echo $value['devices']['versioncode'];?>" , <?php echo $value[0]['count'];?>];
28
		devices.push(temp);
29
	<?php endforeach;?>
15093 anikendra 30
  var brandpreferences = [];
31
  <?php foreach ($preferences_set as $key => $value):?>
32
    var temp = ["<?php echo $value[0]['date'];?>" , <?php echo $value[0]['count'];?>];
33
    brandpreferences.push(temp);
34
  <?php endforeach;?>
15077 anikendra 35
 
36
	google.load('visualization', '1', {packages: ['corechart', 'line']});
37
	google.setOnLoadCallback(drawBasic);
38
 
39
	function drawBasic() {
40
      var data = new google.visualization.DataTable();
41
      data.addColumn('date', 'Date');
42
      data.addColumn('number', 'Signups');
43
      data.addRows(dailysignups);
44
      var options1 = {
45
        hAxis: {
46
          title: 'Date',
47
        },
48
        vAxis: {
49
          title: 'User Registrations'
50
        }
51
      };
52
 
53
      var chart1 = new google.visualization.LineChart(document.getElementById('registrations_chart_div'));
54
      chart1.draw(data, options1);
55
 
56
      var clicksdata = new google.visualization.DataTable();      
57
      clicksdata.addColumn('date', 'Date');
58
      clicksdata.addColumn('number', 'Clicks');      
59
      clicksdata.addRows(dailyclicks);
60
      var options2 = {
61
        hAxis: {
62
          title: 'Date',
63
        },
64
        vAxis: {
65
          title: 'Number of Clicks'
66
        }
67
      };
68
 
69
      var chart2 = new google.visualization.LineChart(document.getElementById('clicks_chart_div'));
70
      chart2.draw(clicksdata, options2);
71
 
72
      var ordersdata = new google.visualization.DataTable();      
73
      ordersdata.addColumn('date', 'Date');
74
      ordersdata.addColumn('number', 'Orders');      
75
      ordersdata.addRows(dailyorders);
76
      var options3 = {
77
        hAxis: {
78
          title: 'Date',
79
        },
80
        vAxis: {
81
          title: 'Number of Orders'
82
        }
83
      };
84
 
85
      var chart3 = new google.visualization.LineChart(document.getElementById('orders_chart_div'));
86
      chart3.draw(ordersdata, options3);
87
 
15093 anikendra 88
 
89
      var brandpreferencesdata = new google.visualization.DataTable();      
90
      brandpreferencesdata.addColumn('date', 'Date');
91
      brandpreferencesdata.addColumn('number', 'Brand Preferences Set');      
92
      brandpreferencesdata.addRows(dailyorders);
93
      var options5 = {
94
        hAxis: {
95
          title: 'Date',
96
        },
97
        vAxis: {
98
          title: 'Number of Users who set Brand Preferences'
99
        }
100
      };
101
 
102
      var chart5 = new google.visualization.LineChart(document.getElementById('brand_preferences_chart_div'));
103
      chart5.draw(brandpreferencesdata, options5);
104
 
105
 
15077 anikendra 106
		var devicesdata = google.visualization.arrayToDataTable(devices);
107
		var options4 = {
108
			title: 'Version Codes'
109
		};
110
		var chart4 = new google.visualization.PieChart(document.getElementById('devices_chart_div'));
111
		chart4.draw(devicesdata, options4);
112
    }
113
    </script>