How to get the vaxis line in column chart of google api chart?

孤者浪人 提交于 2020-01-11 07:12:14

问题


I am using column chart of corechart package in google api chart. In this chart i need for vertical axis line(yaxis line). How to get vertical axis line in columnchart.

I reffered this link for creating this chart

Actual

Expected


回答1:


Make Y-axis number not String.

here is the code : Copy and paste this is google Code Playground.

function drawVisualization() {
  // Create and populate the data table.
  var data = google.visualization.arrayToDataTable([
    ['Year', 'Austria', 'Bulgaria' ],
    [12,  133,    400],
    [21,  153,    366],
    [20,  155,    240],
    [27,  160,    134],
    [10,  196,    393],
    [8,  190,    232]
  ]);

  // Create and draw the visualization.
  new google.visualization.ColumnChart(document.getElementById('visualization')).
      draw(data,
           {title:"Yearly Coffee Consumption by Country",
            width:600, height:400,
            vAxis: {title: "Year",ticks: [{v:100, f:"100$"},{v:150, f:"150$"},{v:200, f:"200$"},{v:300, f:"300$"}]},
            hAxis: {title: "Cups",ticks: [{v:4, f:"3-4"},{v:8, f:"5-9"},{v:10, f:"9-13"},{v:14, f:"13-14"},{v:20, f:"15-20"}]} }
      );
}


来源:https://stackoverflow.com/questions/20120364/how-to-get-the-vaxis-line-in-column-chart-of-google-api-chart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!