[英]How can I override the containing dimensions of a Google Visualization?
I am trying to program a bar chart using Google Visualizations. 我正在尝试使用Google可视化对条形图进行编程。
https://developers.google.com/chart/interactive/docs/gallery/barchart https://developers.google.com/chart/interactive/docs/gallery/barchart
The bar chart is dynamically generated and changed several times. 条形图是动态生成并多次更改的。
Google Visualizations seems to have trouble detecting the dimensions of a div element that I dynamically appended via jQuery. 谷歌可视化似乎无法检测我通过jQuery动态追加的div元素的维度。 Hence, I would like to hard code the dimensions of the bar chart into the options that I feed into Google Visualizations. 因此,我想将条形图的尺寸硬编码到我提供给Google Visualizations的选项中。
How do I do that? 我怎么做?
I have tried these options. 我试过这些选择。
var options = {
title: 'Comparing Kangeroos and Wallabies',
vAxis: {title: 'Factors', titleTextStyle: {color: 'red'}},
legend: 'bottom',
chartArea.width: '400px',
fontName: 'Arial Narrow'
};
However, Chrome Web Developer just notes that there is an unexpected period in "chartArea.width." 但是,Chrome Web Developer只是注意到“chartArea.width”中存在意外时期。
The example shows: 该示例显示:
title:"Yearly Coffee Consumption by Country",
width:600, height:400,
vAxis: {title: "Year"},
hAxis: {title: "Cups"}
So try "width" instead of "chartArea.width" 所以尝试“宽度”而不是“chartArea.width”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.