Hi,

I am new to google visualization api and still have a lot to learn.

I created the following code. But dont know how can I ge the value or
label of these boxes er. carol and ruby.

Here is my code

* the commented alert boxes are what i was trying to get the label ,
but didnt work.




<html>  <head>    <script type="text/javascript" src="http://
www.google.com/jsapi">
</script>

<script type="text/javascript">
      google.load("visualization", "1", {packages:["orgchart"]});

              google.setOnLoadCallback(drawChart);
                  var orgchart;

                   function drawChart()
                   {

                    var data = new google.visualization.DataTable();
                            data.addColumn('string', 'Name');
                                data.addColumn('string', 'Manager');
                                data.addRows(6);
                                data.setCell(0, 0, 'Mike');
                                data.setCell(1, 0, 'Jim');
                                data.setCell(1, 1, 'Mike');
                                data.setCell(2, 0, 'Alice');
                                data.setCell(2, 1, 'Mike');
                                data.setCell(3, 0, 'Ruby');
                                data.setCell(3, 1, 'Mike');
                                data.setCell(4, 0, 'Bob');
                                data.setCell(4, 1, 'Jim');
                                data.setCell(5, 0, 'Carol');
                                data.setCell(5, 1, 'Bob');



                                orgchart  = new google.visualization.OrgChart
(document.getElementById('chart_div'));
                                orgchart.draw(data, {});
                                
google.visualization.events.addListener(orgchart, 'select',
display);
                        }

                        function display(e)
                        {
                                 var selection = orgchart.getSelection();

                                var message = '';
                                for (var i = 0; i < selection.length; i++)
                                {

                                        alert ("Success !!!");
                                        var item = selection[i];
                                        //alert('You have item as ' + item);
                                        if (item.row != null)
                                        {      message += '{row:' + item.row 
+'}';
                                //      alert ("value is "+ 
selection.getValue(rowInds[i]));

                //                       alert ("You have " + item.row.label);
                                        }

                                }

                                if (message == '')
                                {   message = 'nothing';
                                }

                                        alert('You selected ' + message);

                        }

                           </script>
                 </head>
                  <body>

                 <div id="chart_div"></div>  </body></html>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
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