Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
baccdbd826 | ||
|
|
18aa0686c0 | ||
|
|
5a419b64dd |
No files matched your search
+185
-34
@@ -1064,44 +1064,115 @@
|
||||
// the last one. The marker is free to sit outside the band — just went (left
|
||||
// of shortest) or overdue (right of typical) — which is the reading that
|
||||
// decides whether to take the puppy out now.
|
||||
//
|
||||
// The last two rows measure a response rather than a rhythm: from waking to
|
||||
// the pee after it, and from a meal to the poo after it. Those are what say
|
||||
// when to take him out, where the plain gaps only say how often.
|
||||
const TIMING_ROWS = [
|
||||
{ type: "pee", label: "Pees", noun: "pee", cls: "tm-pee" },
|
||||
{ type: "poo", label: "Poos", noun: "poo", cls: "tm-poo" },
|
||||
{ type: "eat", label: "Meals", noun: "meal", cls: "tm-eat" },
|
||||
{ id: "pee", type: "pee", label: "Pees", noun: "pee", cls: "tm-pee" },
|
||||
{ id: "poo", type: "poo", label: "Poos", noun: "poo", cls: "tm-poo" },
|
||||
{ id: "eat", type: "eat", label: "Meals", noun: "meal", cls: "tm-eat" },
|
||||
{ id: "wake-pee", label: "Waking → pee", cls: "tm-pee",
|
||||
from: "sleep-end", to: "pee", until: "sleep-start",
|
||||
between: "from waking to a pee", sinceText: "since he woke",
|
||||
nowLabel: (d) => `awake ${d}`,
|
||||
empty: "No pee logged after a wake-up" },
|
||||
{ id: "eat-poo", label: "Meal → poo", cls: "tm-poo",
|
||||
from: "eat", to: "poo", until: "eat",
|
||||
between: "from a meal to a poo", sinceText: "since the last meal",
|
||||
nowLabel: (d) => `ate ${d} ago`,
|
||||
empty: "No poo logged after a meal" },
|
||||
];
|
||||
|
||||
// Time from each `from` event to the first `to` after it, for the rows that
|
||||
// measure a response. A `from` gets no gap if an `until` comes first — he
|
||||
// went back to sleep without a pee, or ate again before the poo — since the
|
||||
// `to` that follows can't be told apart from a response to the later one.
|
||||
// Same-day only, like gapsBetween: a meal at nine and the next morning's poo
|
||||
// are not cause and effect.
|
||||
//
|
||||
// `pending` is the wait in progress: the latest `from` today with nothing
|
||||
// after it yet. That is when the marker is worth showing; once the pee has
|
||||
// happened there is nothing to wait for, so the row shows the band alone.
|
||||
function gapsAfter(events, { from, to, until }, days = chartDays()) {
|
||||
const cutoff = startOfDay(new Date());
|
||||
cutoff.setDate(cutoff.getDate() - (days - 1));
|
||||
// A `to` logged in the same minute as its `from` (a quick-logged pee on
|
||||
// waking) must sort after it to be counted as the response.
|
||||
const rank = (t) => (t === from ? 0 : 1);
|
||||
const evs = events
|
||||
.filter(e => e.type === from || e.type === to || e.type === until)
|
||||
.sort((a, b) => a.at - b.at || rank(a.type) - rank(b.type));
|
||||
const gaps = [];
|
||||
let open = null;
|
||||
for (const e of evs) {
|
||||
if (open != null && e.type === to) {
|
||||
if (open >= cutoff.getTime() && !spansExcluded(open, e.at) &&
|
||||
ymd(new Date(open)) === ymd(new Date(e.at))) {
|
||||
gaps.push(e.at - open);
|
||||
}
|
||||
open = null;
|
||||
} else if (e.type === from) {
|
||||
open = e.at;
|
||||
} else if (e.type === until) {
|
||||
open = null;
|
||||
}
|
||||
}
|
||||
const pending = open != null && ymd(new Date(open)) === ymd(new Date()) && !isExcluded(new Date(open))
|
||||
? Math.max(0, Date.now() - open) : null;
|
||||
return { gaps: gaps.sort((a, b) => a - b), pending };
|
||||
}
|
||||
|
||||
function renderTiming(events) {
|
||||
for (const row of TIMING_ROWS) {
|
||||
const svg = document.getElementById(`timing-chart-${row.type}`);
|
||||
const note = document.getElementById(`timing-note-${row.type}`);
|
||||
const svg = document.getElementById(`timing-chart-${row.id}`);
|
||||
const note = document.getElementById(`timing-note-${row.id}`);
|
||||
if (!svg || !note) continue;
|
||||
if (row.from) {
|
||||
const { gaps, pending } = gapsAfter(events, row);
|
||||
const empty = `${row.empty} in the last ${chartDays()} days yet.` +
|
||||
(pending == null ? "" : ` It has been ${formatDuration(pending)} ${row.sinceText}.`);
|
||||
drawTimingChart(svg, note, row, gaps, pending, empty);
|
||||
continue;
|
||||
}
|
||||
const gaps = gapsBetween(events, row.type);
|
||||
const last = lastEventOfType(events, row.type);
|
||||
drawTimingChart(svg, note, row, gaps, last ? Math.max(0, Date.now() - last.at) : null, events);
|
||||
const since = last ? Math.max(0, Date.now() - last.at) : null;
|
||||
drawTimingChart(svg, note, row, gaps, since, timingEmptyNote(events, row, since));
|
||||
}
|
||||
}
|
||||
|
||||
function drawTimingChart(svg, note, row, gaps, since, events) {
|
||||
// Why a plain-gap row has nothing to draw. Several logged but none sharing a
|
||||
// day (one meal a day, say) is a different case from one logged: every gap
|
||||
// there was overnight.
|
||||
function timingEmptyNote(events, row, since) {
|
||||
const cutoff = startOfDay(new Date());
|
||||
cutoff.setDate(cutoff.getDate() - (chartDays() - 1));
|
||||
const inWindow = events.filter(e => e.type === row.type && e.at >= cutoff.getTime()).length;
|
||||
return since == null
|
||||
? `No ${row.noun}s logged in the last ${chartDays()} days.`
|
||||
: inWindow >= 2
|
||||
? `No two ${row.noun}s on the same day in the last ${chartDays()} days — the gap overnight isn't counted, so there is nothing to measure yet.`
|
||||
: `One ${row.noun} logged, ${formatDuration(since)} ago — log another to see the typical gap.`;
|
||||
}
|
||||
|
||||
function drawTimingChart(svg, note, row, gaps, since, emptyText) {
|
||||
const typical = median(gaps);
|
||||
const shortest = gaps[0] ?? null;
|
||||
const longest = gaps[gaps.length - 1] ?? null;
|
||||
// The words differ between a rhythm row ("between pees") and a response
|
||||
// row ("from waking to a pee"); the chart itself doesn't.
|
||||
const between = row.between ?? `between ${row.noun}s`;
|
||||
const sinceText = row.sinceText ?? `since the last ${row.noun}`;
|
||||
const nowLabel = row.nowLabel ?? ((d) => `${d} ago`);
|
||||
|
||||
// Fewer than two events in the window means there is no gap to draw, so the
|
||||
// row falls back to a sentence rather than an axis with nothing on it.
|
||||
// No gap in the window means nothing to draw, so the row falls back to a
|
||||
// sentence rather than an axis with nothing on it.
|
||||
if (typical == null) {
|
||||
svg.innerHTML = "";
|
||||
svg.style.display = "none";
|
||||
note.hidden = false;
|
||||
// Several logged but none sharing a day (one meal a day, say) is a
|
||||
// different case from one logged: every gap there was overnight.
|
||||
const cutoff = startOfDay(new Date());
|
||||
cutoff.setDate(cutoff.getDate() - (chartDays() - 1));
|
||||
const inWindow = events.filter(e => e.type === row.type && e.at >= cutoff.getTime()).length;
|
||||
note.textContent = since == null
|
||||
? `No ${row.noun}s logged in the last ${chartDays()} days.`
|
||||
: inWindow >= 2
|
||||
? `No two ${row.noun}s on the same day in the last ${chartDays()} days — the gap overnight isn't counted, so there is nothing to measure yet.`
|
||||
: `One ${row.noun} logged, ${formatDuration(since)} ago — log another to see the typical gap.`;
|
||||
note.textContent = emptyText;
|
||||
return;
|
||||
}
|
||||
svg.style.display = "";
|
||||
@@ -1145,9 +1216,9 @@
|
||||
const parts = [
|
||||
`<rect class="tm-track" x="${ML}" y="${trackY}" width="${innerW}" height="${trackH}" rx="${trackH / 2}"/>`,
|
||||
bandRect(`tm-range ${row.cls}`, xShort, xLong,
|
||||
`<title>${escapeText(`${formatDuration(shortest)}–${formatDuration(longest)} between ${row.noun}s over the last ${chartDays()} days`)}</title>`),
|
||||
`<title>${escapeText(`${formatDuration(shortest)}–${formatDuration(longest)} ${between} over the last ${chartDays()} days`)}</title>`),
|
||||
bandRect(`tm-band ${row.cls}`, xShort, xTypical,
|
||||
`<title>${escapeText(`Typically ${formatDuration(typical)} between ${row.noun}s`)}</title>`),
|
||||
`<title>${escapeText(`Typically ${formatDuration(typical)} ${between}`)}</title>`),
|
||||
];
|
||||
|
||||
// Ticks tie the summary line under the track to the three points it names.
|
||||
@@ -1183,7 +1254,7 @@
|
||||
parts.push(`<line class="tm-now-ring" x1="${x.toFixed(1)}" y1="${y1}" x2="${x.toFixed(1)}" y2="${y2}"/>`);
|
||||
parts.push(
|
||||
`<line class="tm-now" x1="${x.toFixed(1)}" y1="${y1}" x2="${x.toFixed(1)}" y2="${y2}">` +
|
||||
`<title>${escapeText(`${formatDuration(since)} since the last ${row.noun}`)}</title></line>`
|
||||
`<title>${escapeText(`${formatDuration(since)} ${sinceText}`)}</title></line>`
|
||||
);
|
||||
if (over) {
|
||||
parts.push(
|
||||
@@ -1194,15 +1265,15 @@
|
||||
const anchor = x < ML + 55 ? "start" : (x > W - MR - 55 ? "end" : "middle");
|
||||
parts.push(
|
||||
`<text class="tm-now-label" x="${x.toFixed(1)}" y="11" text-anchor="${anchor}">` +
|
||||
`${escapeText(`${formatDuration(since)} ago`)}</text>`
|
||||
`${escapeText(nowLabel(formatDuration(since)))}</text>`
|
||||
);
|
||||
}
|
||||
|
||||
svg.innerHTML = parts.join("");
|
||||
svg.setAttribute("aria-label",
|
||||
`${row.label}: typically ${formatDuration(typical)} between ${row.noun}s, ` +
|
||||
`${row.label}: typically ${formatDuration(typical)} ${between}, ` +
|
||||
`shortest ${formatDuration(shortest)}, longest ${formatDuration(longest)}` +
|
||||
(since == null ? "" : `, ${formatDuration(since)} since the last one`) + ".");
|
||||
(since == null ? "" : `, ${formatDuration(since)} ${sinceText}`) + ".");
|
||||
}
|
||||
|
||||
function renderLasts(events) {
|
||||
@@ -2068,9 +2139,77 @@
|
||||
}
|
||||
});
|
||||
|
||||
// The same fit the food chart draws, for "is he sleeping less as he
|
||||
// grows?". A day with no sleep at all is left out as well as today and the
|
||||
// marked ones: a puppy never sleeps 0h, so it is a day nobody logged, and
|
||||
// fitting it as a real zero would drag the line through the floor.
|
||||
const trend = dailyTrend(days, d => d.sleepHours > 0 ? d.sleepHours : null);
|
||||
if (trend) parts.push(trendLineSVG("sleep-trend", trend, { ML, MT, innerH, barW, gap, yMax }));
|
||||
const blank = days.filter((d, i) => i < days.length - 1 && !d.excluded && !(d.sleepHours > 0)).length;
|
||||
renderTrendNote("sleep-note", sleepTrendSentence(trend, chartDays()), blank, "with no sleep logged");
|
||||
|
||||
setChartSVG(svg, parts);
|
||||
}
|
||||
|
||||
// The food trend's rules in other units: figures rounded to a step (the
|
||||
// fitted ends are the line's guess, not a reading — `step` hours for sleep,
|
||||
// minutes for walks), and no direction claimed unless the move outruns the
|
||||
// day-to-day scatter and is at least `minChange`, worth acting on.
|
||||
function amountTrendSentence(trend, windowDays, { what, step, minChange, fmt }) {
|
||||
const window = `the last ${windowDays} days`;
|
||||
if (!trend) {
|
||||
return `Not enough complete days in ${window} to draw a trend — it needs four, and today doesn't count until it's over.`;
|
||||
}
|
||||
const round = (v) => Math.round(Math.max(0, v) / step) * step;
|
||||
const amount = (v) => fmt(round(v));
|
||||
const slight = Math.abs(trend.change) < minChange || Math.abs(trend.change) < trend.mean * 0.05;
|
||||
if (!trend.clear || slight) {
|
||||
return `Over ${window}, ${what} is roughly steady, averaging about ${amount(trend.mean)} a day` +
|
||||
` — day-to-day variation is larger than any trend.`;
|
||||
}
|
||||
// From the rounded ends, so the two figures on screen subtract to the one quoted.
|
||||
const from = round(trend.at(trend.first));
|
||||
const to = round(trend.at(trend.last));
|
||||
if (from === to) {
|
||||
return `Over ${window}, ${what} is roughly steady at about ${fmt(from)} a day.`;
|
||||
}
|
||||
return `Over ${window}, ${what} is ${to > from ? "up" : "down"} about ${fmt(Math.abs(to - from))}` +
|
||||
` — from roughly ${fmt(from)} a day to ${fmt(to)}.`;
|
||||
}
|
||||
|
||||
function sleepTrendSentence(trend, windowDays) {
|
||||
return amountTrendSentence(trend, windowDays,
|
||||
{ what: "daily sleep", step: 0.5, minChange: 0.25, fmt: (h) => `${h}h` });
|
||||
}
|
||||
function walkTrendSentence(trend, windowDays) {
|
||||
return amountTrendSentence(trend, windowDays,
|
||||
{ what: "daily walking", step: 5, minChange: 5, fmt: (m) => formatDuration(m * 60_000) });
|
||||
}
|
||||
|
||||
// Says, after the sentence, how many days the line was not fitted on and
|
||||
// why, so an empty bar isn't taken for data the line ignored.
|
||||
function renderTrendNote(noteId, sentence, skipped, reason) {
|
||||
const note = document.getElementById(noteId);
|
||||
if (!note) return;
|
||||
const lines = [sentence];
|
||||
if (skipped > 0) {
|
||||
lines.push(`${skipped} ${skipped === 1 ? "day" : "days"} ${reason} ${skipped === 1 ? "is" : "are"} left out.`);
|
||||
}
|
||||
note.textContent = lines.join(" ");
|
||||
note.hidden = false;
|
||||
}
|
||||
|
||||
// The dashed fit, over the days it was fitted on and clamped to the plot so
|
||||
// a steep one can't draw outside the axes. Shared by the sleep and walk bars,
|
||||
// which lay out their slots the same way.
|
||||
function trendLineSVG(cls, trend, { ML, MT, innerH, barW, gap, yMax }) {
|
||||
const cx = (i) => ML + i * (barW + gap) + barW / 2;
|
||||
const cy = (v) => MT + innerH * (1 - Math.min(Math.max(v, 0), yMax) / yMax);
|
||||
return `<line class="${cls}" ` +
|
||||
`x1="${cx(trend.first).toFixed(1)}" y1="${cy(trend.at(trend.first)).toFixed(1)}" ` +
|
||||
`x2="${cx(trend.last).toFixed(1)}" y2="${cy(trend.at(trend.last)).toFixed(1)}"/>`;
|
||||
}
|
||||
|
||||
function drawCountsChart(days) {
|
||||
const svg = document.getElementById("chart-counts");
|
||||
const W = 320, H = 180;
|
||||
@@ -2150,14 +2289,16 @@
|
||||
// up over the day — a moving line that reflects the clock rather than the
|
||||
// puppy. The line is drawn only across the days it was fitted on, so it never
|
||||
// implies it knows about the ones it skipped.
|
||||
// valueOf picks which figure to fit: the day total by default, or one
|
||||
// kind's share of it when the bars are split.
|
||||
function foodTrend(days, valueOf = (d) => d.grams) {
|
||||
// valueOf picks which figure to fit: one food kind's grams, or the day's
|
||||
// sleep hours. It may return null to leave a day out of the fit altogether.
|
||||
function dailyTrend(days, valueOf) {
|
||||
const pts = [];
|
||||
days.forEach((d, i) => {
|
||||
if (d.excluded) return;
|
||||
if (i === days.length - 1) return; // today, still being eaten
|
||||
pts.push({ x: i, y: valueOf(d) });
|
||||
if (i === days.length - 1) return; // today, still in progress
|
||||
const y = valueOf(d);
|
||||
if (y == null) return;
|
||||
pts.push({ x: i, y });
|
||||
});
|
||||
// Two points always fit a line perfectly and say nothing; four is the least
|
||||
// that can show a direction rather than a coincidence.
|
||||
@@ -2340,7 +2481,7 @@
|
||||
of: (d) => d.gramsByKind?.[NO_KIND] || 0,
|
||||
});
|
||||
}
|
||||
for (const s of out) s.trend = foodTrend(days, s.of);
|
||||
for (const s of out) s.trend = dailyTrend(days, s.of);
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -2452,7 +2593,7 @@
|
||||
|
||||
// One sentence per kind would grow with the list and bury the answer, so
|
||||
// only kinds with something to report get a sentence of their own and the
|
||||
// rest are folded into a clause. Both rules are foodTrend's, not new ones:
|
||||
// rest are folded into a clause. Both rules are dailyTrend's, not new ones:
|
||||
// a kind with too few days has no fit, and one whose move is under its own
|
||||
// scatter is not claimed.
|
||||
function foodSeriesSentences(series, windowDays) {
|
||||
@@ -2503,7 +2644,7 @@
|
||||
|
||||
// Minutes walked per day. Hidden until there's a walk to show, like the
|
||||
// grams chart — no point in an empty panel for someone who doesn't log walks.
|
||||
function drawWalkChart(days) {
|
||||
function drawWalkChart(days, firstWalkYmd) {
|
||||
const wrap = document.getElementById("walk-chart-wrap");
|
||||
const svg = document.getElementById("chart-walk");
|
||||
if (!days.some(d => d.walkMinutes > 0)) { wrap.hidden = true; return; }
|
||||
@@ -2556,6 +2697,15 @@
|
||||
}
|
||||
});
|
||||
|
||||
// Unlike sleep, a day with no walk is a real figure — a rest day, a wet
|
||||
// one — so zeros are fitted. What isn't is the days before the first walk
|
||||
// ever logged: those are from before anyone was tracking walks, and would
|
||||
// start the line at zero and show a climb that never happened.
|
||||
const trend = dailyTrend(days, d => d.ymd < firstWalkYmd ? null : d.walkMinutes);
|
||||
if (trend) parts.push(trendLineSVG("walk-trend-line", trend, { ML, MT, innerH, barW, gap, yMax }));
|
||||
const before = days.filter((d, i) => i < days.length - 1 && !d.excluded && d.ymd < firstWalkYmd).length;
|
||||
renderTrendNote("walk-note", walkTrendSentence(trend, chartDays()), before, "from before the first walk was logged");
|
||||
|
||||
setChartSVG(svg, parts);
|
||||
}
|
||||
|
||||
@@ -2563,7 +2713,8 @@
|
||||
const days = weeklyData(events);
|
||||
drawSleepChart(days);
|
||||
drawCountsChart(days);
|
||||
drawWalkChart(days);
|
||||
const firstWalk = events.reduce((m, e) => e.type === "walk-start" && (m == null || e.at < m) ? e.at : m, null);
|
||||
drawWalkChart(days, firstWalk == null ? "" : ymd(new Date(firstWalk)));
|
||||
drawGramsChart(days);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
[
|
||||
{ "date": "2026-09-29", "text": "The Timing panel on Habits has two new rows, Waking → pee and Meal → poo, for the question the plain gaps can't answer: not how often he goes, but how soon after waking up or eating. Each measures from a wake-up to the next pee, or from a meal to the next poo, over the same 7 / 14 / 30 days as the rest of the panel, and shows the shortest, typical and longest wait. If he naps again before peeing, or eats again before pooing, that one isn't counted, since there is no telling which it was a response to; nor is anything that runs past midnight. While you are waiting on one — he woke up and hasn't peed, or he has eaten and hasn't pooed — a marker shows how long it has been (“awake 12m”, “ate 25m ago”), so a marker past the typical point means now is the time to go out. Once the pee or poo is logged the marker goes away until the next wake-up or meal" },
|
||||
{ "date": "2026-09-29", "text": "The Walks chart (minutes per day) has a trend line too, with a sentence under it in the same style as the sleep one: “daily walking is up about 20m — from roughly 35m a day to 55m”, or roughly steady with the average when the days vary more than they move. A day with no walk counts as a real zero — a rest day is a real figure — but the days before the very first walk you logged are left out, so starting to track walks partway through the window doesn't read as a sudden climb. Today and days marked “not counted” are left out as on every other trend" },
|
||||
{ "date": "2026-09-29", "text": "The Sleep chart on the Sleep tab has a trend line through it, like the Food (grams) chart, so you can see whether he is sleeping less as he grows — the day-to-day bars vary enough to hide a steady change. A line under the chart puts it in figures: “daily sleep is down about 1.5h — from roughly 17h a day to 15.5h”, or, when the days scatter more than they move, that it is roughly steady and what the average is. Today is left out until it's over, as are days marked “not counted” and days with no sleep logged at all, which the sentence mentions so an empty bar isn't mistaken for a night without sleep. It follows the 7 / 14 / 30 day picker like the rest of the charts" },
|
||||
{ "date": "2026-09-29", "text": "The Timing panel no longer counts the night. The gap from each day's last pee, poo or meal to the next morning's first was being measured like any other, so every window held several eight-hour-plus “gaps” that were really just bedtime — the longest figure was a sleep figure and the typical gap was pulled up with it. Only gaps within a single day are measured now, so the bars show how often he needs to go out while he's up and about. The “since the last one” marker is unchanged, so first thing in the morning it still reads as overdue — which, before the first trip out, it is" },
|
||||
{ "date": "2026-09-26", "text": "Tapping the tab you are already on scrolls back to the top of the page, the way it does in most phone apps — handy after scrolling a long way down Habits or the history. Switching to a different tab still leaves you where you were, as before" },
|
||||
{ "date": "2026-09-24", "text": "Kinds of food are now created in one place only — Settings → Food kinds. The Ate dialog no longer has a box for inventing one on the spot; it still lets you pick from the kinds you have, exactly as before. Making them mid-meal put a bit of list-keeping in the middle of logging, where the thing you actually came to do is record that the dog ate, and a kind typed in a hurry is easy to get slightly wrong — nothing stops two near-identical kinds existing, and clearing one up afterwards means relabelling every meal logged under it first" },
|
||||
|
||||
+19
-3
@@ -301,7 +301,9 @@
|
||||
<h2>Sleep <span class="muted-note" data-chart-days-label>(last 7 days)</span></h2>
|
||||
<div class="chart">
|
||||
<div class="chart-title">Hours per day</div>
|
||||
<svg id="chart-sleep" class="chart-svg" viewBox="0 0 320 160" role="img" aria-label="Sleep hours per day"></svg>
|
||||
<svg id="chart-sleep" class="chart-svg" viewBox="0 0 320 160" role="img" aria-label="Sleep hours per day, with a trend line"></svg>
|
||||
<!-- What the trend line says — see renderSleepTrendNote. -->
|
||||
<p id="sleep-note" class="muted-note" hidden></p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -332,7 +334,9 @@
|
||||
<p id="walk-empty" class="empty">No walks yet for this day. Use 🦮 Walk start / 🏁 Walk end to time one.</p>
|
||||
<div class="chart walk-chart" id="walk-chart-wrap" hidden>
|
||||
<div class="chart-title">Minutes per day <span data-chart-days-label>(last 7 days)</span></div>
|
||||
<svg id="chart-walk" class="chart-svg" viewBox="0 0 320 160" role="img" aria-label="Minutes walked per day"></svg>
|
||||
<svg id="chart-walk" class="chart-svg" viewBox="0 0 320 160" role="img" aria-label="Minutes walked per day, with a trend line"></svg>
|
||||
<!-- What the trend line says — see renderTrendNote. -->
|
||||
<p id="walk-note" class="muted-note" hidden></p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -380,10 +384,22 @@
|
||||
<svg id="timing-chart-eat" class="timing-chart" viewBox="0 0 320 50" role="img"></svg>
|
||||
<p class="muted-note timing-note" id="timing-note-eat" hidden></p>
|
||||
</div>
|
||||
<!-- Response times rather than rhythms: how soon after waking he
|
||||
pees, and after eating he poos — see gapsAfter. -->
|
||||
<div class="timing-item">
|
||||
<div class="timing-name">Waking → pee</div>
|
||||
<svg id="timing-chart-wake-pee" class="timing-chart" viewBox="0 0 320 50" role="img"></svg>
|
||||
<p class="muted-note timing-note" id="timing-note-wake-pee" hidden></p>
|
||||
</div>
|
||||
<div class="timing-item">
|
||||
<div class="timing-name">Meal → poo</div>
|
||||
<svg id="timing-chart-eat-poo" class="timing-chart" viewBox="0 0 320 50" role="img"></svg>
|
||||
<p class="muted-note timing-note" id="timing-note-eat-poo" hidden></p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- The axis is stretched (see drawTimingChart), so say what the middle
|
||||
of a bar means rather than leave it to be inferred. -->
|
||||
<p class="muted-note">The middle of every bar is that type's typical gap: left of it is sooner than usual, right of it is longer, and the faded stretch runs out to the longest gap in the window. The gap overnight, from each day's last to the next day's first, isn't counted.</p>
|
||||
<p class="muted-note">The middle of every bar is that type's typical gap: left of it is sooner than usual, right of it is longer, and the faded stretch runs out to the longest gap in the window. The gap overnight, from each day's last to the next day's first, isn't counted. Waking → pee and Meal → poo measure from each wake-up to the pee after it, and each meal to the poo after it, unless he naps or eats again first; their marker only shows while you're still waiting on one.</p>
|
||||
</section>
|
||||
|
||||
<!-- One panel for the three views of the same events: how many a day,
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
flip with the theme; the brights don't. --sleep itself was doing both
|
||||
jobs and failing the second — 2.6:1 on the timer pill it painted. */
|
||||
--sleep-ink: #4258cc;
|
||||
/* Same idea for walks: the green is a fill, and a line drawn over the
|
||||
green bars needs a shade that stands off them in either theme. */
|
||||
--walk-ink: #22683d;
|
||||
--wake: #f2b705;
|
||||
--wake-ink: #6f4d00;
|
||||
/* The two timers, on the dark theme, take a near-white with a sixth of the
|
||||
@@ -47,6 +50,7 @@
|
||||
--accent: #a690ff;
|
||||
--accent-soft: #2a2640;
|
||||
--sleep-ink: #8ba4ff;
|
||||
--walk-ink: #7fd49c;
|
||||
--wake-ink: #f5c451;
|
||||
--wake-timer-ink: #fdf4da;
|
||||
--border: #2c2a3a;
|
||||
@@ -61,6 +65,7 @@
|
||||
--accent: #a690ff;
|
||||
--accent-soft: #2a2640;
|
||||
--sleep-ink: #8ba4ff;
|
||||
--walk-ink: #7fd49c;
|
||||
--wake-ink: #f5c451;
|
||||
--wake-timer-ink: #fdf4da;
|
||||
--border: #2c2a3a;
|
||||
@@ -1369,6 +1374,18 @@ input.switch:checked::after { transform: translateX(18px); }
|
||||
stroke-linecap: round;
|
||||
fill: none;
|
||||
}
|
||||
/* The sleep and walk bars are filled with --sleep and --walk, so the fit
|
||||
through each takes its ink shade — darker in light mode, lighter in dark —
|
||||
to stay visible where it crosses a bar. */
|
||||
.chart-svg .sleep-trend,
|
||||
.chart-svg .walk-trend-line {
|
||||
stroke: var(--sleep-ink);
|
||||
stroke-width: 2;
|
||||
stroke-dasharray: 5 3;
|
||||
stroke-linecap: round;
|
||||
fill: none;
|
||||
}
|
||||
.chart-svg .walk-trend-line { stroke: var(--walk-ink); }
|
||||
.legend .sw.food-sw { background: var(--food-color, var(--muted)); }
|
||||
|
||||
.kind-field { margin-bottom: 10px; }
|
||||
|
||||
Reference in new issue
Block a user