Skip to content

Waffles can overflow the frame #2256

Open

Description

@mbostock

As noted in #2132 (comment):

untitled - 2024-11-20T172228 394

Plot.waffleY([0.5, 2, 4], {x: null, fill: Plot.indexOf}).plot({color: {type: "categorical"}})

Above, the y-scale only extends from [0, 6.5], but the waffle visually extends to y = 7.5… that’s because here each cell of the waffle is 3 y-units tall, as there are three columns. We’d need the waffle mark to provide a hint to the y scale that the domain needs to be taller than the apparent value from the y1 and y2 channels.

Activity

  1. Fil commented on Dec 2, 2024

    @Fil
    Contributor

    This is a difficult one conceptually 🤔

    Do we want 7.5 in this case (the top y2 of all the points generated by the waffle geometry), or do we want 9 (meaning, we derive our unit height (multiple = 3) and just want to round it up to make enough room for the top row—even if it's not filling up entirely?

    (Also, when you look at the current order of operations, the waffle geometry is computed in an initializer, after the y scale has already been derived, so something that says 7.5 or 9 doesn't seem easy to implement.)

    There is a similar issue with circles — we're not accounting for their radius and they can get clipped if on an edge. We currently expect the user to add an insetTop or something.

    Quite often I'd like the default style to be overflow:visible — it would solve many issues of this kind (and create different issues! yay).

  2. mbostock commented on Dec 2, 2024

    @mbostock
    MemberAuthor

    the waffle geometry is computed in an initializer, after the y scale has already been derived, so something that says 7.5 or 9 doesn't seem easy to implement

    Hmm, yes, perhaps this means this isn’t solvable. We’d either have to allow initializers to redefine position scales (potentially running the initializer again until it coalesces?) or we’d only be able to solve this when the multiple option is fixed ahead of time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn’t working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions