D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
RomyRatolojanahary
Full window
Github gist
fresh block tp6
Built with
blockbuilder.org
<!DOCTYPE html> <head> <meta charset="utf-8"> <script src="https://d3js.org/d3.v4.min.js"></script> <style> body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; } </style> </head> <body> <script> // Feel free to change or delete any of the code you see in this editor! var svg = d3.select("body").append("svg") .attr("width", 960) .attr("height", 500) svg.append("text") //.text("Edit the code below to change me!") .attr("y", 200) .attr("x", 120) .style("font-size", 36) .style("font-family", "monospace") var a = ["act1","act2","act3","act4"]; var myMap = new Map(); myMap.set([a[0],a[1]], 1); myMap.set([a[0],a[1]], 1); myMap.set([a[0],a[2]], 1); myMap.set([a[0],a[2]], 1); myMap.set([a[1],a[3]], 1); parti = new Set(); parti.add({act: "act1", parti: 1, couleur: 1}); parti.add({act: "act2", parti: 1, couleur: 1}); parti.add({act: "act3", parti: 2, couleur: 2}); parti.add({act: "act3", parti: 2, couleur: 2}); console.log("l "+parti.size); console.log({act: "act3", parti: 2, couleur: 2} == {act: "act3", parti: 2, couleur: 2}); parti.forEach(function(value) { console.log(value); }); p = new Set(); p.add(2); p.add("A"); p.add(2); p.add("B"); var nodesArray = Array.from(p).map(function(e1,e2){return {v: e1}}); console.log("nodes "+nodesArray[0].v); nodesArray[0].id = "A"; console.log("nodes "+nodesArray[0].id); parti = []; parti.push({act: "act1", parti: 1, couleur: 1}); parti.push({act: "act2", parti: 1, couleur: 1}); parti.push({act: "act3", parti: 2, couleur: 2}); parti.push({act: "act3", parti: 2, couleur: 2}); console.log(parti.length); console.log(parti[0].couleur); </script> </body>
https://d3js.org/d3.v4.min.js