Skip to content

Instantly share code, notes, and snippets.

@poezn
Created May 21, 2014 04:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save poezn/f46dc27d77c4c19bfc0c to your computer and use it in GitHub Desktop.
Save poezn/f46dc27d77c4c19bfc0c to your computer and use it in GitHub Desktop.
Recharge projects
{"description":"Recharge projects","endpoint":"","display":"svg","public":true,"require":[{"name":"Topojson","url":"http://d3js.org/topojson.v1.min.js"}],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"data.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"styles.css":{"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,"ajax-caching":true,"thumbnail":"http://i.imgur.com/alFdCPr.png"}
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
var topo = tb.data;
var path = d3.geo.path()
.projection(null);
var fundingSchemes = [
"Prop 84", "Prop 1E", "Prop 50", "Prop 13"
];
var gFs = g.selectAll("g.funding-scheme")
.data(fundingSchemes);
gFs.enter().append("g")
.attr({
"class": "funding-scheme"
});
var map = gFs.append("g").attr({
"transform": function(d, i) {
return "translate(" + (i*250) + ", 0) scale(0.7)"
}
});
map.append("path")
.datum(topojson.feature(topo, topo.objects.ca))
.attr({
"d": path,
"class": "outline"
});
map.append("text")
.attr("transform", "translate(220, 30)")
.text(function(d, i) { return d; } )
map.selectAll("path.basin")
.data(topojson.feature(topo, topo.objects.basins).features)
.enter().append("path")
.attr({
"d": path,
"class": function(d, i) {
var prio =
d.properties.basin_pr19 == "High" ? "high" :
(d.properties.basin_pr19 == "Medium" ? "medium" :
(d.properties.basin_pr19 == "Low" ? "low" : "very_low" )
)
return "basin " + prio
}
});
map.selectAll("circle.recharge")
.data(function(d, i) {
return _.filter(topojson.feature(topo, topo.objects.recharge).features, function(f, i) {
return f.properties.funding_sc == d
})
})
.enter().append("circle")
.attr({
"class": "recharge",
"cx": function(d, i) { return d.geometry.coordinates[0] },
"cy": function(d, i) { return d.geometry.coordinates[1] },
"r": 5
});
var cmi = tributary.getCodeEditor("inlet.js")
cmi.tabSize = 4;
var cms = tributary.getCodeEditor("styles.css")
cms.tabSize = 4;
#display {
background-color: #FFF;
}
.outline {
fill: none;
stroke: #000;
}
.basin.high {
fill: #b7dea9;
}
.basin.medium {
fill: #ebe59d;
}
.basin.low, .basin.very_low {
fill: #d0c5b8;
}
.recharge {
fill: #a8002f;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment