From 31f1031470d62ce5dfa02c9c0269dc660e52e55b Mon Sep 17 00:00:00 2001
From: Stephen Farry <stephen.farry@gmail.com>
Date: Wed, 29 Apr 2020 11:39:03 +0100
Subject: [PATCH] updates to index and chart display

---
 raspberry-backend/static/js/Chart-display.js | 18 ++++++++++++------
 raspberry-backend/templates/index.html       |  2 +-
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/raspberry-backend/static/js/Chart-display.js b/raspberry-backend/static/js/Chart-display.js
index b19a3eff..996bfa5c 100644
--- a/raspberry-backend/static/js/Chart-display.js
+++ b/raspberry-backend/static/js/Chart-display.js
@@ -28,6 +28,10 @@ function setChartXaxisRange(min,max){
     
 }
 
+
+var fillGauges = new Boolean(document.getElementById("example_gauge"));
+
+
 function init_results(){
     $.getJSON({
         url: '/last_N_data',
@@ -94,10 +98,11 @@ function requestChartVar() {
     $.ajax({
         url: '/live-data',
         success: function(point) {
-        fio_reading = (point["pressure_buffer"]).toFixed(0) ;
-        //console.log(fio_reading);
-        fio_gauge.data.datasets[0].gaugeData['value'] = fio_reading;
-
+	    if(fillGauges == true){
+		fio_reading = (point["pressure_buffer"]).toFixed(0) ;
+		//console.log(fio_reading);
+		fio_gauge.data.datasets[0].gaugeData['value'] = fio_reading;
+	    }
         var seconds = point["timestamp"]/1000;
 	    // get difference between last time stamp and this and apply to existing points
 	    var diff = 0;
@@ -134,7 +139,7 @@ function requestChartVar() {
             chart_pressure.update();
             chart_flow.update();
             chart_volume.update();
-            fio_gauge.update();
+            if (fillGauges == true) fio_gauge.update();
 
         },
         cache: false
@@ -373,7 +378,7 @@ $(document).ready(function() {
     });
 });
 
-
+if (fillGauges == true){
 var ctx = document.getElementById("example_gauge").getContext("2d");
 fio_gauge = new Chart(ctx, {
 	type: "tsgauge",
@@ -392,4 +397,5 @@ fio_gauge = new Chart(ctx, {
 		events: []
 	}
 });
+}
 
diff --git a/raspberry-backend/templates/index.html b/raspberry-backend/templates/index.html
index a18751bc..7ff94844 100644
--- a/raspberry-backend/templates/index.html
+++ b/raspberry-backend/templates/index.html
@@ -45,7 +45,7 @@
               </div>
 	      <!--<div class="small ml-auto mr-auto">PC-A/C</div>-->
               <div class="card-body px-1 py-1">
-		<div class = "select-container">
+		<div class = "select-container" disabled>
 		  <select class = "input-reading ml-auto mr-auto input-editable pickout" name="VentilatorMode" id="vent_mode" pickouttitle="Select Ventilator Mode" width="10%">
 		  <option value = ""></option>
 		  <optgroup label = "Pressure Control Modes">
-- 
GitLab