Search code examples
gojs

GoJS Genogram. Cannot read properties of null (reading 'centerX')


I use code from this offical example https://github.com/NorthwoodsSoftware/GoJS/blob/master/samples/genogram.html
but with my data

 [{ key: "1", n: "1", s: "M"   ,  ux:"2"   },
{ key: "2", n: "2", s: "F"    ,  vir:"1"   },
{ key: "8", n: "8", s: "F"  ,  vir:"17" , m: "2" , f: "1"},
{ key: "17", n: "17", s: "M"  ,  ux:"8"    }]

Im getting error here enter image description here

because id 17 was not created? enter image description here

Can you please help to fix it?

Problem is in

 { key: "8", n: "8", s: "F"  ,  vir:"17" , m: "2" , f: "1"},

Because it works with

{ key: "8", n: "8", s: "F"  ,  vir:"17"  },

also it works if I change ID to int.
But with full data

[{ key: 1, n: "1", s: "M"   ,  ux:[2,12,90,160]   },
{ key: 2, n: "2", s: "F"    ,  vir:1  },
{ key: 8, n: "8", s: "F" , m: 2 , f: 1  ,  vir:17  },
{ key: 12, n: "12", s: "F"    ,  vir:[1,19,109,164]  },
{ key: 13, n: "13", s: "F" , m: 12 , f: 1  ,  vir:[19,63,72,101,109,163]  },
{ key: 15, n: "15", s: "F" , m: 12 , f: 1  ,  vir:[19,166]  },
{ key: 17, n: "17", s: "M"   ,  ux:8   },
{ key: 19, n: "19", s: "M" , m: 8 , f: 17 ,  ux:[12,13,15,35,76,88,116]   },
{ key: 27, n: "27", s: "M" , m: 8 , f: 17 ,  ux:32   },
{ key: 32, n: "32", s: "F" , m: 13 , f: 19  ,  vir:27  },
{ key: 35, n: "35", s: "F" , m: 15 , f: 19  ,  vir:[19,63,101,163]  },
{ key: 63, n: "63", s: "M"   ,  ux:[13,35]   },
{ key: 72, n: "72", s: "M"   ,  ux:13   },
{ key: 76, n: "76", s: "F" , m: 13 , f: 72  ,  vir:[19,101]  },
{ key: 88, n: "88", s: "F"    ,  vir:[19,101]  },
{ key: 90, n: "90", s: "F" , m: 88 , f: 19  ,  vir:[1,101]  },
{ key: 101, n: "101", s: "M"   ,  ux:[13,35,76,88,90]   },
{ key: 109, n: "109", s: "M"   ,  ux:[12,13]   },
{ key: 111, n: "111", s: "F" , m: 13 , f: 109  ,  vir:117  },
{ key: 116, n: "116", s: "F" , m: 88 , f: 101  ,  vir:[19,164]  },
{ key: 117, n: "117", s: "M" , m: 88 , f: 101 ,  ux:111   },
{ key: 153, n: "153", s: "F" , m: 90 , f: 1  ,  vir:164  },
{ key: 160, n: "160", s: "F" , m: 88 , f: 101  ,  vir:1  },
{ key: 163, n: "163", s: "M" , m: 88 , f: 101 ,  ux:[13,35]   },
{ key: 164, n: "164", s: "M"   ,  ux:[12,116,153,223]   },
{ key: 166, n: "166", s: "M" , m: 116 , f: 164 ,  ux:15   },
{ key: 223, n: "223", s: "F"    ,  vir:164  }]

Im gettig error Cannot read properties of null (reading 'centerX')

enter image description here

http://jsfiddle.net/Risay/ehcyvp50/


Solution

  • That's actually a bug in the library, which has been fixed for v2.1.54, coming soon....

    Thanks for reporting the problem and providing a reproducible case.