How to format tree structure to fit on printable page or screen?

Is there a way to layout a tree structure to fill a page or viewable area on the screen?

I assume you have carefully read,, and

If you specify a 100% width and height of the element that holds the result of calling Diagram.makeImage or Diagram.makeSvg with argument { scale: 1 }, what results do you get?

Yes, I’ve read the documentation on printing. But I’m talking about optimizing the layout so all nodes would be dimensionally constrained to a page size view or the web page view area, utilizing empty space with nodes that currently flow off the page or view.

Oh, so do you have a really tall tree or a really wide tree?

There’s no easy answer for the former case, but for the latter case if you are using TreeLayout you could try setting TreeLayout.breadthLimit.

I’ve played with constraining the breadthLimit, but I see some pretty strange behavior with entire sub-trees being pushed off the screen.

I’m really just looking for a simple way to fill the viewable area with as many nodes as possible, but there may not be one…

The diagrams I’m creating are dynamic with child nodes being created via ajax calls when the expander button is clicked, if it matters.

You might be able to choose values for TreeLayout.breadthLimit so that when Diagram.autoScale is Diagram.Uniform. the layout has about the same aspect ratio as the DIV element does.