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

Stack overlapping, non-aligned intervals? #1970

Open
fgregg opened this issue Jan 11, 2024 · 2 comments
Open

Stack overlapping, non-aligned intervals? #1970

fgregg opened this issue Jan 11, 2024 · 2 comments
Labels
enhancement New feature or request question Further information is needed

Comments

@fgregg
Copy link

fgregg commented Jan 11, 2024

Currently, if two rects do not share an x1 and x2, they will not stack, it would be great if they did!

Here's an example of something i would like to stack but is not:

untitled(88)

https://observablehq.com/@fgregg/chicago-shelter-eviction-rates@129

I manually set offsets to look like this:

untitled(89)

https://observablehq.com/@fgregg/chicago-shelter-eviction-rates@171

@mbostock
Copy link
Member

mbostock commented Jan 11, 2024

The GitHub Burndown chart does something like this by converting an interval into a regular pulse (e.g., daily value). It’s not technically possible to stack rects with overlapping but non-aligned intervals because the resulting stacked shape is no longer a rect. For example, say you have two intervals represented in ASCII art:

aaaaaaaaaa
    bbbb

If you were to stack a on top of b, the shape for a would no longer be a rectangle:

    aaaa
aaaabbbbaa

The stack transform doesn’t require that the independent dimension (normally x) is regular, so you wouldn’t have to take the pulse approach used in the linked notebook — you could instead cut every interval when it overlaps with another interval. And then the stack transform would work. Maybe the bin transform could do something fancy here to replicate data that spans multiple bins.

@mbostock mbostock changed the title ENH: Should be able to stack rectY and areaY even if x1 and x2 are not coincident Stack overlapping, non-aligned intervals? Jan 11, 2024
@mbostock mbostock added enhancement New feature or request question Further information is needed labels Jan 11, 2024
@fgregg
Copy link
Author

fgregg commented Jan 11, 2024

this is the behavior i’d like to see:

    aaaa
aaaabbbbaa

and you are absolutely right that is not a rect anymore, so it probably shouldn’t be something you can do with rects.

however, stacking up bits of area of different widths would still be really useful! at least to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is needed
Projects
None yet
Development

No branches or pull requests

2 participants