29

How do I remove the horizontal grid lines in a Google visualization line chart? I have already tried setting

minorGridlines: {count: 0 }, gridlines: {count: 0 } 

on both hAxis and vAxis.

Here is a jsfiddle of my chart.

http://jsfiddle.net/martlark/2XBhc/

enter image description here

2
  • what you have tried ? Aug 4, 2013 at 5:05
  • Added sensible edit to better explain my tries.
    – Martlark
    Aug 4, 2013 at 5:36

4 Answers 4

91

Set the vAxis.gridlines.color option to "transparent" to make them disappear:

vAxis: {
    gridlines: {
        color: 'transparent'
    }
}

This doesn't work for the charts when displayed in IE < 9 (as those versions use VML instead of SVG, and the chart's don't support transparency in VML). In this case, you will need to set the gridline color to match the background color of the chart.

3
  • 2
    Still got the middle line!
    – Martlark
    Aug 4, 2013 at 5:56
  • 1
    On your "fake" y axis, you need to set the "baselineColor" option to transparent as well. Also, you shouldn't use the vAxis option when using the vAxes option, as the behavior of the interaction between the two is unknown - just set the gridline color in each vAxes axis suboption and you'll be fine. See both here: jsfiddle.net/asgallant/2XBhc/4.
    – asgallant
    Aug 4, 2013 at 15:22
  • And of course of horizontal lines, it would be hAxis Nov 3, 2019 at 16:13
13

Set gridlines color to none

 gridlines: {
                color: 'none'
            }

This will also work

1

Tested & Working...

options = {
  vAxis: {
    gridlines: {
      interval: 0
    }      
  }
}
0

gridlines.count:0 is mentioned in the docs

You can specify a value of 1 to only draw one gridline, or 0 to draw no gridlines.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.