daily pastebin goal
7%
SHARE
TWEET

Untitled

a guest Oct 18th, 2018 78 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. var games = data;
  2. console.log(games);
  3.  
  4. var svgContainer = d3.select("main").append("svg")
  5.     .attr("id", "canvas")
  6.     .attr("width", 1000)
  7.     .attr("height", 1000);
  8.  
  9. var circles = svgContainer.selectAll("circle")
  10.     .data(games)
  11.     .enter()
  12.     .append("circle")
  13. var xCordinate = 0
  14. var xCordinate2 = 0
  15. var radius = 20
  16. var circleAttributes = circles
  17.     .attr("cx", function(d){
  18.         xCordinate = xCordinate + 42
  19.         return xCordinate;
  20.     })
  21.     .attr("cy", 100)
  22.     .attr("r", radius)
  23.     .style("fill", function(d){
  24.         var returnColor;
  25.         if (d.result === 'Loss') { returnColor = "red";
  26.         } else if (d.result === 'Win') { returnColor = "green";}
  27.         return returnColor;
  28.     })
  29.     .on("mouseover", function(d){
  30.         d3.select(this)
  31.             .style("fill", "blue")
  32.             .attr("r", radius * 10)
  33.             .attr("cy", 500)
  34.             .attr("cx", 500)
  35.     })
  36.     .on("mouseout", function(d){
  37.         d3.select(this)
  38.             .style("fill", function(d){
  39.                 var returnColor;
  40.                 if (d.result === 'Loss') { returnColor = "red";
  41.                 } else if (d.result === 'Win') { returnColor = "green";}
  42.                 return returnColor;
  43.             })
  44.             .attr("r", radius)
  45.             .attr("cy", 900)
  46.             .attr("cx", function(d){
  47.                 xCordinate2 = xCordinate2 + 42
  48.                 return xCordinate2;
  49.             })
  50.     });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top