ユーザーがデータの視覚化を進めているときに、物語のテキストの段落が Web ページの横にスクロールすることについて疑問に思っています。この一環として、そのテキストの特定の部分文字列に機能を追加するとよいでしょう。たとえば、関連するポップアップ イメージを開くことができます。しかし、マウスオーバーなどの演算子に応答できるように、テキスト要素の部分文字列をオブジェクト化するように D3 に指示する方法は思いつきません。
これが例です。プラスjfiddle
<!DOCTYPE html>
<meta charset="utf-8">
<html>
<head>
<title>Substring click</title>
<script type="text/javascript" src="scripts/d3.v3.js"></script>
</head>
<body>
<!-- example line -->
<p>The most interesting <A href="https://en.wikipedia.org/wiki/The_Most_Interesting_Man_in_the_World">man</A> in the world</p>
<div/>
<script type="text/javascript">
var link = "https://en.wikipedia.org/wiki/The_Most_Interesting_Man_in_the_World";
d3.select("body").selectAll("div").append("text").text("The most interesting man in the world");
// is there any way to make 'man' link to 'wiki_link' or perform some other operation?
</script>
</body>
</html>