[ Launch: Tributary inlet ] 5734054 by iKlsR
-
-
Save iKlsR/5734054 to your computer and use it in GitHub Desktop.
test_001
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":"test_001","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
| // hello d3 .. | |
| var canvas = d3.select("svg"); | |
| var data_array = [ | |
| 12, 23, 10, 19, 20, 12, 13, 9, 11, 14, 18, 3, 7, 15 | |
| ]; | |
| var width = 640; | |
| var height = 560; | |
| var scale = d3.scale.linear() | |
| .domain([0, d3.max(data_array)]) | |
| .range([0, width]); | |
| var color = d3.scale.linear() | |
| .domain([0, d3.max(data_array)]) | |
| .range(["black", "yellow"]); | |
| canvas.attr("width", width) | |
| .attr("height", height); | |
| var bars = canvas.selectAll("rect").data(data_array).enter(); | |
| bars.append("rect") | |
| .attr("width", function (s) { | |
| return scale(s); | |
| }) | |
| .attr("height", 40) | |
| .attr("fill", function (c) { | |
| return color(c); | |
| }) | |
| .attr("y", function (d, i) { | |
| return i * 40; | |
| }); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ach..