-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathguage1.php
65 lines (60 loc) · 2.31 KB
/
guage1.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
<?php
include("db.php");
$sql = "SELECT * from tbl_temperature order by id desc limit 1";
$result = $con->query($sql);
if ($result->num_rows > 0) {
$row = $result->fetch_assoc();
$value1 = $row['temperature'] * 3.53475;
$value11 = 282.78 - $value1;
$value2 = $row['humidity'] * 3.53475;
$value22 = 282.78 - $value2;
// if ($row['temperature'] < 27) {
// echo "<span id='' style='color:red;font-size:30px;'>cow is dead</span>";
// } else {
// echo "<span id='' style='color:red;font-size:30px;'>cow is live</span>";
// }
echo "<div id='gauge'>
<div id='major-ticks'>
<span>0℃</span>
<span>40℃</span>
<span>80℃</span>
</div>
<div id='minor-ticks'>
<span title='--i:1'></span>
<span title='--i:2'></span>
<span title='--i:3'></span>
<span title='--i:4'></span>
<span title='--i:5'></span>
<span title='--i:6'></span>
<span title='--i:7'></span>
<span title='--i:8'></span>
<span title='--i:9'></span>
<span title='--i:10'></span>
<span title='--i:11'></span>
<span title='--i:12'></span>
<span title='--i:13'></span>
<span title='--i:14'></span>
<span title='--i:15'></span>
<span title='--i:16'></span>
<span title='--i:17'></span>
<span title='--i:18'></span>
<span title='--i:19'></span>
<span title='--i:20'></span>
</div>
<div id='minor-ticks-bottom-mask'></div>
<div id='bottom-circle'></div>
<svg version='1.1' baseProfile='full' width='190' height='190' xmlns=''>
<linearGradient id='gradient' x1='0' x2='1' y1='0' y2='0'>
<stop offset='50%' stop-color='#b96e85' />
<stop offset='100%' stop-color='#ae69bb' />
</linearGradient>
<path d='M5 95 A80 80 0 0 1 185 95' stroke=url(#gradient) fill='none' stroke-width='10'
stroke-linecap='round' stroke-dasharray='$value1 $value11' />
</svg>
<div id='center-circle'>
<span id='name'>Temperature</span>";
echo "<span id='temperature1'>" . $row['temperature'] . "</span>";
echo "<img src='./img/sun.jpg' alt=''>
</div>
</div>";
}