简体   繁体   中英

How to remove axis from Google Charts using options?

Im trying to hide the Y axis values displayed on the right. 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}
        }
      },

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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