谷歌图表 - Coloumn Chart Y轴不可见

时间:2017-11-27 12:26:14

标签: javascript google-visualization

This is how the image looks like

我如何获得y轴?我也想要y轴。我很抱歉,如果已经提出这个问题,我们将非常感谢任何帮助。我经常搜索但是找不到我想要的东西。

到目前为止使用的代码是

google.charts.load('current', {packages: ['corechart']});
google.charts.setOnLoadCallback(drawChart);

function drawChart() {  
var data = google.visualization.arrayToDataTable([
     ['Element', 'Density', { role: 'style' }],
     ['Copper', 8.94, '#b87333'],            // RGB value
     ['Silver', 10.49, 'silver'],            // English color name
     ['Gold', 19.30, 'gold'],
     ['Platinum', 21.45, 'color: #e5e4e2' ], // CSS-style declaration
]);

var options = {
  legend: {
      position: 'none'
  },
  hAxis: {
        textPosition: 'none',
        title: "Weeks",
        maxValue:110,
        minValue:0        
    },
vAxis:{
        textPosition: 'none',
        title:"No of Chapters/Test",
        minValue:0
    },   
};
var chart = new    google.visualization.ColumnChart(document.getElementById('container'));
google.visualization.events.addListener(chart, 'ready', afterDraw);
chart.draw(data, options);

也可以添加JSFiddle链接! https://jsfiddle.net/9werg98u/

1 个答案:

答案 0 :(得分:0)

只需在hAxis和vAxis处删除textPosition:'none'