You need to hook up a "ready" event listener and manually collapse the rows
you want collapsed.
var runOnce = google.visualization.events.addListener(chart, 'ready',
function () {
google.visualization.events.removeListener(runOnce);
// collapse all desired nodes
// assumes "nodes" is an array of row indices for nodes to collapse
for (var i = 0; i < nodes.length; i++) {
chart.collapse(nodes[i], true);
}
});
alternatively it might be easier to collapse all nodes and then uncollapse
only the ones you want shown:
var runOnce = google.visualization.events.addListener(chart, 'ready',
function () {
google.visualization.events.removeListener(runOnce);
// collapse all nodes
for (var i = 0; i < data.getNumberOfRows(); i++) {
chart.collapse(i, true);
}
// uncollapse only the rows you want to show
// assumes "nodes" is an array of row indices for nodes to uncollapse
for (var i = 0; i < nodes.length; i++) {
chart.collapse(nodes[i], false);
}
});
On Tuesday, March 19, 2013 3:03:38 PM UTC-4, Kelly Geer wrote:
>
> I'm way out of my element here and could use some guidance. I've
> developed an Organizational Chart and set the allowCollapse: true and all
> is working well. However, my OrgChart is too large to have have all nodes
> open on loading. How can I set it so that only the first 3 rows are
> visible and the subsequent rows are not until the user double clicks?
> Thanks in advance.
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.