linx5o commited on
Commit
cdf65a4
·
1 Parent(s): 5d6aa39

added radio button to allow for change to the amount of data shown on temp

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -545,8 +545,10 @@ if st.session_state["experiment"] is not None:
545
  temp_graph_actual = []
546
 
547
  st.subheader("Temperature Graph")
 
548
  placeholder = st.empty()
549
 
 
550
  while True:
551
  temp_graph = None
552
 
@@ -567,6 +569,14 @@ if st.session_state["experiment"] is not None:
567
  local_time = utc_time.astimezone(local_tz)
568
  temp["x"] = local_time.strftime("%Y-%m-%d %H:%M:%S")
569
 
 
 
 
 
 
 
 
 
570
  df = pd.DataFrame(temp_graph)
571
  df = df.set_index("x")
572
 
 
545
  temp_graph_actual = []
546
 
547
  st.subheader("Temperature Graph")
548
+ amount_of_data = st.radio("Amount of data", ["1 hour", "24 hours", "All data"], index=1)
549
  placeholder = st.empty()
550
 
551
+
552
  while True:
553
  temp_graph = None
554
 
 
569
  local_time = utc_time.astimezone(local_tz)
570
  temp["x"] = local_time.strftime("%Y-%m-%d %H:%M:%S")
571
 
572
+ # Filter the data based on the amount of data requested
573
+ # Data is in 4 minute intervals
574
+ if amount_of_data == "1 hour" and len(temp_graph) > 15:
575
+ temp_graph = temp_graph[-15:]
576
+ elif amount_of_data == "24 hours" and len(temp_graph) > 360:
577
+ temp_graph = temp_graph[-360:]
578
+
579
+
580
  df = pd.DataFrame(temp_graph)
581
  df = df.set_index("x")
582