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

时间:2016-10-07 00:57:52

标签: javascript jquery charts bar-chart google-chartwrapper

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

enter image description here

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

1 个答案:

答案 0 :(得分:0)

想出来,

 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}
        }
      },