If we want to add text to a node or a image

            // Create container for the images
const svgNodes = svg
.append('g')
.attr('class', 'nodes')
.selectAll('circle')
.data(d3.values(nodes))
.enter().append('g'); // Add image to the nodes
svgNodes
.append('image')
.attr('xlink:href', d => `/static/media/${d.name.toLowerCase()}.png`)
.attr('x', -25)
.attr('y', -25)
.attr('height', 50)
.attr('width', 50);

// Add text
svgNodes
.append("text")
.attr('text-anchor', 'middle')
.attr('dy', '.35em')
.attr('y', -30)
.attr('class', 'label')
.text(d => d.name);
.label {
pointer-events: none;
font: 8px sans-serif;
text-transform: uppercase;
color: black;
}

最新文章

  1. MySql类似Oracle的dual虚拟表
  2. 【krpano】krpano xml资源解密(破解)软件说明与下载
  3. Eclipse界面设置与常用技巧
  4. TCP协议下大数据传输IOCP乱序问题
  5. 团队冲刺the first day
  6. Remove Element,Remove Duplicates from Sorted Array,Remove Duplicates from Sorted Array II
  7. 论山寨手机与Android联姻 【8】 自己动手做XP手机
  8. MySQL的四种事务隔离级别
  9. 01-artDialog4.1.7常用整理
  10. WAMP下配置FCGID+ZendGuardLoader
  11. [Swift]LeetCode684. 冗余连接 | Redundant Connection
  12. Insertion Sort 与 Merge Sort的性能比较(Java)
  13. iOS多图上传
  14. Django路由分配及渲染
  15. 自己总结的C#编码规范--5.如何写好注释篇
  16. 服务发现:Zookeeper vs etcd vs Consul 参考自http://dockone.io/article/667
  17. nodepad++ 正则 替换
  18. 查准与召回(Precision & Recall)
  19. 怎么把<li>标签里的内容付给文本框
  20. [CENTOS7] 修改机器名:hostnamectl set-hostname host.domain

热门文章

  1. 【Uva 10618】Tango Tango Insurrection
  2. CSUOJ 1638 Continued Fraction
  3. 剑指offer_面试题6_重建二叉树(分解步骤,逐个击破)
  4. ZOJ 2562 HDU 4228 反素数
  5. javescript定时器demo
  6. POJ 2181 贪心
  7. c# List集合学习
  8. 微信小程序从零开始开发步骤(七)引入外部js 文件
  9. Summary Day32
  10. ios学习之block初探