简体   繁体   English

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

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

Im trying to hide the Y axis values displayed on the right. 我试图隐藏右侧显示的Y轴值。 Ive been looking though Google documentation but cant figure out what will allow me to do this. 我一直在寻找谷歌文档,但不知道什么将允许我这样做。 Im assuming if the option exists it will also hide the gridlines. 我假设如果选项存在,它也将隐藏网格线。

在此输入图像描述

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));

Figured it out, 弄清楚了,

 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