这很简单。这是基于谷歌图表操场上的饼图示例
谁能告诉我为什么会这样:
function drawVisualization() {
// Create and populate the data table.
var data = google.visualization.arrayToDataTable([
['Task', 'Hours per Day'],
['Work', 4],
['Eat', {'v':0.,'f':'text 2'}],
['Commute', {'v':2,'f':'text 3'}],
['Watch TV', {'v':2,'f':'text 4'}],
['Sleep', {'v':0.,'f':'text 5'}]
]);
// Create and draw the visualization.
new google.visualization.PieChart(document.getElementById('visualization')).
draw(data, {title:"So, how was your day?"});
}
但这没有(为“工作”行添加了一个文字字符串):
function drawVisualization() {
// Create and populate the data table.
var data = google.visualization.arrayToDataTable([
['Task', 'Hours per Day'],
['Work', {'v':4,'f':'text 1'}],
['Eat', {'v':0.,'f':'text 2'}],
['Commute', {'v':2,'f':'text 3'}],
['Watch TV', {'v':2,'f':'text 4'}],
['Sleep', {'v':0.,'f':'text 5'}]
]);
// Create and draw the visualization.
new google.visualization.PieChart(document.getElementById('visualization')).
draw(data, {title:"So, how was your day?"});
}
这在操场上不起作用,在我的网站上也不起作用,但在我的网站上完成后,我将收到以下 firebug javascript 错误:
错误:0,1 中的值无效(https://www.google.com/uds/api/visualization/1.0/351cbc565e06280bb093b00ce39323d9/format+en_GB,default,corechart.I.js)
在此先感谢,我可能遗漏了一些非常明显的东西