Skip to content

tips for a clipped mark should be clipped #2213

Open
@Fil

Description

@Fil
Contributor

Currently if you clip a mark, the tip doesn't get clipped and you might end up with surprising results when using facets.

For example the tip shown below, belongs to the facet highlighted in red.

Image

(The cause in this case is that the y scale's domain is set to [0, 0.09] and the excess area between 9% and 100% is clipped out.)

Activity

added
bugSomething isn’t working
on Oct 30, 2024
mbostock

mbostock commented on Oct 30, 2024

@mbostock
Member

Would you expect the tip to be hidden in this case? Or do you want to use clamp instead of clip?

Fil

Fil commented on Oct 30, 2024

@Fil
ContributorAuthor

My solution in this case is to avoid drawing the segments that go into the clipped zone. Clamping works too!

But both depend on the user doing the right thing; in the process of creating the chart, it was very surprising to see these default tips that were (visually) not connected to anything.

I wonder if fixing this might do more harm than good in some situations, it might be ok to close as won't fix. However, that's what we do with the geo mark: a feature that is completely off-screen gets no tip, and a feature that is clipped gets its (default) tip location in the centroid[1] of the (visible) shape. (Note that a further difficulty is that the shape might be visible even if its reference position is outside the clip region…) 🤔

[1] related: #2098.

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

        Participants

        @Fil@mbostock

        Issue actions

          tips for a clipped mark should be clipped · Issue #2213 · observablehq/plot