D3 pack layout with comparable parents

我们两清 提交于 2020-01-05 04:19:09

问题


we are trying to create a visualisation with D3 which represents a stock portfolios assets with relative sized weightings with 3 levels deep nested data. We have used D3 Pack and a zoom function such as this as a template https://bl.ocks.org/mbostock/7607535

The issue we are facing is D3 pack works from the children up the parent chain, and the parents sizes are not relative to each other due to the fact D3 pack tries to pack the children most efficiently as possible and depending on the number and size of the circles in each container they will be more or less efficient by volume (2 circles of equal size is 50% efficient to its parent circle volume, where as 3 circles is approx. 75% efficient). This means the object with 3 circles appears smaller than the object with 2 circles, even both add up to the same weighting, lets say 50,50 and 33,33,33.

Is there a way to make the parents equal by size for such a visualisation? Essentially this would require additional padding on the smaller circles or scale the children of the larger one down to match. Its an interesting problem and I think the reverse of what D3 pack was set out to achieve but a very practical application.

Thanks in advance.

来源:https://stackoverflow.com/questions/50960702/d3-pack-layout-with-comparable-parents

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!