Open Fil opened 7 months ago
Here's a starting point; I'll make a notebook later. We have to change this from an ad hoc function to a proper transform (facet-aware etc).
{ const positions = new Map(); return (d) => { const p = (!positions.has(d.YEAR) && positions.set(d.YEAR, []), positions.get(d.YEAR)); const start = days(d["AFSDATE"]); const end = days(d["AFEDATE"]); let height = 0; while ( p.some( (p) => p.height === height && ((p.start <= start && start <= p.end) || (p.start <= end && end <= p.end) || (start <= p.start && p.start <= end) || (start <= p.end && p.end <= end)) ) ) height++; p.push({ start, end, height }); return height; }; }
Here's a starting point; I'll make a notebook later. We have to change this from an ad hoc function to a proper transform (facet-aware etc).