Ja to našel tady https://github.com/…eries-Canvas
Nepomohl by jste lamě
<!DOCTYPE html>
<html manifest="demo.manifest"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>Canvas Steel</title>
</head>
<body onload="init()" style="background-color:#84a5ed">
<table>
<tbody><tr>
<canvas id="canvasLinear7" width="140" height="320"></canvas>
</td>
</tr>
</tbody>
</table>
<script>
function init() {
// Define value gradient for bargraph
var valGrad = new steelseries.gradientWrapper( 0,
100,
[ 0, 0.33, 0.66, 0.85, 1],
[ new steelseries.rgbaColor(0, 0, 200, 1),
new steelseries.rgbaColor(0, 200, 0, 1),
new steelseries.rgbaColor(200, 200, 0, 1),
new steelseries.rgbaColor(200, 0, 0, 1),
new steelseries.rgbaColor(200, 0, 0, 1) ]);
linear7 = new steelseries.Linear('canvasLinear7', {
width: 140,
height: 320,
gaugeType: steelseries.GaugeType.TYPE2,
titleString: "Thermometer",
unitString: "Unit",
threshold: 21,
lcdVisible: true
});
// Start the random update
setInterval(function(){ setRandomValue(linear7, 100); }, 9999);
}
function setRandomValue(gauge, range) {
gauge.setValueAnimated(Math.random() * range);
}
</script>
<script src="tween-min.js"></script>
<script src="steelseries-min.js"></script>
</body></html>
Je tam funkce setInterval, ktera vola funkci setRandomValue a ta gneruje hodnotu 0- 100 a podle ni se pohybuje teplota na budiku.
Potřeboval bych uplně odstranit tu funkci setRandomValue a misto ní načitat tu hodnotu ze souboru.
Ted si vypisuji teplotu jen jako hodnotu
<!DOCTYPE html>
<html>
<body>
<div id="demo">Žádná data :(</div>
<script>
function nactiKotel() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML =
this.responseText;
}
};
xhttp.open("GET", "shm/teplota_kotel", true);
xhttp.send();
}
nactiKotel();
setInterval(function () {
nactiKotel();
}, 10000);
</script>
</body>
</html>