this question is quite straightforward. It is inspired by the pie chart example found on the google charts playground
Could someone please explain why this code snippet works:
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?"});
}
On the other hand, this variation does not work (changed value for "Work" line to a literal string):
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?"});
}
This setup doesn't function properly in both the playground and my own website, leading to a javascript error in Firebug:
Error: Invalid value in 0,1 (https://www.google.com/uds/api/visualization/1.0/351cbc565e06280bb093b00ce39323d9/format+en_GB,default,corechart.I.js )
Any help would be greatly appreciated, as it seems I might be overlooking an obvious detail.