[英]How can I override the containing dimensions of a Google Visualization?
我正在尝试使用Google可视化对条形图进行编程。
https://developers.google.com/chart/interactive/docs/gallery/barchart
条形图是动态生成并多次更改的。
谷歌可视化似乎无法检测我通过jQuery动态追加的div元素的维度。 因此,我想将条形图的尺寸硬编码到我提供给Google Visualizations的选项中。
我怎么做?
我试过这些选择。
var options = {
title: 'Comparing Kangeroos and Wallabies',
vAxis: {title: 'Factors', titleTextStyle: {color: 'red'}},
legend: 'bottom',
chartArea.width: '400px',
fontName: 'Arial Narrow'
};
但是,Chrome Web Developer只是注意到“chartArea.width”中存在意外时期。
尝试chartArea:{width:400}
就像它在你给出的页面表格中的chartArea示例中所示。
编辑:更改为数字,因为它说“一个简单的数字是一个像素值”。
该示例显示:
title:"Yearly Coffee Consumption by Country",
width:600, height:400,
vAxis: {title: "Year"},
hAxis: {title: "Cups"}
所以尝试“宽度”而不是“chartArea.width”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.