Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. var level = svg.selectAll(".level")
  2. .data(data)
  3. .enter().append("g")
  4. .attr("transform", function(d, i) { return "translate(" + (i * 200) + "," + Math.pow(2,i)*matchY/2 + ")"; })
  5. .attr("class", "level");
  6.  
  7. var match = level.selectAll(".match")
  8. .data(function(d) { return d.matches ; })// <-- THIS
  9. .enter().append("g")
  10. .attr("transform", function(d, i, j) { return "translate(0," + (Math.pow(2,j)*i*matchY) + ")"; })
  11. .attr("class", "match");
  12.  
  13. var player = match.selectAll(".player")
  14. .data(function(d) { return d.seeds; })// <-- THIS
  15. .enter()
  16. .append("g")
  17. .attr("transform", function(d, i) { return "translate("+ (playerOffsetX) + "," + (i == 0 ? 0 : (rectY+rectGapY)) + ")"; })
  18. .attr("class", "player");
  19.  
  20. player.append("rect")
  21. .attr("width", rectX)
  22. .attr("height", rectY)
  23. .attr("class", "player");
  24.  
  25. player.append("text")
  26. .attr("x", 3)
  27. .attr("y", rectY / 2)
  28. .attr("dy", ".35em")
  29. .text(function(d) { return getPlayerByIdOrSomethingLikeThat(d); });// <-- THIS
  30.  
  31. [
  32. { source: {...}, target: {...} },
  33. { source: {...}, target: {...} },
  34. { source: {...}, target: {...} },
  35. ...
  36. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement