Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Online D3JS Editor

<!-- source is https://bl.ocks.org/mbostock/4060366 -->
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <style>

    </style>
</head>
<body>
    <svg width="960" height="500"></svg>
    <script src="https://d3js.org/d3.v4.min.js"></script>
    <script>

var svg = d3.select("svg");
var width = +svg.attr("width");
var height = +svg.attr("height");

var data; // a global
d3.json("https://tipiciudadano.es/api/v1/dicts", function(error, json) {
  if (error) return console.warn(error);
  data = json;
  visualizeit();
});

function visualizeit(){
    var node = svg.selectAll(".node")
    .data(data["dicts"]["tipi"])
    .enter().append("g")
      .attr("class", "node")
      .attr("transform", function(d,i) { return "translate(" + Math.sin(i/10)*100 + 200 + "," + Math.sin(i/10)*100 + 200 + ")"; });

  node.append("circle")
      .attr("id", function(d) { return d; })
      .attr("r", 10)
      .style("fill", "blue");
};

    </script>
</body>
</html>

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.