Multiple Marriages - Genogram

Hi,

I’m currently reviewing your library for developing a genogram.

I’ve noticed an issue when a family member has been married more than twice. See below. (The structure of the data is slightly different, but I can replicate this issue on the genogram example on your website)

Male 1 has been married twice

   var familyData = [
    { key: 1, n: "Male 1", gender: "M", marriages: [{ marID: 1000, spouseID: 2 }, { marID: 1000, spouseID: 3 }] },
    { key: 2, n: "Female 1", gender: "F", marriages: [{ marID: 1000, spouseID: 1 }] },
    { key: 3, n: "Female 3", gender: "F", marriages: [{ marID: 11111, spouseID: 1 }] },
    { key: 300, n: "Test", gender: "M", marriages: []}
    ];

As you can see, this renders as expected.

Male 1 has been married 3 times

    var familyData = [
    { key: 1, n: "Male 1", gender: "M", marriages: [{ marID: 1000, spouseID: 2 }, { marID: 11111, spouseID: 3 }, { marID: 222222, spouseID: 4 }] },
    { key: 2, n: "Female 1", gender: "F", marriages: [{ marID: 1000, spouseID: 1 }] },
    { key: 3, n: "Female 3", gender: "F", marriages: [{ marID: 11111, spouseID: 1 }] },
    { key: 4, n: "Female 4", gender: "F", marriages: [{ marID: 222222, spouseID: 1 }] }
    ];

I’ve spread the nodes out just to show you how it renders. But you can see that Male 1 no longer appears, and the links are broken.

If you could give me some pointers on resolving this that would be great, as it seems gojs is the most flexible solution in regards to integrating the dataset I have to work with.

Thanks

Rob

I think you’re not setting up the Nodes and Links correctly. Notice that in the Genogram sample, there’s a setupDiagram function that you call to create the appropriate Nodes and Links.

I tried the following family:

      setupDiagram(myDiagram, [
          { key: 0, n: "husband", s: "M", ux: [1, 2, 3] },
          { key: 1, n: "wife 1", s: "F" },
          { key: 2, n: "wife 2", s: "F" },
          { key: 3, n: "wife 3", s: "F" },
          { key: 11, n: "child 1 1", s: "M", f: 0, m: 1 },
          { key: 12, n: "child 1 2", s: "M", f: 0, m: 1 },
          { key: 21, n: "child 2 1", s: "F", f: 0, m: 2 },
          { key: 22, n: "child 2 2", s: "F", f: 0, m: 2 },
          { key: 31, n: "child 3 1", s: "F", f: 0, m: 3 },
          { key: 32, n: "child 3 2", s: "M", f: 0, m: 3 }
        ]);

I got back these results:

Oh, wait – there was one change I made. I set the Link.routing on the Marriage Links to be AvoidsNodes:

      myDiagram.linkTemplateMap.add("Marriage",  // for marriage relationships
        $(go.Link, { selectable: false, routing: go.Link.AvoidsNodes },
          $(go.Shape, { strokeWidth: 2, stroke: "darkgreen" })
      ));

If I move one of the parent nodes around, I can see that the relationships are maintained visually. (But a new layout is not performed.)

Hi,

Thanks for your response. If you extend the number of marriage to 4, you get the same behaviour previously mentioned

    [
      { key: 0, n: "husband", s: "M", ux: [1, 2, 3, 4] },
      { key: 1, n: "wife 1", s: "F" },
      { key: 2, n: "wife 2", s: "F" },
      { key: 3, n: "wife 3", s: "F" },
      { key: 4, n: "wife 4", s: "F" }
    ];

Is there a reason why this happens? Thanks

No, it works for me:

Are you still calling setupDiagram with a third argument of 4? That intentionally removes any spouse for that person. Why? Because some customers said that that is the normal thing to do when focusing on a particular person. Maybe I should comment that out, to avoid confusion.

Sorry for the late reply. Removing the the third argument from setupDiagram seems to resolve the issue for me. Thanks for all your help.