-
Notifications
You must be signed in to change notification settings - Fork 0
/
thermometers.php
42 lines (35 loc) · 1.18 KB
/
thermometers.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
<?php
//Load the Homewizard class
require ("class.homewizard.php");
$hw = new homewizard();
//Get the graph info for thermometer 0
if (!$hw->thermo_graph(0, 'month')) {
echo 'error reading data!';
return;
}
//Start creating the graph
//Google api doc: https://google-developers.appspot.com/chart/interactive/docs/gallery/linechart
?>
<div id="header_thermometers">Temperatuur</div>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Maand', 'Min', 'Max'],
<?php
//Set all the values we loaden from the hw.
foreach ($hw->thermo_graph as $value) {
echo "['".$value->t."',".$value->te_min.','.$value->te_plus.'],'."\n";
}
?>
]);
var options = {
title: ''
};
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
<div id="chart_div" style="width: 500px; height: 450px;"></div>