Skip to content

Commit

Permalink
Autoscale the x-axis on graphs
Browse files Browse the repository at this point in the history
  • Loading branch information
jcalvinowens committed Mar 12, 2024
1 parent 07acb25 commit b69433d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions backend/http_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,14 @@ def send_error(self, code, explain=""):
self.wfile.write(explain)

def gnuplot_temperature(self, ext, start_epoch, end_epoch, x, y, locs=None):
xtics = (end_epoch - start_epoch) // 6

xarr = [
plots.gnuplot_preamble(ext or "svg", x, y),
plots.gnuplot_colors(),
plots.gnuplot_plot_preamble("Temperature Sensor Data",
"UTC Time", "Temperature (F)"),
"UTC Time", "Temperature (F)",
xtics=xtics),
]

if locs is None or (len(locs) == 1 and locs[0] == ''):
Expand All @@ -69,11 +72,14 @@ def gnuplot_temperature(self, ext, start_epoch, end_epoch, x, y, locs=None):
return plots.gnuplot(*xarr)

def gnuplot_humidity(self, ext, start_epoch, end_epoch, x, y, locs=None):
xtics = (end_epoch - start_epoch) // 6

xarr = [
plots.gnuplot_preamble(ext or "svg", x, y),
plots.gnuplot_colors(),
plots.gnuplot_plot_preamble("Humidity Sensor Data",
"UTC Time", "Relative Humidity (%)"),
"UTC Time", "Relative Humidity (%)",
xtics=xtics),
]

if locs is None or (len(locs) == 1 and locs[0] == ''):
Expand Down

0 comments on commit b69433d

Please sign in to comment.