Exemplo n.º 1
0
</canvas>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="kalleCanvas.js" type="text/javascript"></script>
<script type="text/javascript">
var main = function() {
  //var s = <?php 
echo temp("tblCurrentTemp");
?>
;
  //$.getScript("kalleCanvas.js",function() {
    //drawMark(60,s,'x');
  //});

  var t = <?php 
echo json_encode(temp_array());
?>
;
  var arrayLength = t.length;
  var x_led = 10;
  var arrowLength = 80;
  var scaleFactor = arrowLength / Math.max.apply(null,t.map(Math.abs));
  for (i = 0;i < arrayLength-1; i= i +1) {
    var value = t[i];
    $.getScript("kalleCanvas.js",function() {
    drawMark(x_led,value,'.',scaleFactor);
    x_led = x_led + 15;
    });
  }
}
$(document).ready(main);
Exemplo n.º 2
0
    }
    mysqli_close($con);
    return $TEMP_ARRAY;
    exit;
}
?>

<script>

function ritaGraf(){
        var array = <?php 
echo json_encode(temp_array('Temperatur', 'tblHTemp'));
?>
;
        var lastUpdateArray = <?php 
echo json_encode(temp_array('LastUpdate', 'tblHTemp'));
?>
;
        var labelar = []
        for (i=0;i<lastUpdateArray.length;i++) {
                var textSlice = lastUpdateArray[i];
                textSlice = textSlice.slice(11,13)
                labelar[i] = textSlice;
        }
        var data = {
                labels: labelar.reverse(),
                //labels: lastUpdateArray,
                datasets: [
                                {
                                        label: "My First dataset",
                                        fillColor: "rgba(220,220,220,0.2)",