简体   繁体   English

D3带有工具提示的放射状树?

[英]D3 Radial Tree with Tooltip?

Hi stackoverflow community! 嗨stackoverflow社区!

I'm new to d3 and I'm attempting to stand on the shoulders of giants to create a visualization. 我是d3的新手,我试图站在巨人的肩膀上以创建可视化效果。

I've gotten to a place that I'm happy with my Radial Tree but i'm having trouble adding tooltips. 我到了一个对径向树感到满意的地方,但是在添加工具提示时遇到了麻烦。 Is it possible in a radial tree? 放射状的树有可能吗?

(I would think it is - I'm just not that clever :? ) (我认为这是-我不是那么聪明:?)

You can see my attempt on codepen here: http://codepen.io/anon/pen/KctDb 您可以在此处查看我对Codepen的尝试: http ://codepen.io/anon/pen/KctDb

I should also mention I haven't added many "info" tags (one is on "Heart -> ICD-10 -> I00) but i dont want to spend the time until I get the tool tip working. 我还应该提到我还没有添加很多“信息”标签(其中一个位于“ Heart-> ICD-10-> I00”上),但是我不想花时间直到我获得工具提示。

Any suggestions / help would be greatly appreciated! 任何建议/帮助将不胜感激!

Thank you! 谢谢!

Add this code: 添加此代码:

  .append("title")
  .text(function(d) { return d.info; })

to the code where circles are created, as it is displayed here: 此处显示了创建圆的代码:

在此处输入图片说明

... and node "Heart -> ICD-10 -> I00 that contains "info" will get its tooltip! ...,包含“信息”的节点“心脏-> ICD-10-> I00”将获得其工具提示!

Modified codepen is here . 修改过的codepen在这里

NOTE: This will add a tooltip for circles. 注意:这将为圈子添加一个工具提示。 If you want tooltips for radially placed labels too, than you need analogous code for labels. 如果您也希望使用工具提示来径向放置标签,则需要类似的代码标签。

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

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