Skip to content

Conversation

mbostock
Copy link
Member

@mbostock mbostock commented Jan 17, 2022

Supersedes #327. Fixes #313. This…

  • Standardizes the dx and dy options on text; only pixel values are now supported (no typographic units).
  • Adds a new lineAnchor option to control vertical alignment; one of top, middle (default), or bottom.
  • Adds a new lineHeight numeric option to control vertical spacing between lines; defaults to 1.0.
  • Always positions the text using the transform attribute rather than x and y (even when not rotating).

TODO

  • Generate multiple tspans for multiline text
  • Standardize dx and dy options
  • Add lineAnchor option
  • Add lineHeight option
  • Use x and y attributes if not rotating (for more minimal output or performance)?
  • Test
  • Document

@mbostock mbostock requested a review from Fil January 17, 2022 20:50
Fil and others added 2 commits January 19, 2022 08:09
* use x, y and dy when there is no rotate
test multiline (with 1 empty line)
document

* use selection.call to branch

* remove duplicate test

Co-authored-by: Mike Bostock <[email protected]>
@mbostock mbostock mentioned this pull request Jan 19, 2022
@mbostock mbostock merged commit 136fc2f into main Jan 19, 2022
@mbostock mbostock deleted the mbostock/multiline branch January 19, 2022 17:40
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.

Plot.text could be smart with newlines

2 participants