[ Launch: Tributary inlet ] 5195813 by ingenioustechie
-
-
Save muke5hy/5195813 to your computer and use it in GitHub Desktop.
Tributary inlet
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":"Tributary inlet","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}},"fullscreen":false,"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} |
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
| //Width and height | |
| var w = 500; | |
| var h = 100; | |
| var dataset = [ | |
| [5, 33], [480, 90], [250, 50], [100, 33], [330, 95], | |
| [410, 12], [475, 44], [25, 67], [85, 21], [220, 88] | |
| ]; | |
| //Create SVG element | |
| var svg = d3.select("svg") | |
| .attr("width", w) | |
| .attr("height", h); | |
| svg.selectAll("circle") | |
| .data(dataset) | |
| .enter() | |
| .append("circle") | |
| .attr("cx", function(d) { | |
| return d[0]; | |
| }) | |
| .attr("cy", function(d) { | |
| return d[1]; | |
| }) | |
| .attr("r", function(d) { | |
| return Math.sqrt(h - d[1]); | |
| }); | |
| svg.selectAll("text") | |
| .data(dataset) | |
| .enter() | |
| .append("text") | |
| .text(function(d) { | |
| return d[0] + "," + d[1]; | |
| }) | |
| .attr("x", function(d) { | |
| return d[0]; | |
| }) | |
| .attr("y", function(d) { | |
| return d[1]; | |
| }) | |
| .attr("font-family", "sans-serif") | |
| .attr("font-size", "0px") | |
| .attr("fill", "red"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment