JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://d3js.org/d3.v2.js"></script>
<div id="chart"></div>
CSS
text { fill: green; }
JavaScript
$(function(){
var g = d3.select("#chart")
.append("svg:svg")
.append("svg:g");
g.selectAll('text')
.data(['hello','world'])
.enter()
.append('svg:text')
.text(function(d){ return d;})
.attr("y", function(d,i){ return 15 * (i+1) + 10; })
.attr("x", 0)
.on("click", function(d,i){
var width = ~~(this.getBBox().width);
// Just for fun.
d3.select(this)
.text(d+" :: "+width)
.attr("x", Math.random() * 200);
});
});