javascript 谷歌可视化折线图删除水平网格线

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18039646/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 10:34:17  来源:igfitidea点击:

google visualization line chart remove horizontal grid lines

javascriptgoogle-visualization

提问by Martlark

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

如何删除 Google 可视化折线图中的水平网格线?我已经尝试过设置

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

on both hAxis and vAxis.

在 hAxis 和 vAxis 上。

Here is a jsfiddle of my chart.

这是我的图表的 jsfiddle。

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

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

enter image description here

在此处输入图片说明

回答by asgallant

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

vAxis.gridlines.color选项设置为“透明”以使它们消失:

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.

这不适用于在 IE < 9 中显示的图表(因为这些版本使用 VML 而不是 SVG,并且图表不支持 VML 中的透明度)。在这种情况下,您需要设置网格线颜色以匹配图表的背景颜色。

回答by sedhu

Set gridlines color to none

将网格线颜色设置为无

 gridlines: {
                color: 'none'
            }

This will also work

这也将起作用