Sorting a tree help

Hi, I am trying to modify the Genogram example to sort a family tree based on birth year

found the documentation code below which I should be able to adapt fairly easily but I can’t see where I can insert this in the Genogram example as it uses a custom layout …

any help is much appreciated


$(go.Diagram, . . .,
sorting: go.TreeLayout.SortingAscending,
comparer: function(a, b) {
// A and B are TreeVertexes
var av =;
var bv =;
if (av < bv) return -1;
if (av > bv) return 1;
return 0;
. . .
. . .

Yes, that is a problem, because the layout used by the Genogram sample is currently a derivation of LayeredDigraphLayout, which intentionally tries to reorder children to reduce link crossings.

It is possible to affect the order by changing the order in which the links from the marriage to the children are created. But that means reloading the whole diagram starting with reordered model data.

Some day, when things are not so busy, we intend to completely reimplement GenogramLayout so that it has fewer faults and more commonly desired features.

Thanks, and great look forward to that one day. Fantastic piece of software by the way!