d3 javascript code example
Example 1: d3
<script src="https://d3js.org/d3.v6.js"></script>
Example 2: d3.js
<script src="https://d3js.org/d3.v6.min.js"></script>
Example 3: include d3
<script src="https://d3js.org/d3.v5.min.js"></script>
Example 4: d3 js
// conventional method of selecting all paragraphs
//and changing their color property to blue
var paragraphs = document.getElementsByTagName("p");
for (var i = 0; i < paragraphs.length; i++) {
var paragraph = paragraphs.item(i);
paragraph.style.setProperty("color", "blue", null);
}
//D3 way of doing the same
d3.selectAll("p").style("color", "blue");