在d3可视化中未呈现的文本 [英] Text not rendered in d3 visualization

查看:144
本文介绍了在d3可视化中未呈现的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在查看可视化代码 http://bl.ocks.org/mbostock/ 4062045 ,而且我很想知道为什么是来自json文件的名称,而不是与节点一起呈现,即使代码包括:

I'm reviewing the code of the visualization here http://bl.ocks.org/mbostock/4062045, and I'm curious to know why is name from the json file not rendered together with the nodes even though the code included:

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


推荐答案

SVG < title> ; 元素不显示在屏幕上。它被浏览器用作工具提示文本(也被屏幕阅读器使用),与HTML中的title属性相同。

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.

即SVG代码

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

等同于HTML代码

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

这篇关于在d3可视化中未呈现的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆