-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraph2.php
More file actions
98 lines (76 loc) · 2.5 KB
/
graph2.php
File metadata and controls
98 lines (76 loc) · 2.5 KB
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
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
//include_once("bots.php");
$mylink = $wpdb->get_results("SELECT DATE(datetime ) as daynum , HOUR(datetime) AS hour, avg(secs) as seconds, avg(sr) as response FROM $table_name WHERE datetime between '$prevdate' and '$date' and secs<120 " .wphpc_sql_where_country($country) . " GROUP BY daynum,hour "); //ORDER BY HOUR(datetime) ASC");
?>
<br>
<canvas id="cvs_graph2" width="1200" height="250" >
[No canvas support]
</canvas>
</ br>
</ br>
<canvas id="cvs_graph2b" width="1200" height="250" >
[No canvas support]
</canvas>
<?php
$vals1="";
$vals2="";
$labels1="";
foreach($mylink as $datas)
{
// $pdata = $wpdb->get_results("SELECT HOUR(datetime) AS hour,AVG(sr) as response,url,AVG(secs) as seconds FROM $table_name WHERE HOUR(datetime) = '".$datas->hour."' and secs<20");
$responses = $datas->response;
$response = number_format($responses, 2, '.', '');
$secondss = $datas->seconds;
$seconds = number_format($secondss, 2, '.', '');
$hours = intval( $datas->hour);
$am="am";
if ($hours == 12){
$am="pm";
}
if ($hours == 0){
$hours=12;
}
if ($hours > 12){
$hours =$hours -12;
$am="pm";
}
$labels1.="'".date('M d',strtotime($datas->daynum))."\\n".$hours." ".$am."',";
$vals1.=$response.",";
$vals2.=$seconds.",";
}
?>
<script>
new RGraph.Bar({
id: 'cvs_graph2',
data: [<?php echo $vals1; ?>],
options: {
labels: [<?php echo $labels1; ?>],
shadow: false,
colors: ['Gradient(#99f:#27afe9:#058DC7:#058DC7)'],
strokestyle: 'rgba(0,0,0,0)',
textSize: 10,
title: 'average seconds for web Server to respond',
numyticks: 5,
noxaxis: false,
scaleDecimals : 1,
gutterLeft: 50
}
}).draw();
new RGraph.Bar({
id: 'cvs_graph2b',
data: [<?php echo $vals2; ?>],
options: {
labels: [<?php echo $labels1; ?>],
shadow: false,
colors: ['Gradient(#99f:#27afe9:#058DC7:#058DC7)'],
strokestyle: 'rgba(0,0,0,0)',
textSize: 10,
title: 'average seconds for End user browser to finish loading',
numyticks: 5,
noxaxis: false,
scaleDecimals : 0,
gutterLeft: 50
}
}).draw();
</script>