【发布时间】:2011-10-05 20:00:27
【问题描述】:
我正在使用 Google 的 javascript 可视化库生成条形图。我想让图表中的条形比现在更宽,但是我在文档中找不到任何内容来说明如何配置每个数据集的条形宽度。
有什么帮助吗?
【问题讨论】:
标签: google-visualization bar-chart
我正在使用 Google 的 javascript 可视化库生成条形图。我想让图表中的条形比现在更宽,但是我在文档中找不到任何内容来说明如何配置每个数据集的条形宽度。
有什么帮助吗?
【问题讨论】:
标签: google-visualization bar-chart
试试下面的格式,这样图表就会看起来不错,虽然它没有修复,但这解决了我们的问题。
options: {
titlePosition: "none",
bar: { groupWidth: "50%" }
// ...
}
data.push([" ", "t1","t2","t3","t4"]); // headings
data.push([" ", 0, 0, 0, 0]); // dummy bar so graph will display good
// push you actual data here
data.push([" ", 0, 0, 0, 0]); // dummy bar so graph will display good
【讨论】:
有同样的问题,想我会为后代发帖。 bar.groupWidth 似乎是设置它的方法。
https://developers.google.com/chart/interactive/docs/gallery/barchart
例如:
var options = {
title: "Density of Precious Metals, in g/cm^3",
width: 600,
height: 400,
bar: {groupWidth: "95%"},
legend: { position: "none" },
};
var chart = new google.visualization.BarChart(document.getElementById("barchart_values"));
chart.draw(view, options);
【讨论】: