Skip to content

Commit 2499e2b

Browse files
committed
Added ToDo comment on why offset traces now ignore extend_to_present (this has confused contribuitors)
1 parent b2eb71c commit 2499e2b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/cache/Cache.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ export default class Cache {
161161
// and https://github.com/dbuezas/lovelace-plotly-graph-card/commit/3d915481002d03011bcc8409c2dcc6e6fb7c8674#r94899109
162162
y === "unavailable" || y === "none" || y === "unknown" ? null : y
163163
);
164+
/**
165+
* ToDo: offset traces should also be extended, but only up to the limits of the fetched range
166+
* Otherwise, the datapoint can go way into the future and mess up auto-ranging.
167+
*/
164168
if (entity.extend_to_present && data.xs.length > 0 && entity.offset === 0) {
165169
const last_i = data.xs.length - 1;
166170
data.xs.push(new Date(Date.now() + entity.offset));

0 commit comments

Comments
 (0)