Dashboard: ferritin as a graph only, no results table

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Riaan Doorduin
2026-11-15 13:25:39 +02:00
parent 0d3da5f2df
commit b5521d6731

View File

@@ -138,9 +138,8 @@ h3.sub { margin: 8px 0 0; font: 600 16px var(--body) }
<div class="card" style="align-content:start"><div class="legend" id="hBpLeg"></div><div class="chartbox"><canvas id="cBp" role="img" aria-label="Blood pressure and haemoglobin readings"></canvas></div></div> <div class="card" style="align-content:start"><div class="legend" id="hBpLeg"></div><div class="chartbox"><canvas id="cBp" role="img" aria-label="Blood pressure and haemoglobin readings"></canvas></div></div>
<div class="scroll"><table id="tBp"></table></div> <div class="scroll"><table id="tBp"></table></div>
</div> </div>
<div class="grid2" id="labGrid" hidden> <div id="labGrid" hidden style="margin-top:16px">
<div class="card" style="align-content:start"><h3 id="labHead">Ferritin</h3><p class="note" id="labNote"></p><div class="legend" id="hLabLeg"></div><div class="chartbox"><canvas id="cLab" role="img" aria-label="Blood test results over time"></canvas></div></div> <div class="card" style="align-content:start"><h3 id="labHead">Ferritin</h3><p class="note" id="labNote"></p><div class="legend" id="hLabLeg"></div><div class="chartbox"><canvas id="cLab" role="img" aria-label="Blood test results over time"></canvas></div></div>
<div class="scroll"><table id="tLab"></table></div>
</div> </div>
</div> </div>
</section> </section>
@@ -442,8 +441,6 @@ if (hd) (function () {
...(tgt.length ? [0, 1].map(k => line(tgt.map(r => ({ x: r.t, y: r.target[k] })), css('--muted'), { label: k ? 'Target max' : 'Target min', stepped: true, borderDash: [5, 4], borderWidth: 1.5, pointHoverRadius: 0 })) : [])] }, ...(tgt.length ? [0, 1].map(k => line(tgt.map(r => ({ x: r.t, y: r.target[k] })), css('--muted'), { label: k ? 'Target max' : 'Target min', stepped: true, borderDash: [5, 4], borderWidth: 1.5, pointHoverRadius: 0 })) : [])] },
options: { maintainAspectRatio: false, parsing: false, plugins: { legend: { display: false }, tooltip: { ...tip, callbacks: { title: i => fmtD(i[0].raw.x), label: i => `${i.dataset.label}: ${i.raw.y} ${LM[0].unit}` } } }, options: { maintainAspectRatio: false, parsing: false, plugins: { legend: { display: false }, tooltip: { ...tip, callbacks: { title: i => fmtD(i[0].raw.x), label: i => `${i.dataset.label}: ${i.raw.y} ${LM[0].unit}` } } },
scales: { x: { ...xAxis, min: P[0].t - 15 * 864e5, max: P.at(-1).t + 15 * 864e5 }, y: { type: lm === 'ferritin' ? 'logarithmic' : 'linear', grid, ...(lm === 'ferritin' ? { afterBuildTicks: ax => { ax.ticks = [5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000].filter(v => v >= ax.min && v <= ax.max).map(value => ({ value })) } } : {}) } } } }); scales: { x: { ...xAxis, min: P[0].t - 15 * 864e5, max: P.at(-1).t + 15 * 864e5 }, y: { type: lm === 'ferritin' ? 'logarithmic' : 'linear', grid, ...(lm === 'ferritin' ? { afterBuildTicks: ax => { ax.ticks = [5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000].filter(v => v >= ax.min && v <= ax.max).map(value => ({ value })) } } : {}) } } } });
$('tLab').innerHTML = '<thead><tr><th class="l">Date</th><th class="l">Test</th><th>Result</th><th class="l">Lab</th><th>Reference</th></tr></thead><tbody>' +
[...LABS].reverse().map(r => `<tr><td>${r.d}</td><td class="l">${LNAME[r.m]}</td><td>${r.v} ${r.unit}</td><td class="l dim">${(r.lab || '').replace(/[<>&]/g, '')}</td><td class="dim">${r.ref ? r.ref.join('–') : ''}</td></tr>`).join('') + '</tbody>';
} }
if (HEALTH.bp.length) { if (HEALTH.bp.length) {
const B = HEALTH.bp.map(b => ({ ...b, t: Date.parse(b.d) })); const B = HEALTH.bp.map(b => ({ ...b, t: Date.parse(b.d) }));