我正在尝试使用 Google Visualizations 编写条形图。
https://developers.google.com/chart/interactive/docs/gallery/barchart
条形图是动态生成并多次更改的。
Google Visualizations 似乎无法检测我通过 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}
就像它在 page 的表格中的 chartArea 示例中显示的那样你给了。
编辑:更改为数字,因为它说“一个简单的数字是以像素为单位的值”。
关于javascript - 如何覆盖 Google 可视化的包含维度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10181967/