信息可视化。在绘制之前计算树画布尺寸
在我当前的项目中,我尝试使用 Infoviz 库来可视化树结构,以显示分层树结构。它工作得很好,并以我想要的形式显示树。但我唯一的问题是我找不到绘制随机大小的树的方法。
问题是我需要绘制所有级别的完整树,并且节点数量根据用户数据而变化。但是 infoviz 需要固定宽度和高度的画布,并且我没有找到可以在绘图之前计算所需尺寸的方法。现在 infoviz 只是截断了树的其余部分,因此无法看到它。
问题是:是否可以通过获取画布大小来绘制完整的树?
On my current project I'm trying to visualize tree structure using Infoviz library to display hierarchical tree structure. It works pretty well and display the tree in the form I want. But the only problem I have is that I do not find a way to draw the tree of random size.
The problem is that I need to draw the full tree with all levels and number of nodes varies according to user data. But infoviz requires canvas of fixed width and height and I didn't find a may to calculate required size prior to drawing. Now infoviz just truncates rest of the tree and there is no way to see it.
The question is: Is it possible to make get canvas size to draw the full tree?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
画布大小通过 CSS 控制。您应该能够在 base.css 文件中找到它,并且应该看起来像这样:
通过更改高度和宽度,您应该能够获得所需的大小。
希望有帮助!
The canvas size is controlled via CSS. You should be able to find it in the base.css file and should look something like this:
By changing the height and width, you should be able to get the size you need.
Hope that helps!