????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.36 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/appsrv.astacus.se/energicontrol/skanninge/ |
Upload File : |
<?php
$mysqli = new mysqli("www.astacus.se", "carlhoffstedt", "Astacus2020!", "ostenssons_skanninge");
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Namnlöst dokument</title>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="js/package/dist/utils.js"></script>
<style>
table, th, td {
font-family: 'Gill Sans', 'Gill Sans MT', 'Myriad Pro', 'DejaVu Sans Condensed', 'Helvetica', 'Arial', 'sans-serif';
font-size: 8px;
border-collapse: collapse;
}
</style>
</head>
<body>
<center>
</center>
<canvas id="myChart" width="100%"></canvas>
<?php
$from = date("Y-m-d",strtotime("-1 days"))." 00:00:00";
$table = $_GET['table'];
$variable = $_GET['variable'];
$extra = $_GET['extra'];
if( $extra == "tblEcoguard"){
$mysqli = new mysqli("www.astacus.se", "carlhoffstedt", "Astacus2020!", "energicontrol");
$sql = "SELECT * FROM ".$table." WHERE ".$table.".Time >= '".$from."' AND SensorName = '".$variable."' AND SensorType = 'T' order by ".$table.".Time";
$result = $mysqli->query($sql);
$json_data_t = "data : [";
$json_labels_t = "[";
$x = 0;
$presure = 0;
while($obj = $result->fetch_object()){
$timestamp = $obj->Time;
$value = $obj->Value;
$json_labels_t = $json_labels_t . "'". $timestamp ."',";
$json_data_t = $json_data_t . $value.",";
}
$json_data_t = $json_data_t . "]";
$json_labels_t = $json_labels_t . "]";
}else{
$sql = "SELECT * FROM ".$table." WHERE ".$table.".Timestamp >= '".$from."' $extra order by ".$table.".Timestamp";
$result = $mysqli->query($sql);
$json_data_t = "data : [";
$json_labels_t = "[";
$x = 0;
$presure = 0;
while($obj = $result->fetch_object()){
$timestamp = $obj->Timestamp;
$value = $obj->$variable;
$json_labels_t = $json_labels_t . "'". $timestamp ."',";
$json_data_t = $json_data_t . $value.",";
}
$json_data_t = $json_data_t . "]";
$json_labels_t = $json_labels_t . "]";
}
?>
<script>
const labels = <?php echo($json_labels_t);?>;
const data = {
labels: labels,
datasets: [
{
label: '<?php echo($variable);?>',
<?php echo($json_data_t);?>,
borderColor: '#FF0000',
backgroundColor: '#FF0000',
stepped: false,
fill: false,
yAxisID: 'y'
}
]
};
const config = {
maintainAspectRatio: true,
type: 'line',
data: data,
options: {
responsive: true,
plugins: {
title: {
display: true,
text: 'Östenssons Skänninge',
},
},
scales: {
y: {
type: 'linear',
position: 'left',
stack: 'demo',
stackWeight: 2,
}
}
},
};
const myChart = new Chart(
document.getElementById('myChart'),
config
);
</script>
</div>
</body>
</html>