[ Launch: replaceTransition ] f4ef0a0f5243eb1efcbd by radiodario
[ Launch: endTransition ] 4a75c47b7a5a87eade49 by radiodario
[ Launch: startTransition ] 3736f1631ff1fe10e9e9 by radiodario
[ Launch: startTransition ] 8e3b067bc3fcfa478861 by radiodario
[ Launch: test ] 4653053 by enjalot
[ Launch: test ] 4652017 by enjalot
[ Launch: test ] 4582399 by enjalot
-
-
Save radiodario/f4ef0a0f5243eb1efcbd to your computer and use it in GitHub Desktop.
updateTransition
This file contains hidden or 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":"updateTransition","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"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}},"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"tab":"edit","display_percent":0.7,"thumbnail":"http://i.imgur.com/GJbvjP5.gif","fullscreen":false,"ajax-caching":true,"inline-console":true} |
This file contains hidden or 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
| var svg = d3.select("svg"); | |
| var height = tributary.sh; | |
| var width = tributary.sw; | |
| var data = []; | |
| function refreshData() { | |
| for (var i = 0; i < 25; i++) { | |
| data.push(2 + 10*Math.random()) | |
| } | |
| } | |
| refreshData(); | |
| var xs = d3.scale.linear() | |
| .domain([0, data.length-1]) | |
| .range([0, width]); | |
| var ys = d3.scale.linear() | |
| .domain([0, 12]) | |
| .range([height, 0]); | |
| var line = d3.svg.area() | |
| .x(function(d, i) { | |
| return xs(i); | |
| }) | |
| .y0(height) | |
| .y1(function(d, i) { | |
| return ys(d); | |
| }); | |
| var paths = svg.selectAll('path') | |
| .data([data]); | |
| paths.enter() | |
| .append('path') | |
| .attr('stroke', 'lightblue') | |
| .attr('fill', 'steelblue') | |
| .attr('d', line); | |
| function tick() { | |
| data.push(2+10*Math.random()); | |
| paths | |
| .attr('d', line) | |
| .attr('transform', null) | |
| .transition() | |
| .duration(1000) | |
| .ease("linear") | |
| .attr('transform', 'translate(' + xs(-1) + ')') | |
| .each('end', tick); | |
| data.shift(); | |
| } | |
| tick(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment