-
Notifications
You must be signed in to change notification settings - Fork 0
/
tally2.php
89 lines (72 loc) · 2.29 KB
/
tally2.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
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
include_once("bots.php");
$values="";
$labels="";
$tally = $wpdb->get_row( "select SUM(IF (sr<0.01,1,0)) as sec0,SUM(IF (sr>0.01,IF (sr<0.1,1,0),0)) as sec01,
SUM(IF (sr>0.1,IF (sr<0.2,1,0),0)) as sec02,
SUM(IF (sr>0.2,IF (sr<0.5,1,0),0)) as sec05,
SUM(IF (sr>0.5,IF (sr<1,1,0),0)) as sec1,
SUM(IF (sr>1,IF (sr<1.5,1,0),0)) as sec15,
SUM(IF (sr>1.5,IF (sr<2,1,0),0)) as sec2,
SUM(IF (sr>2,1,0)) as sec99, AVG(sr) as avg, COUNT(sr) as cnt FROM $table_name where datetime between '$prevdate' and '$date' ");
echo "<p>average: " . number_format($tally->avg, 3, '.', '') . " secs (" . number_format($tally->avg*1000, 0, '.', '') . " msecs) , ";
echo "hits: " . $tally->cnt . "</p><br/>";
?>
<canvas id="cvs_odo2" width="250" height="250">
[No canvas support]
</canvas>
<script>
new RGraph.Gauge({
id: 'cvs_odo2',
min: 0,
max: 2,
value: <?php echo number_format($tally->avg, 2, '.', '');?>,
options :{
scaleDecimals : 1,
labelsCount: 4,
greenColor: '#afa',
borderInner: '#1FA7E1',
borderOuter: '#1FA7E1',
greenEnd: 1,
redStart: 1.5,
}
}).draw()
</script>
<?php
$values.=$tally->sec0.",";
$labels.="'0 - 0.01',";
$values.=$tally->sec01.",";
$labels.="'0.01 - 0.1',";
$values.=$tally->sec02.",";
$labels.="'0.1 - 0.2',";
$values.=$tally->sec05.",";
$labels.="'0.2 - 0.5',";
$values.=$tally->sec1.",";
$labels.="'0.5 - 1',";
$values.=$tally->sec15.",";
$labels.="'1 - 1.5',";
$values.=$tally->sec2.",";
$labels.="'1.5 - 2',";
$values.=$tally->sec99;
$labels.="'2+'";
?>
<canvas id="cvs_tally2" <canvas id="cvs" width="400" height="200" >
>
[No canvas support]
</canvas>
<script>
new RGraph.HBar({
id: 'cvs_tally2',
data: [<?php echo $values; ?>],
options: {
labels: [<?php echo $labels; ?>],
colors: ['red','orange','orange','Gradient(#99f:#27afe9:#058DC7:#058DC7)','Gradient(#99f:#27afe9:#058DC7:#058DC7)', 'Gradient(#99f:#27afe9:#058DC7:#058DC7)', 'Gradient(#99f:#27afe9:#058DC7:#058DC7)','Gradient(#99f:#27afe9:#058DC7:#058DC7)'],
colorsSequential: true,
textSize: 10,
gutterLeftAutosize: true,
scaleZerostart: true,
textAccessible: true
}
}).draw();
</script>