Answers for "D3.js script"

1

d3 script

<script src="https://d3js.org/d3.v6.min.js"></script>
Posted by: Guest on August-15-2020
3

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");
Posted by: Guest on March-15-2021

Browse Popular Code Answers by Language