[OrgChart] setFormattedValue problem

326 views
Skip to first unread message

Daniele

unread,
Dec 4, 2009, 9:10:50 AM12/4/09
to Google Visualization API
Hi

I'm trying to display an Orgchart creating DataTable with servlet and
visualization java API

if I build my DataTable with the function

addRowFromValues(val1,val2);

everything works fine (the Orgchart on the web page is displayed in
the correct way)

but if I want use formatted values using

TableCell cell1 = new TableCell(val1);
TableCell cell2 = new TableCell(val2);

cell1.setFormattedValue("formatted value 1");
cell2.setFormattedValue("formatted value 2");

the Orgchart is not displayed correctly.

Any suggestions ?

Thanks
Daniele

VizGuy

unread,
Dec 6, 2009, 5:32:36 AM12/6/09
to google-visua...@googlegroups.com
In general, formatted values are supported, as can be seen in the example at http://code.google.com/apis/visualization/documentation/gallery/orgchart.html

I am not sure what is the problem you describe.
Please add code snippets and / or example pages and more details of the problem.

Regards,
VizGuy




--

You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.



Message has been deleted
Message has been deleted
Message has been deleted

Daniele

unread,
Dec 9, 2009, 11:33:13 AM12/9/09
to Google Visualization API
I figured it out, it's a strange behavior of OrgChart:

Add this code in Ajax play ground to understand where the issue come
from


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html> <head> <meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript" src="http://www.google.com/jsapi"></
script>
<script type="text/javascript"> google.load('visualization',
'1', {'packages': ['orgchart']});
google.setOnLoadCallback(init);

// Handle the query response.
function init() {

var data = new google.visualization.DataTable();
data.addColumn('string', 'CHILD');
data.addColumn('string', 'PARENT');
data.addColumn('string', 'ToolTip');
data.addRows([
// PARENT1
//With Formatted values the visualization is not working
well
[{v:'PARENT1'},{v:'ROOT'},{v:'LABEL-parent1'}],
[{v:'CHILD_1',f:'CHILD'},{v:'PARENT1'},{v:'LABEL-child1'}],
[{v:'LEAF'},{v:'CHILD_1', f:'CHILD'},{v:'LABEL-leaf1'}],

// PARENT2
//Without Formatted values the visualization of the tree is
fine
[{v:'PARENT2'},{v:'ROOT'},{v:'LABEL-parent2'}],
[{v:'CHILD_2'},{v:'PARENT2'},{v:'LABEL-child2'}],
[{v:'LEAF2'},{v:'CHILD_2'},{v:'LABEL-leaf2'}],

// PARENT3
//With formatted values equals to values the visualization
is fine
[{v:'PARENT3'},{v:'ROOT'},{v:'LABEL-parent3'}],
[{v:'CHILD_3',f:'CHILD_3'},{v:'PARENT3'},{v:'LABEL-
child3'}],
[{v:'LEAF3'},{v:'CHILD_3',f:'CHILD_3'},{v:'LABEL-leaf3'}],


//PARENT4
//Seems that the tree is using the formatted values of the
child to make a link
//with the value of the parent, in fact if we add this
branch we can see that it will connect
// to the CHILD of PARENT1
[{v:'PARENT4'},{v:'ROOT'},{v:'LABEL-parent4'}],
[{v:'CHILD_4',f:'CHILD_4'},{v:'PARENT4'},{v:'LABEL-
child4'}],
[{v:'LEAF4'},{v:'CHILD_4',f:'CHILD_1'},{v:'LABEL-leaf4'}],

]);
var chart = new google.visualization.OrgChart
(document.getElementById('chart_div')); chart.draw(data,
{allowHtml:true, size: 'small', height: 150, is3D: true,
allowCollapse: true}); }
</script>
</head>
<body>
<div id="chart_div"></div> </body> </html>
Reply all
Reply to author
Forward
0 new messages