Skip to content

Unification of text rendering and wrapping #2053

Closed
@monfera

Description

@monfera
Contributor

This issue is a spinoff of the table PR

Currently, text rendering logic is not centralized - most of it is in svgUtils.convertToTspans but the new table plot type has wrapper logic, which does a few things, for example:

  • wraps text to a specific width
  • bypasses expensive logic (in this case, the entire svgUtils.convertToTspans) if there's no need

and table would do other things if it could, such as

  • caching of resulting DOM fragments
  • canceling pending asynchronous requests

This issue is the basis for a follow-up PR in which

  • core: code unification is covered
  • core: wrapping is made available centrally (individual plots will still need to specify constraints so it doesn't on its own turn all plots wrap-aware)
  • core: avoid bypass of the heavy logic if there's no styling, markup or LaTeX
  • core: take a look at KaTeX (perhaps it'd be a separate ticket on its own)
  • core: optimize the number of getBoundingClientRect calls; convert to Drawing.bBox
  • desirable: separation of code to logic (calculation) and rendering
  • desirable: facilitating caching
  • desirable: facilitating request cancelation

Activity

monfera

monfera commented on Oct 3, 2017

@monfera
ContributorAuthor

Self-assigning for now to keep tabs during PR review; feel free to reassign

self-assigned this
on Oct 3, 2017
etpinard

etpinard commented on Oct 3, 2017

@etpinard
Contributor

cc #382 and #1964

luisrudge

luisrudge commented on Nov 1, 2018

@luisrudge

not sure this is the right place to ask, but would the implementation of this issue fix this glitch?

image

I'm already using automargin:true but the axis gets cropped anyway.

jensb

jensb commented on Oct 13, 2019

@jensb

Is this still a relevant issue, and if so, is anything done to fix this?
I'd like to have scatter plot annotations with a fixed (set) width which autowrap text if it is too wide.
Ideally, the width should be settable by dragging the right margin of the annotation box.

gvwilson

gvwilson commented on Jun 10, 2024

@gvwilson
Contributor

Hi - this issue has been sitting for a while, so as part of our effort to tidy up our public repositories I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our stack. Cheers - @gvwilson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jensb@gvwilson@luisrudge@monfera@etpinard

        Issue actions

          Unification of text rendering and wrapping · Issue #2053 · plotly/plotly.js