All nodes with children must have globally unique id's, or else their child 
nodes won't be able to distinguish which node is their parent.  Since trees 
are programmatically extensible, it makes sense to enforce unique id's on 
all nodes, regardless of whether or not they have any child nodes at draw 
time (as a previously child-less node may have children on redraw).  The 
solution proposed by tay is probably the best way to handle the problem, 
absent significant modifications to the TreeMap code that determines the 
parent-child relationships.

On Wednesday, January 2, 2013 4:36:03 PM UTC-5, Daniel LaLiberte wrote:
>
> Ribardiere ,
>
> I don't know of a reason that the ids have to be globally unique, other 
> than it was assumed to be a reasonable assumption, so I agree with your 
> assessment.  It doesn't seem so difficult to fix, but I won't know until I 
> have time to look into it.  We might have to construct global unique ids 
> for every node by using all the ancestors, for example.  Thanks for your 
> posting about this issue.
>
> dan
>
> On Wed, Jan 2, 2013 at 3:45 PM, Ribardiere Olivier 
> <[email protected]<javascript:>
> > wrote:
>
>> Hi,
>>
>> In a Treemap chart, 2 nodes should be able to have the same name if they 
>> don't have the same parent.
>>
>> function drawVisualization() {
>>   // Create and populate the data table.
>>   var data = google.visualization.arrayToDataTable([
>>     ['Child' , 'Parent', 'Size', 'Color'],
>>     ['Global',    null,                0,                               0
>> ],
>>     ['Child1',   'Global',             0,                               0
>> ],
>>     ['Child2',   'Global',             0,                               0
>> ],
>>     ['ChildA',   'Child1',            10,                               0
>> ],
>>     ['ChildB',   'Child1',            10,                               0
>> ],
>>     ['ChildA',   'Child2',            10,                               0
>> ],
>>     ['ChildB',   'Child2',            10,                               0
>> ]
>>   ]);
>>
>>   // Create and draw the visualization.
>>   var treemap = new google.visualization.TreeMap(document.getElementById(
>> 'visualization'));
>>   treemap.draw(data, {
>>     minColor: 'red',
>>     midColor: '#ddd',
>>     maxColor: '#0d0',
>>     maxDepth: 2,
>>     headerHeight: 15,
>>     fontColor: 'black',
>>     showScale: true});
>> }
>>
>> Following code raises "More than one row with the same ID (ChildA)", it 
>> should not.
>>
>> Olivier
>>
>> -- 
>> 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/-/azc-Uov2mDMJ.
>> To post to this group, send email to 
>> [email protected]<javascript:>
>> .
>> To unsubscribe from this group, send email to 
>> [email protected] <javascript:>.
>> For more options, visit this group at 
>> http://groups.google.com/group/google-visualization-api?hl=en.
>>
>
>
>
> -- 
> Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> 
>  - 978-394-1058
> [email protected] <javascript:>   562D 5CC, Cambridge MA
> [email protected] <javascript:> 9 Juniper Ridge Road, Acton MA
>  

-- 
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/-/efVJtGVWHDcJ.
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