????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.191 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 : /proc/self/root/var/www/appsrv.astacus.se/digitaltwin/ |
Upload File : |
<?php
$link = mysql_connect ("localhost", "root", "root123");
mysql_select_db ("energicontrol");
?>
<style>
.rcorners { border-radius: 10px;
background: #0063b5;
padding: 10px;
height: 30px;
}
.rcorners2 {
border-radius: 10px;
background: #DDDDDD;
padding: 10px;
height: 30px;
font-size: 18px;
color: #000000;
}
.rubrik {
font-family: Verdana, Geneva, sans-serif;
text-align: left;
}
.text {
font-family: Verdana, Geneva, sans-serif;
}
.text {
font-size: 14px;
}
#form1 {
}
.bold {
font-weight: bold;
}
.bold {
font-family: Verdana, Geneva, sans-serif;
}
.bold {
font-size: 14px;
}
#box2 {
background: white;
height: 100%;
width: 100%;
margin: -500px 0px;
-webkit-animation-name: move;
-webkit-animation-duration: 30s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-direction: up;
-webkit-animation-timing-function: linear;
}
#box2:hover {
-webkit-animation-play-state: paused;
}
@-webkit-keyframes move {
0% {
margin-top: 0%;
}
100% {
margin-top: 100%;
}
}
</style>
<script src="js/Chart.bundle.js"></script>
<script src="js/utils.js"></script>
</head>
<?php
$daysback = 14;
$date = date("Y-m-d H:00:00",strtotime("-$daysback days"));
$lables = array();
for ($x = 0; $x <= 24*$daysback; $x++) {
$lables[] = date("Y-m-d H:00:00",strtotime("-$daysback days +$x hours"));
}
$json_labels_t1 = "labels : [";
foreach ($lables as &$value) {
$json_labels_t1 = $json_labels_t1 . "'".$value ."',";
}
$json_labels_t1 = $json_labels_t1 . "]";
$data = array();
$sql = "SELECT * FROM tblEcoguard WHERE Time >= '".$date."' and Time LIKE '%00:00' and (SensorName = '00686450' or SensorName = '00686735' or SensorName = '00686734' or SensorName = '00686732' or SensorName = '00686733' or SensorName = '00038898') and (SensorType = 'T' or SensorType = 'OT')";
echo($sql);
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)){
$arr = array();
$arr[] = $row['Time'];
$arr[] = $row['SensorName'];
$arr[] = $row['Value'];
$data[] = $arr;
}
$json_data_t1 = "data : [";
$json_data_t2 = "data : [";
$json_data_t3 = "data : [";
$json_data_t4 = "data : [";
$json_data_t5 = "data : [";
$json_data_t6 = "data : [";
$found_1 = 0;$found_2 = 0;$found_3 = 0;$found_4 = 0;$found_5 = 0;$found_6 = 0;
foreach ($lables as &$lables_value) {
foreach ($data as &$value) {
if($value[1] == "00686450") {
if($value[0] == $lables_value){
$json_data_t1 = $json_data_t1 . $value[2].",";
$found_1 = 1;
}
}
if($value[1] == "00686735") {
if($value[0] == $lables_value){
$json_data_t2 = $json_data_t2 . $value[2].",";
$found_2 = 1;
}
}
if($value[1] == "00686734") {
if($value[0] == $lables_value){
$json_data_t3 = $json_data_t3 . $value[2].",";
$found_3 = 1;
}
}
if($value[1] == "00686732") {
if($value[0] == $lables_value){
$json_data_t4 = $json_data_t4 . $value[2].",";
$found_4 = 1;
}
}
if($value[1] == "00686733") {
if($value[0] == $lables_value){
$json_data_t5 = $json_data_t5 . $value[2].",";
$found_5 = 1;
}
}
if($value[1] == "00038898") {
if($value[0] == $lables_value){
$json_data_t6 = $json_data_t6 . $value[2].",";
$found_6 = 1;
}
}
}
if($found_1 == 0){
$json_data_t1 = $json_data_t1 . ",";
}else{
$found_1 = 0;
}
if($found_2 == 0){
$json_data_t2 = $json_data_t2 . ",";
}else{
$found_2 = 0;
}
if($found_3 == 0){
$json_data_t3 = $json_data_t3 . ",";
}else{
$found_3 = 0;
}
if($found_4 == 0){
$json_data_t4 = $json_data_t4 . ",";
}else{
$found_4 = 0;
}
if($found_5 == 0){
$json_data_t5 = $json_data_t5 . ",";
}else{
$found_5 = 0;
}
if($found_6 == 0){
$json_data_t6 = $json_data_t6 . ",";
}else{
$found_6 = 0;
}
}
$json_data_t1 = $json_data_t1 . "]";
$json_data_t2 = $json_data_t2 . "]";
$json_data_t3 = $json_data_t3 . "]";
$json_data_t4 = $json_data_t4 . "]";
$json_data_t5 = $json_data_t5 . "]";
$json_data_t6 = $json_data_t6 . "]";
?>
<p><div id="canvas-holder3" style="width:100%"></div>
<div style="width:100%;">
<canvas id="canvas3"></canvas>
</div></p>
<p><br>
<script>
window.onload=function(){
var originalLineDraw = Chart.controllers.line.prototype.draw;
Chart.helpers.extend(Chart.controllers.line.prototype, {
draw: function() {
originalLineDraw.apply(this, arguments);
var chart = this.chart;
var ctx = chart.chart.ctx;
var index = chart.config.data.lineAtIndex;
if (index) {
var xaxis = chart.scales['x-axis-0'];
var yaxis = chart.scales['y-axis-0'];
ctx.save();
ctx.beginPath();
ctx.moveTo(xaxis.getPixelForValue(undefined, index), yaxis.top);
ctx.strokeStyle = '#ff0000';
ctx.lineTo(xaxis.getPixelForValue(undefined, index), yaxis.bottom);
ctx.stroke();
ctx.restore();
}
}
});
var config3 = {
type: 'line',
data: {
<?php echo($json_labels_t1);?>,
datasets: [{
label: 'Butik',
backgroundColor: window.chartColors.color3,
borderColor: window.chartColors.color3,
<?php echo($json_data_t1);?>,
fill: false,
},{
label: 'Varumottagning',
backgroundColor: window.chartColors.color4,
borderColor: window.chartColors.color4,
<?php echo($json_data_t2);?>,
fill: false,
},{
label: 'Mejeri',
backgroundColor: window.chartColors.color6,
borderColor: window.chartColors.color6,
<?php echo($json_data_t3);?>,
fill: false,
},{
label: 'Bageri',
backgroundColor: window.chartColors.color12,
borderColor: window.chartColors.color12,
<?php echo($json_data_t4);?>,
fill: false,
},{
label: 'Personal',
backgroundColor: window.chartColors.color13,
borderColor: window.chartColors.color13,
<?php echo($json_data_t5);?>,
fill: false,
},{
label: 'Utomhustemp i Motala',
backgroundColor: window.chartColors.color14,
borderColor: window.chartColors.color14,
<?php echo($json_data_t6);?>,
fill: false,
}]
},
options: {
responsive: true,
title: {
display: true,
text: 'Historik'
},
tooltips: {
mode: 'index',
intersect: false,
},
hover: {
mode: 'nearest',
intersect: true
},
scales: {
xAxes: [{
display: true,
scaleLabel: {
display: true,
labelString: 'Datum'
}
}],
yAxes: [{
display: true,
scaleLabel: {
display: true,
labelString: 'Mätvärden'
}
}]
}
}
};
var ctx3 = document.getElementById('canvas3').getContext('2d');
var chart3 = new Chart(ctx3, config3);
window.myLine = chart3;
}
</script>