javascripthtmlchartsgoogle-visualizationreact-google-charts

How to remove all chart axis and labels from Google Charts?


enter image description here

I'm using following code, but still can't get rid of horizontal axis and labels.

    var options = {
    legend: 'none',
    tooltip: {trigger: 'none'},
    hAxis: {
      gridlines: {
        count: 0,
        color: 'none'
      }
    },
    yAxis: {
      gridlines: {
        count: 0,
        color: 'none'
      }
    }
  };

Solution

  • first, google charts uses vAxis, with a V, instead of yAxis, for the "vertical" axis options.

    what you have will work to remove the gridlines, by changing the above.

    to hide the baseline, set baselineColor: 'transparent'

    as for the labels --> textPosition: 'none'

    var options = {
      legend: 'none',
      tooltip: {trigger: 'none'},
      hAxis: {
        gridlines: {
          count: 0
        },
        textPosition: 'none'
      },
      vAxis: {
        baselineColor: 'transparent',
        gridlines: {
          count: 0
        },
        textPosition: 'none'
      }
    };