<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9">
<title>Live random data</title>
<!--[if IE]>
<script type="text/javascript" src="../excanvas.js"></script>
<![endif]-->
<!--
For production (minified) code, use:
<script type="text/javascript" src="dygraph-combined.js"></script>
-->
<script type="text/javascript" src="../dygraph-dev.js"></script>
</head>
<body>
<h3 style="width:800px; text-align: center;">Live random data</h3>
<div id="div_g" style="width:800px; height:400px;"></div>
<script type="text/javascript">
var data = [];
var t = new Date();
for (var i = 10; i >= 0; i--) {
var x = new Date(t.getTime() - i * 1000);
data.push([x, Math.random()]);
}
var g = new Dygraph(document.getElementById("div_g"), data,
{
drawPoints: true,
showRoller: true,
valueRange: [0.0, 1.2],
labels: ['Time', 'Random']
});
setInterval(function() {
var x = new Date(); // current time
var y = Math.random();
data.push([x, y]);
g.updateOptions( { 'file': data } );
}, 1000);
</script>
<p>This test is modeled after a <a
href="http://www.highcharts.com/demo/?example=dynamic-update&theme=default">highcharts
test</a>. New points should appear once per second. Try zooming and
panning over to the right edge to watch them show up.</p>
</body>
</html>
คืออยากให้กราฟมันแสดงอุณหภูมิน่ะค่ะ ซึ่งค่าอุณภูมิจะดึงจากฐานข้อมูล mysql จะต้องเพิ่ม code php เข้าส่วนไหนคะ