GoJS 家系图。无法读取 null 的属性(读取 'centerX')

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

我使用这个官方示例中的代码 https://github.com/NorthwoodsSoftware/GoJS/blob/master/samples/genogram.html
但是我的数据

 [{ 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"    }]

我在这里遇到错误

因为没有创建 id 17?

你能帮忙修一下吗?

问题出在

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

因为它适用于

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

如果我将 ID 更改为 int 也可以。
但是有完整的数据

[{ 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  }]

我收到错误 Cannot read properties of null (reading 'centerX')

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

这实际上是库中的一个错误,已在 v2.1.54 中修复,即将推出....

感谢您报告问题并提供可重现的案例。