繁体   English   中英

如何从谷歌图表中删除所有图表轴和标签?

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

在此处输入图像描述

我正在使用以下代码,但仍然无法摆脱水平轴和标签。

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

首先,谷歌图表使用vAxis ,而不是yAxis ,作为“垂直”轴选项。

通过更改上述内容,您将能够删除网格线。

要隐藏基线,请设置baselineColor: 'transparent'

至于标签 --> textPosition: 'none'

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM