plotly / plotly.js

Open-source JavaScript charting library behind Plotly and Dash
https://plotly.com/javascript/
MIT License
17.11k stars 1.87k forks source link

Automatic hover text wrapping #1964

Open jackparmer opened 7 years ago

jackparmer commented 7 years ago

This would nice for the workspace. The <br> workaround requires a lot of data prep.

image

Perhaps there could event be layout options for hover text width (in px) and alignment (left|center|right).

https://github.com/plotly/plotly.js/pull/1834 Might provide some direction for SVG text wrapping 👍

etpinard commented 7 years ago

Related, but not a duplicate of https://github.com/plotly/plotly.js/issues/382

Harsha-Nori commented 5 years ago

Any chance this is being looked at? Word wrap in the hover text would be awesome!

Alternatively, if someone could point me towards the
workaround referenced, I'd really appreciate it!

jackparmer commented 5 years ago

You just need to insert <br> in your hover text where you want a newline. Example: Signs of the flash crash<br>began at these fluctuations

On Thu, Feb 14, 2019 at 11:11 PM Harsha-Nori notifications@github.com wrote:

Any chance this is being looked at? Word wrap in the hover text would be awesome!

Alternatively, if someone could point me towards the workaround referenced, I'd really appreciate it!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/plotly/plotly.js/issues/1964#issuecomment-463899602, or mute the thread https://github.com/notifications/unsubscribe-auth/ABx4aicTM8SF3-0WZF5sso3P7xpDv5OZks5vNjONgaJpZM4O8r5w .

drrmmng commented 4 years ago

This feature would really be helpful!

In python there is a workaround with textwrap, that I want to share for people who might work in python:

df["text"].apply(
    lambda t: "<br>".join(textwrap.wrap(t))
)