Google Charts - 如何创建带有垂直文本的 Y 轴标签?

发布于 2025-01-07 21:57:36 字数 1615 浏览 5 评论 0原文

这是原始图表

添加Y轴标签时,看起来像这样

如何使 Y 轴标签垂直读取?

Here is the original chart.

When adding a Y-axis label, it looks like this.

How can I make that Y-axis label read vertically?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凡尘雨 2025-01-14 21:57:36

您可以在这里尝试一下:http://code.google。 com/apis/ajax/playground/?type=visualization#combo_chart

以下是一个组合图表,其外观与我认为您想要的类似。

function drawVisualization() {
  // Some raw data (not necessarily accurate)
  var rowData = [['Month', 'Bolivia', 'Ecuador', 'Madagascar', 'Papua  Guinea',
                  'Rwanda', 'Average'],
                 ['2004/05', 165, 938, 522, 998, 450, 614.6],
                 ['2005/06', 135, 1120, 599, 1268, 288, 682],
                 ['2006/07', 157, 1167, 587, 807, 397, 623],
                 ['2007/08', 139, 1110, 615, 968, 215, 609.4],
                 ['2008/09', 136, 691, 629, 1026, 366, 569.6]];

  // Create and populate the data table.
  var data = google.visualization.arrayToDataTable(rowData);

  // Create and draw the visualization.
  var ac = new google.visualization.ComboChart(document.getElementById('visualization'));
  ac.draw(data, {
    title : 'Monthly Coffee Production by Country',
    width: 600,
    height: 400,
    vAxis: {title: "# of discussions per individual"},
    hAxis: {title: "Month"},
    seriesType: "bars",
    series: {5: {type: "line"}}
  });
}​

You can play around with it here: http://code.google.com/apis/ajax/playground/?type=visualization#combo_chart

The following is a combo chart that has a look similar to I think what you want.

function drawVisualization() {
  // Some raw data (not necessarily accurate)
  var rowData = [['Month', 'Bolivia', 'Ecuador', 'Madagascar', 'Papua  Guinea',
                  'Rwanda', 'Average'],
                 ['2004/05', 165, 938, 522, 998, 450, 614.6],
                 ['2005/06', 135, 1120, 599, 1268, 288, 682],
                 ['2006/07', 157, 1167, 587, 807, 397, 623],
                 ['2007/08', 139, 1110, 615, 968, 215, 609.4],
                 ['2008/09', 136, 691, 629, 1026, 366, 569.6]];

  // Create and populate the data table.
  var data = google.visualization.arrayToDataTable(rowData);

  // Create and draw the visualization.
  var ac = new google.visualization.ComboChart(document.getElementById('visualization'));
  ac.draw(data, {
    title : 'Monthly Coffee Production by Country',
    width: 600,
    height: 400,
    vAxis: {title: "# of discussions per individual"},
    hAxis: {title: "Month"},
    seriesType: "bars",
    series: {5: {type: "line"}}
  });
}​
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文