react-charts icon indicating copy to clipboard operation
react-charts copied to clipboard

How can i hide the xAxes and yAxes numbers/values and background lines?

Open hernanex97 opened this issue 3 years ago • 2 comments

Hello all, i have this chart (see image) and i want to hide the xAxes and yAxes (those numbers, 180, 160, 140, i dont want to see them) image.

if i do document.getElementById('axes').remove in console, it works, but does exists another way?

hernanex97 avatar Dec 22 '21 15:12 hernanex97

This seems to work for me: In the axis options, return an empty string in the scale formatter, e.g.

   const secondaryAxes = React.useMemo(
     (): AxisOptions<DailyStars>[] => [
       {
        formatters: {
          scale: () => '',

To hide the background lines, use showGrid, e.g.

   const secondaryAxes = React.useMemo(
     (): AxisOptions<DailyStars>[] => [
       {
        showGrid: false,

bmaupin avatar Jan 05 '22 17:01 bmaupin

@bmaupin Hi there, thanks for the above code it helped a lot :)

But i also want to hide the borders on x and y axes. Is there any way to hide them also?

Screenshot from 2022-09-16 21-54-37

ibrahimrehman1 avatar Sep 16 '22 16:09 ibrahimrehman1