summaryrefslogtreecommitdiff
path: root/web/template.html
diff options
context:
space:
mode:
Diffstat (limited to 'web/template.html')
-rw-r--r--web/template.html8
1 files changed, 8 insertions, 0 deletions
diff --git a/web/template.html b/web/template.html
index 45fa874..966a584 100644
--- a/web/template.html
+++ b/web/template.html
@@ -206,6 +206,14 @@ function render() {
const c = D.candles[hover];
s += `<line class="guide" x1="${M.l}" x2="${W-M.r}" y1="${py(c.Close)}" y2="${py(c.Close)}"/>` +
`<text x="${W-M.r+4}" y="${py(c.Close)+4}" style="fill:${css('--fg')};font-weight:600">${fmt(c.Close)}</text>`;
+ // same horizontal crosshair for the indicator panels, at the hovered bar's values
+ for (const [p, arr, color] of [[R, D.rsi, css('--accent')], [K, D.k, css('--line1')], [K, D.d, css('--line2')]]) {
+ const v = arr[hover];
+ if (v == null) continue;
+ const y = ind(p, v);
+ s += `<line x1="${M.l}" x2="${W-M.r}" y1="${y}" y2="${y}" stroke="${color}" stroke-width="1" stroke-dasharray="4 3"/>` +
+ `<text x="${W-M.r+4}" y="${y+4}" style="fill:${color};font-weight:600">${fmt(v, 1)}</text>`;
+ }
}
svg.innerHTML = s;
updateInfo();