Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stacking Xaxis dataKey text #4446

Open
1 task
matiassemelman opened this issue Apr 18, 2024 · 3 comments
Open
1 task

Stacking Xaxis dataKey text #4446

matiassemelman opened this issue Apr 18, 2024 · 3 comments
Labels
enhancement Enhancement to a current API

Comments

@matiassemelman
Copy link

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

Open the codeSandbox

What is expected?

I need the overlapped (too long) text to word-wrap below, so it can be read

What is actually happening?

Text is overlapping

Environment Info
Recharts v2.12.5
React react/18.2
System Ubuntu
Browser Chrome
@ckifer
Copy link
Member

ckifer commented Apr 18, 2024

The Text component is an SVG and the SVG spec does not support word-wrapping

I would recommend angling you ticks and potentially cutting them off at a certain length with tickFormatter

Edit practical-pateu-pq9pwr

We could potentially add a feature to wrap tick text using tspans, but recharts currently does not have anything that will do that

@ckifer ckifer added the enhancement Enhancement to a current API label Apr 18, 2024
@matiassemelman
Copy link
Author

How tough :(
could someone have a workaround to achieve this?
Even if it's a solution outside of what recharts offers, still useful!

@ckifer
Copy link
Member

ckifer commented Apr 19, 2024

https://stackoverflow.com/questions/4991171/auto-line-wrapping-in-svg-text

We can use foreignObject and go outside of the svg container

Edit recharts-foreignObject-tick-wrap

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to a current API
Projects
None yet
Development

No branches or pull requests

2 participants