How do I convert a label on an axis from decimal to percent in Recharts

Asked 1 years ago, Updated 1 years ago, 23 views

I am writing the code while referring to the following site.

https://codesandbox.io/s/vigilant-lehmann-82dzz?file=/src/dashboardView.js:1404-1406https://stackoverflow.com/questions/43978473/recharts-normalised-stacked-bar-charts

Half of them succeeded, but as shown in the attached image, the unit on the horizontal axis becomes a decimal.I'd like to convert it to a percentage, but what is the way to display it?

<XAxis 
        type = "number"
        domain = {['data*100', 'data*100']}
</XAxis>

Currently, XAxis writes as above.

src=

javascript

2022-09-30 18:18

1 Answers

I was able to do it with the following description!

tickFormatter={(tick)=>{
    return`${tick*100}%`;
}}


2022-09-30 18:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.