

// template for charts - working on

function loadChart() {

    var chartData = [];
    var yAxis = [];

    chartData[0] = 70.0;
    chartData[1] = 71.0;
    chartData[2] = 72.0;
    chartData[3] = 73.0;
    chartData[4] = 74.0;
    chartData[5] = 75.0;
    chartData[6] = 76.0;
    chartData[7] = 77.0;
    chartData[8] = 78.0;
    chartData[9] = 79.0;
    chartData[10] = 80.0;
    chartData[11] = 79.0;
    chartData[12] = 78.0;
    chartData[13] = 77.0;
    chartData[14] = 76.0;
    chartData[15] = 75.0;
    chartData[16] = 74.0;
    chartData[17] = 73.0;
    chartData[18] = 72.0;
    chartData[19] = 71.0;
    chartData[20] = 70.0;

    yAxis[0] = 69.0;
    yAxis[1] = 71.0;
    yAxis[2] = 73.0;
    yAxis[3] = 75.0;
    yAxis[4] = 77.1;
    yAxis[5] = 79.0;
    yAxis[6] = 81.0;

    // for (var i=0; i < yAxis.length; i++)  // draw a reservoir for each dosing pump
    // {
    //     document.getElementById('chartYaxis').innerHTML += "</br>" + yAxis[i];
    // }

    // for (var i=0; i < 5; i++)  // draw a reservoir for each dosing pump
    // {
    //     document.getElementById('chartData').innerHTML += "</br>test_" + i;
    // }

    var c = document.getElementById("myCanvas");

    // var c = document.getElementsByTagName('myCanvas')[0];
    c.width  = 800;
    c.height = 240;

    // canvas.width  = 400;
    // canvas.height = 300; 
    c.style.width  = '80%';
    c.style.height = '240px';

    var ctx = c.getContext("2d");
    ctx.beginPath();
    ctx.moveTo(10, 0);
    ctx.lineTo(200, 150);
    ctx.stroke();

}

// function DS18B20incoming(id, temp, humidity, min, max){  // continually update sensor data coming from backend
//     // console.log('updateDS18B2 = ' + id + ", " + temp + ", " + humidity + ", " + min + ", " + max);
//     // console.log('ds18b20AddrFound[i]   = ' + ds18b20AddrFound);
//     for(var i in ds18b20AddrFound) {  // 
//         if ((ds18b20AddrFound[i] == id) && (temp != 999999)) {  // check ID's match and sensor isn't missing
//             ds18b20Temp[i] = temp;  // clear temps
//             ds18b20Humidity[i] = humidity;  // clear temps
//             ds18b20Min[i] = min;  // clear min
//             ds18b20Max[i] = max;  // clear max
//             break;
//         }
//         i++;
//     }
// }
