Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hierarchy.compactBox 返回的 Node 的 eachNode 实例方法变成了 each #1

Open
bolasblack opened this issue Nov 1, 2018 · 0 comments

Comments

@bolasblack
Copy link

bolasblack commented Nov 1, 2018

你好,今天在看 G2 的文档的时候发现 https://antv.alipay.com/zh-cn/g2/3.x/demo/other/tree-compact-box.html 这个页面的示例代码出错了,似乎一共是两处错误

  1. DataSet.View#getAllNodes 里调用了 Node#each ,但其实应该是 Node#eachNode
  2. 第 75 行代码尝试读取 item.point.hasChildren ,但似乎 API 已经发生变化了,应该是 item.hasChildren

想要修复第一个问题时,一开始以为是 data-set 这个库的代码有问题,但在我 fork 并修改了 data-set 这个仓库的代码后,单元测试报错说没有 eachNode 这个方法,于是我打印了一下 Node 的原型的属性:

https://github.com/bolasblack/data-set/blob/b32d2f5e27f315d599fe6065db98c9047c2948c1/test/unit/api/hierarchy-spec.js#L12

结果是

image

真的有 each 但没有 eachNode

我检查了很久没有找到原因,只发现在 node_modules/@antv/hierarchy/lib/layout/ 中对比 src/layout/ 多出了一个 node.js 文件,里面确实有 each 方法没有 eachNode 方法

但是在我尝试重新生成 lib 目录,并且删除 build 和 dist 目录后,依旧存在这个问题

我实在没辙了,只好发一个 issue ……

如果你们有空的话可以顺便修一下上面提到的文档里的代码,如果优先级不高的话也可以等我把这个问题解决我再提一个 PR 更新一下上面的文档……

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant