[ Launch: Experiments ] 68fd18ed731acccb1be8 by ramnathv
-
-
Save ramnathv/68fd18ed731acccb1be8 to your computer and use it in GitHub Desktop.
Experiments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"description":"Experiments","endpoint":"","display":"div","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"inlet.coffee":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"pingpong","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"ajax-caching":true,"thumbnail":"http://i.imgur.com/ZOm95Ie.png"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
svg = d3.select("#display") | |
.append("svg") | |
.attr({width: 400, height: 200}) | |
circles = svg.selectAll('circle') | |
.data(data, (d) -> d) | |
circles.enter() | |
.append('circle') | |
.attr('cx', (d) -> d*20 +50) | |
.attr('cy', 100) | |
.attr('r', (d) -> d) | |
### | |
update = () -> | |
circles = svg.selectAll("circle") | |
.data([3, 4, 6, 9, 12], (d) -> d) | |
circles.enter() | |
.append('circle') | |
.attr('cx', (d) -> d*20 +50) | |
.attr('cy', 100) | |
.attr('r', (d) -> d) | |
circles.exit().remove() | |
btn = d3.select("#display") | |
.append("button") | |
.text("Update") | |
.on("click", update) | |
### | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment