[ Launch: sparc menu ] 6566151 by enjalot
-
-
Save enjalot/6566151 to your computer and use it in GitHub Desktop.
sparc menu
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":"sparc menu","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"menu.json":{"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,"thumbnail":"http://i.imgur.com/7crKH2S.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
//https://github.com/enjalot/sparcscraps | |
//using scrapy http://doc.scrapy.org/en/0.18/intro/tutorial.html | |
//to scrape http://sparcsf.org/medicine/flowers | |
var svg = d3.select("svg") | |
var data = tributary.menu; | |
data.sort(function(a,b) { | |
return b.thc - a.thc; | |
}) | |
var min = 0; | |
var max = d3.max(data, function(d) { return d.thc }); | |
var yscale = d3.scale.linear() | |
.domain([min, max]) | |
.range([400, 0]) | |
var xscale = d3.scale.ordinal() | |
.domain(data.map(function(d) { return d.name })) | |
.rangeBands([0, 400], 0.5); | |
var line = d3.svg.line() | |
.x(function(d,i) { | |
return xscale(i); | |
}) | |
.y(function(d,i) { | |
return yscale(d); | |
}) | |
var flowers = svg.selectAll("g.flower") | |
.data(data) | |
.enter() | |
.append("g").classed("flower", true) | |
flowers.append("circle") | |
.attr({ | |
cx: function(d,i) { return 50 + xscale(d.name) ; }, | |
cy: function(d,i) { return 50 + yscale(d.thc) }, | |
r: 5 | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment