简体   繁体   English

如何在wordpress中嵌入谷歌电子表格图表?

[英]How to embed a google-spreadsheet chart in a wordpress?

I would like to embed a chart in a wordpress post.我想在 wordpress 帖子中嵌入图表。 I am using the script generated by using the publish function in google sheets.我正在使用通过使用谷歌表中的发布功能生成的脚本。

If I add the generated script to a generic html page, I can see the chart.如果我将生成的脚本添加到通用 html 页面,我可以看到图表。

If I add the generated script to a wordpress post, I get the following error: "All series on a given axis must be of the same data type×"如果我将生成的脚本添加到 wordpress 帖子中,则会出现以下错误:“给定轴上的所有系列必须具有相同的数据类型×”

Do I need to modify the script or something else in the wordpress page to correctly visualize the chart?我是否需要修改 wordpress 页面中的脚本或其他内容以正确可视化图表?

Thanks谢谢

here is the code generated by Google-sheets:这是 Google-sheets 生成的代码:

<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>

Another option is to use a WordPress plugin explicitly designed for integrating with the Google Charts API.另一种选择是使用专门为与 Google Charts API 集成而设计的 WordPress 插件。 TheInline Google Spreadsheet Viewer plugin for WordPresss uses a Google Spreadsheet as a datasource and lets you easily display that data in any of a number of Google Charts and graph visualizations. 适用于 WordPress内联 Google 电子表格查看器插件使用 Google 电子表格作为数据源,让您可以轻松地在许多 Google 图表和图形可视化中的任何一个中显示该数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM