3

我使用 Google Visualization API 制作了一张类似于下图的图表。我的问题是,在这个图表的关键所在的右侧(它说低、中、高)有太多的空白。我怎样才能摆脱这个空白?

替代文字
(来源:securitymonks.com

4

2 回答 2

6

您可以在选项变量中使用宽度和高度百分比以及宽度和高度值,甚至可以将图例作为一行推到底部。然后将选项传递给您正在绘制的图表。

var options2 = { width: 265, height: 200,
            chartArea: { left: 60, top: 20, width: "100%", height: "60%" }, 
            isStacked: true, allowHtml: true, 'legend': 'bottom', titleTextStyle: { color: 'green', fontFamily: 'Arial', fontSize: 16 }, legendTextStyle: { color: '#666666' },
            vAxis: { title: 'Liters', titleTextStyle: { color: 'blue', fontName: 'Arial', fontSize: 10 }, textStyle: { fontSize: 9} },
于 2011-10-06T17:08:53.693 回答
2

作为一种解决方法,我最终只是使图表更宽并在包含的 Div 上使用溢出:隐藏。如果有人知道 API 是否允许缩小空白,请告诉我。

于 2010-05-13T15:49:41.403 回答