Skip to content

multiline text - #677

Merged
mbostock merged 12 commits into
mainfrom
mbostock/multiline
Jan 19, 2022
Merged

mbostock merged 12 commits into
mainfrom
mbostock/multiline

Conversation

@mbostock

@mbostock mbostock commented Jan 17, 2022

Copy link
Copy Markdown
Member

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
Comment thread src/marks/text.js
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 <mbostock@gmail.com>
Comment thread test/output/gridChoropleth.svg Outdated
Comment thread test/output/travelersYearOverYear.svg Outdated
@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