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

Tips are chaotic on compound marks #1835

Open
tophtucker opened this issue Aug 25, 2023 · 5 comments
Open

Tips are chaotic on compound marks #1835

tophtucker opened this issue Aug 25, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@tophtucker
Copy link
Contributor

tophtucker commented Aug 25, 2023

When you pass tip: true to boxX, I think it passes it on to each of its constituent marks, which results in chaos (demo):

Screen.Recording.2023-08-25.at.11.05.52.AM.mov

I noticed this when playing with adding box to Plot.auto (#1423), which automatically sets tip: true. But what would I expect? It's a little hard to say. I guess I'd want one tip that lands on a point for each quartile, and maybe for the outliers. Maybe this just means compound marks should ideally sometimes intercept the tip option and implement their own tip instead of passing the option through to each of their marks.

@Fil
Copy link
Contributor

Fil commented Aug 25, 2023

compound marks should ideally sometimes intercept the tip option and implement their own

100%

@Fil Fil added the bug Something isn’t working label Aug 25, 2023
@yurivish
Copy link
Contributor

yurivish commented Aug 25, 2023

Another place where I've run into this chaotic-tips phenomenon in the context of nested data, e.g. when data looks like this:

data = [{name: "Series A", points: [{ x, y }, ...] }, { name: "Series B", points: [{ x, y }, ...] }, ...]

One way to plot this data as a multiple-line time series is to transform the data into a single array of {name, x, y} objects. Another approach, which can sometimes be more convenient (and also potentially more efficient, since it requires less data transformation), is to map the data array to an array of line marks, plotting each series as its own mark:

data.map(series => Plot.line(series.points, { x: 'x', y: 'y', z: () => series.name })

Buti including tips with this second approach causes the same sort of chaotic occlusion as in the screen recording since the individual line marks each have their own tip.

I wonder if Plot.marks could be used to pass a top-level tip option for cases like that, to do something similar to the solution for built-in composite tips.

@mbostock
Copy link
Member

mbostock commented Aug 25, 2023

I wonder if Plot.marks could be used to pass a top-level tip option for cases like that, to do something similar to the solution for built-in composite tips.

I don’t think that would work well, since Plot.marks would just pick one of the composite marks arbitrarily for the tip, and I don’t think that’s what you want. The only way to do it would be to combine the series into a single line mark.

@mbostock mbostock added enhancement New feature or request and removed bug Something isn’t working labels Aug 25, 2023
@mbostock
Copy link
Member

Reclassifying this as an enhancement since it’s the documented behavior (“options are passed through to these underlying marks”) but still think we should change it to only pass the tip mark through to one (or none) of the marks, or maybe add a new invisible mark just for the tip.

@Fil

This comment was marked as duplicate.

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

Successfully merging a pull request may close this issue.

4 participants