简体   繁体   English

圈子中的d3.layout.pack文本会覆盖其他圈子中的其他文本

[英]d3.layout.pack text inside circle overrides other text in other circle

I'm using d3.layout.pack to place circles inside other main circle, like in http://mbostock.github.io/d3/talk/20111018/pack.html 我正在使用d3.layout.pack将圆放置在其他主圆内,例如http://mbostock.github.io/d3/talk/20111018/pack.html

在此处输入图片说明

But i have larger texts inside circles that override the circle and can override another text in a near circle: 但是我在圆圈内有较大的文本可以覆盖该圆圈,并且可以覆盖附近的圆圈中的另一个文本:

在此处输入图片说明

The solutions I can think are: 我能想到的解决方案是:

  • cut text for not to override the circle 剪切文字以不覆盖圆
  • put smaller font for the circles. 为圆圈放置较小的字体。
  • set greater padding 设置更大的填充
  • put a tooltip onmouseover the circle 在鼠标上圈出工具提示
  • rotate text?? 旋转文字?

But that ideas doesn't satisfy me too much. 但是那个想法并不能使我满意。 I will like for example in this case to place the two smaller balls more spaced. 例如,在这种情况下,我想将两个较小的球更隔开。

Can d3.layout.pack do some more interesting avoiding the circle overriding? d3.layout.pack可以做一些更有趣的事情来避免圆圈被覆盖吗?

Can I use d3.layout.force for this? 我可以d3.layout.force使用d3.layout.force吗? Any ideas? 有任何想法吗?

I would suggest as one of possibilities the answer to question 'Text along a circle in a D3 circle pack layout' : 我可能会提出以下问题的答案之一: “在D3圆圈包布局中沿圆圈的文字”

jsfiddle 的jsfiddle

在此处输入图片说明

Basically, the idea is to draw labels along the circles instead in the centers of the circles. 基本上,这个idea是沿着圆形而不是圆形的中心绘制标签。 Also, you might consider drawing only some of the labels at the time - those that belong to small circles maybe should be omitted. 另外,您可能会考虑当时仅绘制一些标签-属于小圆圈的那些标签可能应该省略。

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

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