-
Notifications
You must be signed in to change notification settings - Fork 5
/
navigate.php
160 lines (138 loc) · 4.3 KB
/
navigate.php
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<!DOCTYPE html>
<html>
<head>
<script src="Chart.bundle.js"></script>
<script src="utils.js"></script>
<script src="raphael-2.1.4.min.js"></script>
<script src="justgage.js"></script>
<title>Ready to Innovate Assessment</title>
<link href="http://static.jboss.org/css/rhbar.css" media="screen" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
</head>
<body>
<?php
date_default_timezone_set("Europe/London");
## Connect to the Database
include 'dbconnect.php';
connectDB();
# Retrieve the data
$hash = $_REQUEST['hash'];
$qq = "SELECT * FROM data WHERE hash='".mysqli_real_escape_string($db, $hash)."'";
$res = mysqli_query($db, $qq);
$data_array = mysqli_fetch_assoc($res);
$ops_arr = $dev_arr = array();
foreach( $data_array as $var => $value )
{
if($var=='date') continue;
if(substr($var[0],0,1) == "o") { $ops_arr[]=$value; };
if(substr($var[0],0,1) == "d") { $dev_arr[]=$value;};
}
?>
<div style="width:90%">
<canvas id="canvas"></canvas>
</div>
<script>
function checkVal(inNo) {
if (inNo == "0") {
var outNo = "0.01";
} else {
var outNo = inNo;
}
return outNo
}
var d1 = checkVal(<?php echo $data_array['d1'] ?>)
var d2 = checkVal(<?php echo $data_array['d2'] ?>)
var d3 = checkVal(<?php echo $data_array['d3'] ?>)
var d4 = checkVal(<?php echo $data_array['d4'] ?>)
var d5 = checkVal(<?php echo $data_array['d5'] ?>)
var totalDev = d1 + d2 + d3 + d4 + d5
var o1 = checkVal(<?php echo $data_array['o1'] ?>)
var o2 = checkVal(<?php echo $data_array['o2'] ?>)
var o3 = checkVal(<?php echo $data_array['o3'] ?>)
var o4 = checkVal(<?php echo $data_array['o4'] ?>)
var o5 = checkVal(<?php echo $data_array['o5'] ?>)
var totalOps = o1 + o2 + o3 + o4 + o5
var chartTitle = ''
var overall1 = (d1+o1)/2;
var overall2 = (d2+o2)/2;
var overall3 = (d3+o3)/2;
var overall4 = (d4+o4)/2;
var overall5 = (d5+o5)/2;
var randomScalingFactor = function() {
return Math.round(Math.random() * 4);
};
var color = Chart.helpers.color;
var config = {
type: 'radar',
data: {
labels: ["Automation", "Methodology", "Architecture", "Strategy", "Environment"],
datasets: [{
label: "Dev",
backgroundColor: color(window.chartColors.red).alpha(0.2).rgbString(),
borderColor: window.chartColors.red,
pointBackgroundColor: window.chartColors.red,
data: [d1,d2,d3,d4,d5]
}, {
label: "Ops",
backgroundColor: color(window.chartColors.blue).alpha(0.2).rgbString(),
borderColor: window.chartColors.blue,
pointBackgroundColor: window.chartColors.blue,
data: [o1,o2,o3,o4,o5]
}]
},
options: {
legend: {
position: 'bottom',
},
title: {
display: true,
text: chartTitle
},
scale: {
ticks: {
beginAtZero: true,
max: 4,
min: 0
}
},
animation:{
}
}
}
window.onload = function() {
window.myRadar = new Chart(document.getElementById("canvas"), config);
var myBarChart2 = new Chart(ctx2, {
type: 'bar',
data: dataOps,
options: {
barValueSpacing: 20,
scales: {
yAxes: [{
ticks: {
min: 0,
max: 4
}
}]
},
animation:{
onComplete : function(){
var dataURLOps = myChartOps.toDataURL("image/png",1.0);
console.log(dataURLDev);
$.ajax({
type: "POST",
url: "chartSave.php",
data: "spider="+dataURLOps+"&customer="+customerNameNoSpaces+"&chartType=comparisonOps",
});
}
}
}
});
};
var colorNames = Object.keys(window.chartColors);
</script>
</div>
</body>
</html>