SVG Axis Label Text Wrap
See original GitHub issueHi, thanks for this sweet project! I know SVG <text>
elements don’t quite wrap yet, and I was wondering if I’ve missed a way to get axis label text to wrap that currently exists in this project? I’ve come across https://github.com/d3plus/d3plus-text, but I’m unsure of ways to interop between nivo & d3. There is also the hacky <tspan>
element which could be deployed at some level, but that feels like I’m barking up the wrong tree.
Has this problem already been solved? If not, is it planned on being solved, or is help required?
Issue Analytics
- State:
- Created 5 years ago
- Comments:37 (10 by maintainers)
Top Results From Across the Web
SVG Wrapping text on x-axis - Stack Overflow
I am trying to wrap some text on a bar graph i am creating using D3. ... How to align them right.? Here's...
Read more >Text wrapping in Vega JS Charts (SVG and Canvas) - Gramener
To rotate x-axis labels, labelAngle property is used in the code snippet. The labels no more overlap with neighboring labels but are overlapping...
Read more >Text Wrap Axis / Alan Mar - Observable
Text Wrap Axis. Taken from Mike Bostock's example on how to wrap really long tick texts. Included an example on how to wrap...
Read more >Wrapping, truncating, and auto-rotating axis labels - amCharts
By default, labels are truncated with a triple-dot for an ellipsis. You can use label's ellipsis property to set it to any other...
Read more >Wrapping Long Labels 2.0 - Popular Blocks
forked from mbostock's block: Wrapping Long Labels 2.0 ... .1, .3); var y = d3.scale.linear() .range([height, 0]); var xAxis = d3.svg.axis() ...
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
In case this is helpful to anyone, I wrote a somewhat flexible getTspanGroups function that can be inserted to the same place in rpearce’s code.
Just a heads up - this was written in Typescript
Update: here’s what I’m currently going with…
where
getTspanGroups
is an Array of<tspan>
elements that are no longer than 15 characters (not dynamic … but passable).Best I can do for now!