javascript - 如何获取google api图表柱形图中的vaxis线?

标签 javascript google-api

我在google api图表中使用corechart包的柱形图。在此图表中,我需要垂直轴线(y轴线)。如何获取柱形图中的垂直轴线。

我提到了这个link用于创建此图表

实际

enter image description here

预期

enter image description here

最佳答案

使 Y 轴编号不是字符串。

这是代码:复制并粘贴这是 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"}]} }
      );
}

关于javascript - 如何获取google api图表柱形图中的vaxis线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20120364/

相关文章:

java.io.FileNotFoundException :/key. p12:打开失败:ENOENT(没有这样的文件或目录)

java - 来自授权码交换的 invalid_grant 响应

youtube - 通过 YouTube 数据 API 访问公共(public)数据,无需身份验证。

objective-c - YouTube API v3 示例项目引发 GTLJSONRPCErrorDomain -32602 错误请求错误

javascript - 使用 javascript 选择融合表时出现错误 401

Javascript 正则表达式拒绝非 ASCII-US 字符

javascript - 如何使用 Highcharts 导出多种尺寸的图表?

javascript - 验证此输入的最简单方法?

javascript - Ionic v2 + CORS 预检访问控制允许方法

javascript - react 渲染方法中的for循环