Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide numbers on an axis on recharts

I have a chart where the X axis shows numbers, but I only want this numbers show on the tooltip, not in the axis. What I mean is the numbers 3, 5, 4 shouldn't be displayed. The problem is that if I hide the axis then the text Labels doesn't show.

enter image description here

<XAxis dataKey="x">
    <Label value="Labels" position="bottom" />
</XAxis>
like image 629
Sergio B Avatar asked Sep 01 '25 16:09

Sergio B


1 Answers

Use tick={false} as a prop to <XAxis> component, in your case:

<XAxis dataKey="x" tick={false}>
    <Label value="Labels" position="bottom" />
</XAxis>

Docs

JSFiddle Example without X axis values(ticks)

like image 139
flppv Avatar answered Sep 04 '25 06:09

flppv