dashboard tooltip update

This commit is contained in:
Jordy Hoogeveen
2026-09-11 17:11:11 +02:00
parent b4d1e25e50
commit 750dc69e56
5 changed files with 26 additions and 8 deletions
+11 -5
View File
@@ -214,11 +214,17 @@ function MiniLineChart({ vData, fiatData, darkMode }) {
const h = hovered;
const tipW = 150, tipH = 76;
const tipX = h !== null ? Math.min(Math.max(xs[h] - tipW / 2, pl), W - tipW - 4) : 0;
// Ankeren op de hoogste van de twee punten, zodat de tooltip nooit over de
// andere lijn heen valt.
const tipAnker = h !== null ? Math.min(ys[h], fYs[h]) : 0;
const tipY = h !== null ? (tipAnker - tipH - 14 < pt ? Math.max(ys[h], fYs[h]) + 14 : tipAnker - tipH - 14) : 0;
// Náást de hoverlijn, niet erboven of eronder. Zodra de twee punten ver uit
// elkaar liggen is er verticaal geen ruimte voor een kaart van 76px: dan
// klapte hij naar onderen tot buiten de tekening, over de datumlabels heen en
// half afgekapt. Zijwaarts past hij altijd; de klemmen houden hem binnen het
// tekenvlak.
const naarRechts = h !== null && xs[h] < pl + iW / 2;
const tipX = h === null ? 0 : naarRechts
? Math.min(xs[h] + 16, W - pr - tipW)
: Math.max(xs[h] - tipW - 16, pl);
const tipY = h === null ? 0
: Math.max(pt, Math.min((ys[h] + fYs[h]) / 2 - tipH / 2, pt + iH - tipH));
const resultaat = h !== null ? vals[h] - fVals[h] : 0;
return (