簡體   English   中英

如何覆蓋Google Visualization的包含尺寸?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM