104 lines
2.9 KiB
HTML
104 lines
2.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<title>Stat tracker</title>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.5.0/bootstrap-table.min.css">
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
|
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
|
<script src="http://code.highcharts.com/stock/highstock.js"></script>
|
|
<script src="http://code.highcharts.com/stock/modules/exporting.js"></script>
|
|
<script type="text/javascript">
|
|
$(function () {
|
|
Highcharts.setOptions({
|
|
global: {
|
|
timezoneOffset: 5 * 60
|
|
}
|
|
});
|
|
var names = ['inside','outside','set_heat','set_cool','humidity'];
|
|
seriesOptions = [],
|
|
seriesCounter = 0,
|
|
createChart = function () {
|
|
|
|
$('#container').highcharts('StockChart', {
|
|
|
|
rangeSelector: {
|
|
selected: 4
|
|
},
|
|
|
|
|
|
yAxis: {
|
|
title: {
|
|
text: 'Temperature �'
|
|
},
|
|
labels: {
|
|
formatter: function () {
|
|
return this.value;
|
|
}
|
|
},
|
|
plotLines: [{
|
|
value: 0,
|
|
width: 2,
|
|
color: 'silver'
|
|
}]
|
|
},
|
|
|
|
|
|
|
|
tooltip: {
|
|
pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b><br/>',
|
|
valueDecimals: 0
|
|
},
|
|
|
|
series: seriesOptions,
|
|
legend: {
|
|
enabled: true,
|
|
borderWidth: 1,
|
|
backgroundColor: '#FFFFFF',
|
|
shadow: true
|
|
}
|
|
});
|
|
};
|
|
|
|
$.each(names, function (i, name) {
|
|
$.getJSON('db-get.php?q='+name, function (data) {
|
|
|
|
seriesOptions[i] = {
|
|
name: name,
|
|
data: data
|
|
};
|
|
seriesCounter += 1;
|
|
|
|
if (seriesCounter === names.length) {
|
|
createChart();
|
|
}
|
|
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<!-- Fixed navbar -->
|
|
<nav class="navbar navbar-inverse">
|
|
<div class="container">
|
|
<div class="navbar-header">
|
|
<a class="navbar-brand" href="#">Stat stats</a>
|
|
</div>
|
|
<div id="navbar" class="navbar-collapse collapse">
|
|
<ul class="nav navbar-nav">
|
|
<li><a href="index.html">Home</a></li>
|
|
<li class="active"><a href="graph.html">Graph</a></li>
|
|
<li><a href="delay.html">Delay</a></li>
|
|
</ul>
|
|
</div><!--/.nav-collapse -->
|
|
</div>
|
|
</nav>
|
|
|
|
<div id="container" style="height: 400px; min-width: 310px"></div>
|
|
|
|
|
|
|
|
</body> |