is there anyway to vertically align the boxes in google org chart visualization

leora picture leora · Jan 25, 2011 · Viewed 11.3k times · Source

i am using google org chart visualization API and i want to have the vertical alignment set to top on the cells. (i am showing multiple people in each org chart box so i want every "level" to align to the top instead of the middle. So in the example, where you have Alice which is vertically centered. i want it to valign="top". is this possible to do using the google visualization api ??

Answer

xBoarder picture xBoarder · Feb 19, 2011

You can style the elements within the Org Chart. Here's how I did it...

My mistake at first was to add the css block above the Google Javascript code. Once I moved it down, I could change pretty much any visual property.

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

        /*GOOGLE MUMBO JUMBO GOES HERE*/

        var chart = new google.visualization.OrgChart(document.getElementById('chart_div'));
        chart.draw(data, {allowHtml:true});
      }
</script>
<style type="text/css">
    .google-visualization-orgchart-node {
        width: 240px;
    }
    .google-visualization-orgchart-node-medium {
        vertical-align: top;
    }
</style>