简体   繁体   中英

Text not rendered in d3 visualization

我在这里查看可视化代码http://bl.ocks.org/mbostock/4062045 ,我很想知道为什么json文件中的名称没有与节点一起呈现,即使代码包括:

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

The SVG <title> element is not displayed on screen. It is used as the tooltip text by browsers (and is also used by screen readers) in the same way as a title attribute in HTML.

Ie, the SVG code

<svg>
   <image xlink:href="image.png">
      <title>My PNG</title>
   </image>
</svg>

Is equivalent to the HTML code

<div>
   <img src="image.png" title="My PNG" />
</div>

Attribute title is supposed to be displayed as a tooltip (if you hover over a node), and it is really correctly displayed, check it out. (I know... it's not logical, but such is standard)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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