Merge branch 'master' of git.hjp.at:hjp/ltsdb

This commit is contained in:
Peter J. Holzer 2023-02-04 14:30:59 +01:00 committed by Peter J. Holzer
commit e0a1913a64
1 changed files with 4 additions and 1 deletions

View File

@ -176,6 +176,7 @@ class TimeSeries(Widget):
x0 = tickmarks[-1]["x"] x0 = tickmarks[-1]["x"]
d0 = datetime.datetime.fromtimestamp(t0) d0 = datetime.datetime.fromtimestamp(t0)
log.debug("step_i = %s", step_i)
if steps[step_i] == "s": if steps[step_i] == "s":
d1 = datetime.datetime(d0.year, d0.month, d0.day, d0.hour, d0.minute, d0.second) d1 = datetime.datetime(d0.year, d0.month, d0.day, d0.hour, d0.minute, d0.second)
t1 = d1.timestamp() t1 = d1.timestamp()
@ -287,6 +288,7 @@ class TimeSeries(Widget):
t1 = d1.timestamp() t1 = d1.timestamp()
x1 = t2x(t1) x1 = t2x(t1)
if x0 - x1 < min_step: if x0 - x1 < min_step:
log.debug("t0 = %s, x0 = %s, t1 = %s, x1 = %s", t0, x0, t1, x1)
step_i += 1 step_i += 1
continue continue
if x1 < 0: if x1 < 0:
@ -383,7 +385,7 @@ class TimeSeries(Widget):
log.debug("") log.debug("")
log.debug("in graph") log.debug("in graph for %s", self.lts.id)
data = self.lts.data data = self.lts.data
n = len(data) n = len(data)
t_last = data[-1][0] t_last = data[-1][0]
@ -391,6 +393,7 @@ class TimeSeries(Widget):
return "(not enough data)" return "(not enough data)"
dt = (t_last - data[-5][0]) / 4 dt = (t_last - data[-5][0]) / 4
k = math.log((t_last - data[0][0]) / dt / n + 1) k = math.log((t_last - data[0][0]) / dt / n + 1)
log.debug("times = [%s ... %s ... %s]", data[0][0], data[-5][0], data[-1][0])
max_value = max([d[3] if len(d) >= 4 else d[1] for d in self.lts.data]) max_value = max([d[3] if len(d) >= 4 else d[1] for d in self.lts.data])
max_value = max(max_value, 0.001) # ensure positive max_value = max(max_value, 0.001) # ensure positive