【问题标题】:Add image inside a circle D3在圆圈内添加图像 D3
【发布时间】:2013-12-03 21:51:56
【问题描述】:

我正在尝试找到一种方法,让 D3 中的一个圆圈内有一个图像,并在它旁边有一个文本。

如果有什么不同,我会使用力有向图。

到目前为止,我只能找到部分解决方案(只有图像,只有文本,只有圆圈),但没有找到所有解决方案。

有什么想法吗?

【问题讨论】:

  • This question 可能有助于将图像添加到圆圈中,旁边的文本非常标准,您只需将它们链接在一起即可。
  • This question 也可能有帮助。

标签: d3.js label force-layout


【解决方案1】:

这个例子有帮助吗? http://bl.ocks.org/mbostock/950642

相关代码在这里:

node.append("image")
      .attr("xlink:href", "https://github.com/favicon.ico")
      .attr("x", -8)
      .attr("y", -8)
      .attr("width", 16)
      .attr("height", 16);

【讨论】:

  • 有人在最新版本的 D3 中有这方面的例子吗?
猜你喜欢
  • 2019-01-02
  • 1970-01-01
  • 2022-08-02
  • 1970-01-01
  • 2012-11-16
  • 1970-01-01
  • 2015-12-18
  • 1970-01-01
  • 2013-10-12
相关资源
最近更新 更多