thank you so much.
Here the full code is 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>
      Google Visualization API Sample
    </title>
    <script type="text/javascript" 
src="http://www.google.com/jsapi";></script>
    <script type="text/javascript">
      google.load('visualization', '1', {packages: ['orgchart']});
    </script>
    <script type="text/javascript">
      function drawVisualization() {
        // Create and populate the data table.
        var data = google.visualization.arrayToDataTable([
          
['Name',                                                                 
'Manager', 'Tooltip'],
          
['Mike',                                                                 
null,      'The President'],
          [{v: 'Jim', f: 'Jim<br/><font color="red"><i>Vice 
President<i></font>'}, 'Mike',    null],
          
['Alice',                                                                
'Mike',    null],
          
['Bob',                                                                  
'Jim',     'Bob Sponge'],
          
['Carol',                                                                
'Bob',     null]
        ]);
      
        // Create and draw the visualization.
        var chart = new 
google.visualization.OrgChart(document.getElementById('visualization'));
                chart.draw(data, {allowHtml: true, allowCollapse: true});
                
              for (var i = 0; i < data.getNumberOfRows(); i++) {
                  chart.collapse(i, true);
                }
       google.visualization.events.addListener(chart, 'select', function () 
{
    // get the row of the node clicked
    var selection = chart.getSelection();
    var row = selection[0].row;
    // get a list of all collapsed nodes
    var collapsed = chart.getCollapsedNodes();
    // if the node is collapsed, we want to expand it
    // if it is not collapsed, we want to collapse it
    var collapse = (collapsed.indexOf(row) == -1);
    chart.collapse(row, collapse);
    // clear the selection so the next click will work properly
    chart.setSelection();
}); 
      }

      google.setOnLoadCallback(drawVisualization);
    </script>
  </head>
  <body>
    <div id="visualization">
</div>
  </body>
</html>

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