Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flamegraph transform? #2010

Open
Fil opened this issue Mar 4, 2024 · 0 comments
Open

flamegraph transform? #2010

Fil opened this issue Mar 4, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Fil
Copy link
Contributor

Fil commented Mar 4, 2024

flamegraph

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;
  };
}
@Fil Fil added the enhancement New feature or request label Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant