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

constant numeric x and y for text marks #594

Closed
wants to merge 5 commits into from
Closed

Conversation

Fil
Copy link
Contributor

@Fil Fil commented Nov 24, 2021

position the text relative to the anchor

anchor can be any of "top", "bottom", "left", "right" or combinations such as "top-left"

demo: https://observablehq.com/@observablehq/text-facet-alignment-523

closes #523

todo:

  • create unit tests for the possible anchors
  • should "right" and "bottom" be counted "inwards" like in css?
  • generalize to all marks?

src/marks/text.js Outdated Show resolved Hide resolved
src/marks/text.js Outdated Show resolved Hide resolved
@Fil
Copy link
Contributor Author

Fil commented Nov 29, 2021

A question: here we add x and y regardless of the anchor, but we could decide that the sign of the "right" and "bottom" positions should be negated (to go "inset"). I don't know which is the most intuitive.

@Fil Fil force-pushed the fil/constant-text-position branch from 59d40a3 to 77ed526 Compare November 30, 2021 08:42
@Fil Fil marked this pull request as ready for review November 30, 2021 16:42
@Fil Fil requested a review from mbostock November 30, 2021 16:43
@Fil Fil marked this pull request as draft December 2, 2021 08:58
@Fil
Copy link
Contributor Author

Fil commented Dec 2, 2021

converted to draft with the two questions that came up in review

… the anchor

anchor can be any of "top", "bottom", "left", "right" or combinations such as "top-left"

closes #523
@Fil Fil force-pushed the fil/constant-text-position branch from 8b84b40 to 9e78a97 Compare December 17, 2021 15:41
@Fil
Copy link
Contributor Author

Fil commented Dec 22, 2021

I've now generalized the feature to dots and images. Not sure if it can/should be done for other marks?

@Fil
Copy link
Contributor Author

Fil commented Dec 22, 2021

@Fil
Copy link
Contributor Author

Fil commented Feb 6, 2023

Obsolete. This can be achieved with frameAnchor: left and dx: 10 instead of x: 10.

@Fil Fil closed this Feb 6, 2023
@Fil Fil deleted the fil/constant-text-position branch February 6, 2023 11:59
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.

For text, allow x and y to be specified as constant numbers
2 participants