繁体   English   中英

如何使用选项从Google Charts中删除轴?

[英]How to remove axis from Google Charts using options?

我试图隐藏右侧显示的Y轴值。 我一直在寻找谷歌文档,但不知道什么将允许我这样做。 我假设如果选项存在,它也将隐藏网格线。

在此输入图像描述

var options = {
      bars: 'vertical',
      series: {
        2: {targetAxisIndex:2},
        3: {targetAxisIndex:3},
        4: {targetAxisIndex:4}, 
        5: {targetAxisIndex:5} 
      },
      axes: {
        x: {
          0: { side: 'top', label: ''} // Top x-axis.
        }
      },
      vAxis: {viewWindowMode: 'pretty'},
      height: 400,
      width: 900
    };
var chart = new google.charts.Bar(document.getElementById('ocGraph'));
chart.draw(data, google.charts.Bar.convertOptions(options));

弄清楚了,

 var options = {
 bars: 'vertical',
 series: {
    2: {targetAxisIndex:2},
    3: {targetAxisIndex:3},
    4: {targetAxisIndex:4}, 
    5: {targetAxisIndex:5} 
 },
 axes: {
        x: {
          0: { side: 'top', label: ''} // Top x-axis.
        },
        y: {
          2: { side: 'top' , label: ''},
          3: { side: 'top', label: ''},
          4: { side: 'top' , label: ''},
          5: { side: 'top' , label: ''}
        }
      },
      vAxis: {viewWindowMode: 'pretty'},
      vAxes: {
        2: {
         gridlines: { count:0},
         ticks: [0],
         textStyle: {fontSize: 0}
        },
        3: {
         gridlines: { count:0},
         ticks: [0],
         textStyle: {fontSize: 0}
        },
        4: {
         gridlines: { count:0},
         ticks: [0],
         textStyle: {fontSize: 0}
        },
        5: {
         gridlines: { count:0},
         ticks: [0],
         textStyle: {fontSize: 0}
        }
      },

暂无
暂无

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

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