That is because the arrayToDataTable method does not support the use of the 
{v: value, f: "formatted value"} object.  I have extrapolated that the 
method derives the column types from the first row of data, and was not 
written to handle object entry.  Subsequent rows are likely added via the 
addRows method (or something like it), thus the object entry works there. 
 If you want to enter your data like that, you will have to explicitly 
define your DataTable columns and then use the addRows method.

On Sunday, November 11, 2012 5:54:32 PM UTC-5, Dylan Millikin wrote:
>
> Hello,
>
> Before I go any further you can find all this info in a nicer format here: 
> http://stackoverflow.com/questions/13331997/google-charts-literal-string-tooltip-error-when-applied-to-all-fields#comment18190475_13331997
>
> I'm using the basic example from the playground : 
> http://code.google.com/apis/ajax/playground/?type=visualization#pie_chart
>
> When I try to add custom text for the tooltips to this example the 
> following will work:
>
> 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?"});}
>
> But the folowing will not (I just added text to "Work". Thus adding text to 
> all entries) :
>
> 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?"});}
>
> Can anyone tell me why this doesn't display anything and gives me an error?
>
> The error is: 
>
> Error: Invalid value in 0,1
> ( 
> https://www.google.com/uds/api/visualization/1.0/351cbc565e06280bb093b00ce39323d9/format+en_GB,default,corechart.I.js
>  )
>
> Thanks in advance
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/v7vrf5AY_B4J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to