Skip to content

first tentative for a layouts option #691

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

Closed
wants to merge 3 commits into from
Closed

Conversation

Fil
Copy link
Contributor

@Fil Fil commented Jan 20, 2022

two layouts are available:

  • "darker" changes the fill channel
  • "collide" collides the x/y/r channels

The layouts can be given as a function, which receives the scaled values, and returns a function of (index, dimensions), which is called for each facet. You can pass several layouts which will be called one after the other.

(Very rough: no error checking, mutation of the values arrays… no options…)

testing: https://observablehq.com/@fil/plot-layouts-initial-tests

issues/questions:

  • currently doesn't allow dynamic layouts (where we would immediately return the then proceed to compute and update the positions in an async fashion

Fil added 3 commits January 20, 2022 17:42
two layouts are available:
- "darker" changes the fill channel
- "collide" collides the x/y/r channels

The layouts can be given as a function, which receives the *scaled* values, and returns a function of (index, dimensions), which is called for each facet. You can pass several layouts which will be called one after the other.

(Very rough: no error checking, mutation of the values arrays… no options…)
Copy link
Member

@mbostock mbostock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick thoughts:

  1. I think we could get by with just a single mark.layout, rather than an array of layouts, and have layouts be responsible for composing (as we do with transforms).

  2. I don’t think we’ll want named layouts because I expect that layouts will almost always want accompanying options.

  3. I’d guess that the user would apply layouts the same way they apply transforms today, e.g. Plot.dot(data, Plot.collide({…})), allowing layout options and assigning the layout option. While it would also be possible to set the layout option directly (again, as you can do with a transform), I think this is rare; by wrapping instead we can compose layouts and potentially a layout can change behavior based on shared options.

@mbostock
Copy link
Member

currently doesn't allow dynamic layouts

Yeah, I think we should only consider synchronous layouts to start.

@mbostock mbostock mentioned this pull request Jan 25, 2022
@Fil
Copy link
Contributor Author

Fil commented Jan 26, 2022

superseded by #648

@Fil Fil closed this Jan 26, 2022
@Fil Fil deleted the fil/layouts-exploration branch January 26, 2022 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants