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 ??
is there anyway to vertically align the boxes in google org chart visualization
12.8k Views Asked by leora AtThere are 5 best solutions below

Elzo had a suggestion but instead of using valign: top; you need to use vertical-align: top like below
data.setProperty(0, 0, "style", "vertical-align:top;");

I'm not sure if there is a simple way to do that with Google API but you can achieve that with simple CSS;
Instead of
['Alice', 'Mike', ''],
you can write
['<div style="height:50px;vertical-align:top">Alice</div>', 'Mike', ''],
If you want, you can also write a JavaScript code to calculate that cell's height and assign it to that cell's div tag.
EDIT: If you want to vertically align the TD element, you can write a custom CSS;
.google-visualization-orgchart-node {vertical-align:top;}

You can adjust CSS by cell with setProperty function:
// for 0 row 0 column
data.setProperty(0, 0, "style", "valign:top;");

For those looking for a simple, open-source Javascript Organizational Chart library:
I've just published lib_gg_orgchart. It uses a JSON input and draws the chart using Raphael.
Take a look at the site for some examples and download:
http://www.fluxus.com.ve/gorka/lib_gg_orgchart
If you find it useful, please let me know.
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.