Word wrap for long labels
See original GitHub issueIs there an option to reflow long text labels?
- For example, a long label without reflow (plotly tries to autocorrect by slanting the labels instead of reflowing the text, but it still doesn’t fit)
- And a simple manual fix with a few
<br>
in the code that I’d like to have Plotly be able to do with a simplewrap: true
option
JS code for this chart
var data = [{
// first screenshot labels
//x: ['giraffes', 'orangutans', "Very Long Text Label That Doesn't Fit Properly"],
// second screenshot labels
x: ['giraffes', 'orangutans', "Very Long<br>Text Label That<br>Doesn't Fit<br>Properly"],
y: [20, 14, 23],
type: 'bar'
}]
Plotly.newPlot('PlotlyDivSimple', data, {})
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:18 (5 by maintainers)
Top Results From Across the Web
Word-wrap of Label text in text-area - html - Stack Overflow
I'm trying to do a wrap using a paragraph tag, but it is not working. My code: <label for="qual">This is the format i...
Read more >Word wrapping and hyphenation for (long) labels
Suppose I want to have a field with 200 character width represented as a label on a map. Suppose I want the label...
Read more >How to wrap label text ? - MSDN - Microsoft
Set a fixed width and use Word-break:break-all to strictly wrap the content. <asp:Label ...
Read more >Msc-generator 5.4.0: Word Wrapping and Long Labels
Word wrapping: Use text.wrap=yes (and perhaps a fixed hscale ), in this case the long labels wrap into multiple lines. Automatic scaling: Use...
Read more >Wrapping and breaking text - CSS: Cascading Style Sheets
In CSS, if you have an unbreakable string such as a very long word, by default it will overflow any container that is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Has the plotly library managed to solve this issue now. Looking for some better alternatives.
Ok, understood. Would help with a PR if I had a clue how to do that 😃
Pardon my ignorance, but is there no way to introduce a JavaScript function that would be applied to all labels before they’re fed to SVG/WebGL, where it becomes complicated? For example, I’ve google-found this function (it’s not great since there is an issue with long words, but just as an illustration)
that I can use internally to shorten the labels
Also, as a side question — is there a way to read the bar width in plotly so I don’t have to adjust the width manually and can make it reflow properly when chart size is adjusted.