Your data is not in the correct format. Each cell needs to be an object
with at least a "v" property, like this:
{
"cols":[
{"id":"name","type":"string"},
{"id":"parentfruit","type":"string"},
{"id":"tooltip","type":"string","role":"tooltip"}
],
"rows":[
{"c":[{"v":"apples","f":"Group 1"},{"v":""},{"v":"Apples"}]},
{"c":[{"v":"oranges","f":"Group 2"},{"v":""},{"v":"Oranges"}]},
{"c":[{"v":"bananas","f":"Group
3"},{"v":"oranges"},{"v":"Bananas"}]}
]
}
The reason your code fails is because the DataTable constructor is treating
{"c":[{"v":"bananas","f":"Group
3"},"oranges","Bananas"]} as having two null cells where "oranges" and
"Bananas" are. See working example: http://jsfiddle.net/asgallant/JYTr3/
On Friday, February 21, 2014 2:49:00 PM UTC-5, danmc92 wrote:
>
> I'm trying to get an org chart going. I have a php script that delivers
> the JSON. It looks like this:
>
> {"reqId":"0","table":{"cols":[{"id":"name","type":"string"},{"id":"parentfruit","type":"string"},{"id":"tooltip","type":"string","role":"tooltip"}],"rows":[{"c":[{"v":"apples","f":"Group
> 1"},"","Apples"]},{"c":[{"v":"oranges","f":"Group
> 2"},"","Oranges"]},{"c":[{"v":"bananas","f":"Group
> 3"},"oranges","Bananas"]}]}}
>
>
> This works fine in that there are no errors and the nodes are displayed.
> However, there are two issues.
>
> 1.) Row 3 is supposed to be a child of row 2, but that's not happening, all
> three nodes are displayed as top level nodes.
>
> 2.) tooltips aren't working, the title attribute is rendered as title="";
>
>
> Can anyone give me a clue?
>
>
> Thanks
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.