用于深入了解统计树的 JavaScript 控件
我有一个包含统计信息的 JSON 数据树:
{
prefix: "a",
count: 20,
children: [
{
prefix: "a:b",
count: 15,
children: [
{ prefix: "a:b:c", count: 5 },
{
prefix: "a:b:d",
count: 10
children: [
{ prefix: "a:b:d:e", count = 7 },
{ prefix: "a:b:d:f", count = 3 }
]
}
]
},
{ prefix: "a:c", count: 5 }
]
}
叶子总数很大(但我认为我会在服务器上预先截断它们,所以这应该不是问题)。
我可以根据需要更改输出格式。
我需要制作一个 Web UI 来可视化这棵树,并能够深入到某些节点,让用户直观地分析哪些前缀具有最大的权重(即计数)。
我认为 treemap 控件应该可以在这里使用,但我愿意接受其他建议。
请告知我可以重用哪个免费的 JavaScript 库。最好是免费的、强大的和易于使用的东西(但如果它很优秀,非免费的也可以)。
jQuery 感知库是更好的选择,但如果足够好,其他任何库都可以接受。
I have a JSON data tree with statistical information:
{
prefix: "a",
count: 20,
children: [
{
prefix: "a:b",
count: 15,
children: [
{ prefix: "a:b:c", count: 5 },
{
prefix: "a:b:d",
count: 10
children: [
{ prefix: "a:b:d:e", count = 7 },
{ prefix: "a:b:d:f", count = 3 }
]
}
]
},
{ prefix: "a:c", count: 5 }
]
}
Total number of leaves is huge (but I will pre-truncate them on server, I think, so that should not be a problem).
I can change output format as needed.
I need to make a web-UI to visualize this tree and be able to drill down to certain nodes, to let user to visually analyze which prefixes have largest weight (i.e. count).
I think that a treemap control should work here, but I'm open to other suggestions.
Please advise, which free JavaScript library I can reuse. Preferably something free, robust and easy to use (but non-free OK if it is excellent).
jQuery-aware libraries are preferable, but anything else is accepted if it is good enough.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我发现
JavaScript InfoVis Toolkit
非常有趣(没有使用过),但似乎非常有前途[开源]I find the
JavaScript InfoVis Toolkit
very interesting (haven't used it) but seems really promising [open source]来自斯坦福大学可视化小组的 ProtoVis 是您的另一个选择。请参阅示例页面中的“层次结构”部分。
ProtoVis from the Stanford Visualization group is another option for you. See under the Hierarchies section in the example page.
如果返回的层次结构不是太深,常规树可以工作吗? http://www.jstree.com/
If the hierarchy returned is not too deep, would a regular tree work? http://www.jstree.com/
我使用 JavaScript InfoVis Toolkit 中的树形图来完成类似的操作。
但不是使用 JIT 树形图中内置的向下钻取和向上钻取功能,
我发现一次向树形图提供单个级别的数据,然后在必要时用新数据重新绘制它更容易。
使用该技术 JIT 速度快且易于配置。
I've used the treemap in JavaScript InfoVis Toolkit to do a similar thing.
But instead of using the built-in drilling down and up function in the treemap from JIT,
I found it easier to serve a single level of data to the treemap at a time, and then redraw it with new data when necessary.
Using that technique The JIT is fast, and easy to configure.
之前在 将 JSON/YAML 层次结构显示为 HTML 中的树中询问?
查看在“div”中显示树的答案。
可以在 json 属性名称中添加一些 JavaScript,以显示/隐藏下一个 div。
抱歉,我还没有准备好代码,如果问得好的话,也许我会的:)
asked before in Display JSON/YAML hierarchy as a tree in HTML?
see the answer that display the tree in "divs".
it is possible to add a little javascript to the json property names, to show/hide the next div.
sorry, i don't have code ready, maybe i will, if asked nicely :)