<script type="text/javascript" >
$(function () {
// we use an inline data source in the example, usually data would
// be fetched from a server
var data = [], totalPoints = 5;
function getData() {
if (data.length > 0)
data = data.slice(1);
document.write(data+ "<br>");
while (data.length <= totalPoints) {
<?php
$oid=268435456+5;
$host = "10.255.206.11";
$snrDown1 = snmpget($host, "private", ".1.3.6.1.2.1.10.94.1.1.3.1.1.$oid");
$index1 = snmpget($host, "public", ".1.3.6.1.2.1.10.94.1.1.3.1.4.$oid");
$snr1 = snmpget($host, "public", ".1.3.6.1.2.1.10.94.1.1.3.1.4.$oid");
$snr1_1=ereg_replace("[^[:digit:]]","", $snr1 ) ;
echo 'data.push(' . $snr1_1 . ')' . "\n"; ?>
}
document.write(data+ "<br> ");
// zip the generated y values with the x values
var res = [];
for (var i = 0; i < data.length; ++i)
document.write(length+ "<br />");
res.push([i, data[i]])
document.write(i+ "<br />");
//document.write(data[i]+ "<br />");
document.write(res+ "<br /><br />");
return res;
}
// setup control widget
var updateInterval = 3000;
$("#updateInterval").val(updateInterval).change(function () {
var v = $(this).val();
if (v && !isNaN(+v)) {
updateInterval = +v;
if (updateInterval < 1)
updateInterval = 1;
if (updateInterval > 200000)
updateInterval = 200000;
$(this).val("" + updateInterval);
}
});
// setup plot
var options = {
series: { shadowSize: 0 }, // drawing is faster without shadows
yaxis: { show : true },
xaxis: { show: false }
};
var plot = $.plot($("#placeholder"), [ getData() ], options);
function update() {
plot.setData([ getData() ]);
// since the axes don't change, we don't need to call plot.setupGrid()
plot.draw();
setTimeout(update, updateInterval);
//window.location.href = 'readdbonly.php';
}
update();
});
</script>