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

Bottom label text is touching the component #2906

Open
1 task done
ghost opened this issue Jul 18, 2022 · 2 comments
Open
1 task done

Bottom label text is touching the component #2906

ghost opened this issue Jul 18, 2022 · 2 comments
Labels
bug General bug label enhancement Enhancement to a current API

Comments

@ghost
Copy link

ghost commented Jul 18, 2022

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

Reproduction link

https://recharts.org/en-US/examples/SimpleRadarChart

Steps to reproduce

Just look at the demo in the documentation

What is expected?

Bottom label is not supposed to touch the component, there's supposed to be some gap, like with all other labels

What is actually happening?

Label is touching the component

Environment Info
Recharts v2.1.6
React 18
System Windows 10
Browser Chrome

Example picture =>
image

Is there a way to fix it, or configure the label distance?

@ckifer
Copy link
Member

ckifer commented Jan 3, 2023

Hi,

You can create your own ticks with the tick prop

      <PolarAngleAxis
        dataKey="subject"
        tick={(props) => {
          const { payload, ...rest } = props;
          return (
            <text {...rest} y={rest.y + 4}>
              {payload?.value}
            </text>
          );
        }}
      />

Then you can add or subtract from any of the position values to get it where you want

https://codesandbox.io/s/simple-radar-chart-forked-0yqyyg?file=/src/App.tsx:805-1072

This does make sense to fix dig into internally and see what that point is being calculated as - labeling this as a bug/enhancement issue

@ckifer ckifer added bug General bug label enhancement Enhancement to a current API labels Jan 3, 2023
@ghost
Copy link
Author

ghost commented Jan 9, 2023

Looking forward to it!

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

No branches or pull requests

1 participant