我正在使用Google的javascript可视化库生成一个BarChart。我想让图表中的条形更宽,但是我在文档中找不到任何有关如何配置每个数据集的条形宽度的信息。
有任何帮助吗?
有任何帮助吗?
我曾有过同样的问题,为了记录下来,我想发表一下。似乎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);
尝试使用以下格式,这样图表的外观会比较好看,虽然它不是固定的,但这解决了我们的问题。
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