简体   繁体   English

D3圈包布局算法

[英]D3 circle pack layout algorithm

I have a visualization based on the zoomable circle pack layout example bound to a hierarchical data set. 我有一个可视化基于绑定到分层数据集的zoomable circle pack布局示例。

I'm seeing an issue with the areas of circles of a given depth not being directly comparable ie values with a ratio of 2 don't appear to visually have areas of the same ratio. 我看到给定深度的圆形区域不能直接比较的问题,即比率为2的值在视觉上看起来不具有相同比率的区域。

I expect there to be some error in the packing algorithm but as the following log snippet shows it's pretty significant: 我希望在打包算法中有一些错误,但是下面的日志片段显示它非常重要:

area = 708821.8424661972, value = 45888, area / d.value = 15.446780039796836, depth = 0 hiersortfilter.html:657
area = 26507.55404641439, value = 4654, area / d.value = 5.695649773617187, depth = 1 hiersortfilter.html:657
area = 26507.55404641439, value = 4654, area / d.value = 5.695649773617187, depth = 2 hiersortfilter.html:657
area = 113.6437117690809, value = 63, area / d.value = 1.8038684407790617, depth = 3 hiersortfilter.html:657
area = 113.6437117690809, value = 63, area / d.value = 1.8038684407790617, depth = 4 hiersortfilter.html:657
area = 113.6437117690809, value = 63, area / d.value = 1.8038684407790617, depth = 5 hiersortfilter.html:657
area = 0.9339196960560362, value = 1, area / d.value = 0.9339196960560362, depth = 6 hiersortfilter.html:657
area = 17.74447422506469, value = 19, area / d.value = 0.9339196960560363, depth = 6 hiersortfilter.html:657
area = 10.273116656616397, value = 11, area / d.value = 0.9339196960560361, depth = 6 hiersortfilter.html:657
area = 29.88543027379316, value = 32, area / d.value = 0.9339196960560362, depth = 6 hiersortfilter.html:657
area = 110.13198200238504, value = 58, area / d.value = 1.8988272759031903, depth = 3 hiersortfilter.html:657
area = 110.13198200238504, value = 58, area / d.value = 1.8988272759031903, depth = 4 hiersortfilter.html:657
area = 110.13198200238504, value = 58, area / d.value = 1.8988272759031903, depth = 5 hiersortfilter.html:657
area = 8.405277264504326, value = 9, area / d.value = 0.9339196960560362, depth = 6 hiersortfilter.html:657
area = 15.876634832952611, value = 17, area / d.value = 0.933919696056036, depth = 6 hiersortfilter.html:657
area = 7.47135756844829, value = 8, area / d.value = 0.9339196960560362, depth = 6 hiersortfilter.html:657
area = 11.207036352672434, value = 12, area / d.value = 0.9339196960560362, depth = 6 hiersortfilter.html:657
area = 11.207036352672434, value = 12, area / d.value = 0.9339196960560362, depth = 6 hiersortfilter.html:657
area = 2155.192321114232, value = 669, area / d.value = 3.221513185522021, depth = 3 hiersortfilter.html:657
area = 2155.192321114232, value = 669, area / d.value = 3.221513185522021, depth = 4 hiersortfilter.html:657
area = 567.0544456457064, value = 349, area / d.value = 1.6247978385263795, depth = 5 

I'm happy to dig further and try and debug but before doing so wanted to check that my understanding of the algorithm is correct ie the ratio of area per unit value should be ideally constant across all levels and if not at least for a given depth? 我很乐意进一步挖掘并尝试调试,但在此之前想要检查我对算法的理解是否正确,即每单位面积的面积比率应该在所有级别上理想地保持不变,如果不是至少对于给定的深度?

From the documentation : 文档

Enclosure diagrams use containment (nesting) to represent the hierarchy. 机箱图使用包含(嵌套)来表示层次结构。 The size of each leaf node's circle reveals a quantitative dimension of each data point. 每个叶节点圆的大小显示每个数据点的定量维度。 The enclosing circles show the approximate cumulative size of each subtree, but note that because of wasted space there is some distortion between levels; 封闭圆圈显示每个子树的近似累积大小,但请注意,由于浪费的空间,级别之间存在一些失真; only the leaf nodes can be compared accurately . 只能准确地比较叶节点

So your assumption does not hold. 所以你的假设不成立。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM