2014-01-14 127 views
0

我想在wordpress文章中嵌入圖表。 我正在使用在Google工作表中使用發佈功能生成的腳本。如何在wordpress中嵌入谷歌電子表格圖表?

如果我將生成的腳本添加到通用html頁面,我可以看到圖表。

如果我添加生成的腳本到WordPress的帖子,我得到以下錯誤: 「所有在一個給定軸系列必須是相同的數據類型×」

我是否需要修改腳本或wordpress頁面中的其他內容可正確顯示圖表?

感謝

這裏是由谷歌表生成的代碼:

<script type="text/javascript" src="//ajax.googleapis.com/ajax/static/modules/gviz/1.0/chart.js"> {"dataSourceUrl":"//docs.google.com/spreadsheet/tq?key=0AgtmZPWzQ7lldEt2S2VLajBRQVNFLV9pRFY2bTRQLVE&transpose=0&headers=1&range=A2%3AB1010&gid=0&pub=1","options":{"titleTextStyle":{"bold":true,"color":"#000","fontSize":16},"curveType":"","animation":{"duration":500},"width":1270,"lineWidth":2,"hAxis":{"useFormatFromData":true,"title":"Data","minValue":null,"viewWindowMode":null,"viewWindow":null,"maxValue":null},"vAxes":[{"useFormatFromData":true,"title":"\u00b5g/m\u00b3","minValue":null,"logScale":false,"viewWindow":{"max":null,"min":null},"maxValue":null},{"useFormatFromData":true,"minValue":null,"logScale":false,"viewWindow":{"max":null,"min":null},"maxValue":null}],"booleanRole":"certainty","title":"Via Ariosto, SO2","height":469,"interpolateNulls":false,"legend":"right","focusTarget":"series","useFirstColumnAsDomain":false,"tooltip":{"trigger":"none"}},"state":{},"view":{},"isDefaultVisualization":false,"chartType":"LineChart","chartName":"Chart 1"} </script> 
+1

Wordpress有一個修改原始HTML粘貼到其中的習慣。您最好的選擇是使用像[原始HTML代碼片段](http://wordpress.org/plugins/raw-html-snippets/)這樣的插件來確保它保持您的代碼不變。 –

+0

謝謝,我注意到它被轉換成&#038;編號爲 – azzurroverde

+0

,謝謝它的工作:) – azzurroverde

回答