recharts / recharts

Redefined chart library built with React and D3
http://recharts.org
MIT License
23.69k stars 1.69k forks source link

Stacked barChart- X axis label gets hidden if length of label text is higher #2712

Open blueeDeveloper opened 2 years ago

blueeDeveloper commented 2 years ago

Reproduction link

Edit on CodeSandbox

Steps to reproduce

  1. Check the codesandbox link. I have named first label in Xaxis as 'Page A23' Due to the length of this label, the label is not displayed on screen. If i reduce the name of label to 'Page A', it displays fine.
  2. The same issue happens if we add angle={-50} to the Xaxis.

What is expected?

Expected to show all the labels irrespective of their length

What is actually happening?

clipping off or hiding the label whose length is higher.

Environment Info
Recharts v2.1.6
React 17.0.1
System MacBookPro14,3
Browser Chrome - Version 95.0.4638.69
blueeDeveloper commented 2 years ago

Can someone pls update on this

nikolasrieble commented 1 year ago

Not showing labels when they overlap is a feature.

We could:

leomunizq commented 1 year ago

nothing yet ?

nikolasrieble commented 1 year ago

If you want all labels to show up, you can just set the interval to 0.

https://master--63da8268a0da9970db6992aa.chromatic.com/?path=/story/api-cartesian-cartesianaxis--api&args=interval:0

You can find an nice example of how the axis behaves here https://master--63da8268a0da9970db6992aa.chromatic.com/?path=/story/examples-cartesian-cartesian-axis-tick-positioning--tick-positioning

ckifer commented 1 year ago

To add to this, there has been some changes that do take angle into account now.

https://codesandbox.io/s/mixed-bar-chart-forked-msfmvc?file=/src/App.tsx

karanVR commented 1 week ago

just add interval = {0} in XAxis:

<XAxis className="mt-8" dataKey={"name"} interval={0}