D3.js donut chart
by Gerald Fullam
HTML
<script src="http://d3js.org/d3.v3.min.js"></script>
<div id="example3">
<p>Already existing paragraph 1</p>
<p>Already existing paragraph 3</p>
</div>
CSS
p {
font-size: 20px;
color: orangered;
}
JavaScript
pdata = [10, 12, 6, 8, 15];
selectDIV = d3.select("#example3");
selectDIV.selectAll("p")
.data(pdata, function (d, i) { console.log(d,i); return d; })
.text(function(d) {
return "Already existing paragraph " + d;
})
.enter()
.append("p")
.text(function(d) {
return "paragraph: " + d;
});