[ Launch: Alphabet ] 40af25f3f31bb78a1fb1017a52128485 by jkeohan
-
-
Save jkeohan/40af25f3f31bb78a1fb1017a52128485 to your computer and use it in GitHub Desktop.
Alphabet
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":"Alphabet","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},"styles.css":{"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/A94VkUA.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
var alphabet = "abcdefghijklmnopqrstuvwxyz".split(""); | |
var width = 960, | |
height = 500; | |
var svg = d3.select("svg") | |
.attr("width", width) | |
.attr("height", height) | |
//.append("g") | |
// .attr("transform", "translate(32," + (height / 2) + ")"); | |
// DATA JOIN | |
// Join new data with old elements, if any. | |
var text = svg.selectAll("text") | |
.data(data); | |
// UPDATE | |
// Update old elements as needed. | |
// text.attr("class", "update"); | |
// ENTER | |
// Create new elements as needed. | |
text.enter().append("text") | |
//.attr("class", "enter") | |
.attr("x", function(d, i) { return i * 32; }) | |
.attr("dy", ".35em") | |
// ENTER + UPDATE | |
// Appending to the enter selection expands the update selection to include | |
// entering elements; so, operations on the update selection after appending to | |
// the enter selection will apply to both entering and updating nodes. | |
text.text(function(d) { return d; }); | |
// EXIT | |
// Remove old elements as needed. | |
//text.exit().remove(); | |
// The initial display. |
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
text { | |
font: bold 48px monospace; | |
} | |
.enter { | |
fill: green; | |
} | |
.update { | |
fill: #333; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment