Javascript 如何在google图表中使用google.visualization.DataTable()
我在聚合物应用程序中使用GoogleCharts的DataTable对象时遇到问题 我按如下方式加载图表元素:Javascript 如何在google图表中使用google.visualization.DataTable(),javascript,polymer,google-visualization,Javascript,Polymer,Google Visualization,我在聚合物应用程序中使用GoogleCharts的DataTable对象时遇到问题 我按如下方式加载图表元素: <link href="/bower_components/google-apis/google-legacy-loader.html" rel="import" /> <link href="/bower_components/google-chart/google-chart.html" rel="import" /> 我得到: Uncaught Type
<link href="/bower_components/google-apis/google-legacy-loader.html" rel="import" />
<link href="/bower_components/google-chart/google-chart.html" rel="import" />
我得到:
Uncaught TypeError: Cannot read property 'DataTable' of undefined
这里的问题是什么?在聚合物表(或一些图表)中创建为:
<google-chart
type="table"
data='[["ID", "Life Expectancy", "Fertility Rate", "Region", "Population"],
["CAN", 80.66, 1.67, "North America", 33739900],
["DEU", 79.84, 1.36, "Europe", 81902307],
["DNK", 78.6, 1.84, "Europe", 5523095],
["EGY", 72.73, 2.78, "Middle East", 79716203],
["GBR", 80.05, 2, "Europe", 61801570],
["IRN", 72.49, 1.7, "Middle East", 73137148],
["IRQ", 68.09, 4.77, "Middle East", 31090763],
["ISR", 81.55, 2.96, "Middle East", 7485600],
["RUS", 68.6, 1.54, "Europe", 141850000],
["USA", 78.09, 2.05, "North America", 307007000]]'>
</google-chart>
更多示例和文档链接如下:
<google-chart
type="table"
data='[["ID", "Life Expectancy", "Fertility Rate", "Region", "Population"],
["CAN", 80.66, 1.67, "North America", 33739900],
["DEU", 79.84, 1.36, "Europe", 81902307],
["DNK", 78.6, 1.84, "Europe", 5523095],
["EGY", 72.73, 2.78, "Middle East", 79716203],
["GBR", 80.05, 2, "Europe", 61801570],
["IRN", 72.49, 1.7, "Middle East", 73137148],
["IRQ", 68.09, 4.77, "Middle East", 31090763],
["ISR", 81.55, 2.96, "Middle East", 7485600],
["RUS", 68.6, 1.54, "Europe", 141850000],
["USA", 78.09, 2.05, "North America", 307007000]]'>
</google-chart>