Skip to content

Instantly share code, notes, and snippets.

@poezn poezn/_.md

Created Oct 16, 2012
Embed
What would you like to do?
just another inlet to tributary
{"endpoint":"","display":"svg","public":true,"require":[],"tab":"edit","display_percent":0.7,"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}
var svg = d3.select("svg");
var js = tb['us1861-01_5'];
var cscale = d3.scale.category10();
var defs = svg.append('defs');
var pattern = defs.append('pattern')
.attr({
id: 'dotmatrix',
patternUnits: "userSpaceOnUse",
x: 0,
y: 0,
width: 1000,
height: 1183
});
pattern.selectAll('rect')
.data(d3.range(0, 99))
.enter()
.append('rect')
.attr({
// r: 2.34,
// cx: 3,
// cy: 3,
width: 1000,
y: function(d, i) { return d*7 },
height: 4,
fill: 'white',
transform: 'rotate(' + 10 + ')'
})
;
var mask = defs.append('mask')
.attr({
id: 'mask',
maskUnits: "objectBoundingBox",
maskContentUnits: "ObjectBoundingBox"
});
mask.append('rect')
.attr({
x: 0,
y: 0,
height: 1000,
width: 1000,
fill: 'black'
});
mask.append('rect')
.attr({
x: 0,
y: 0,
height: 1000,
width: 1000,
fill: 'url(#dotmatrix)'
})
var g = svg.append('g')
.attr({
mask: 'url(#mask)',
width: 1141,
height: 1242
});
var xy = d3.geo.albers();
var path = d3.geo.path().projection(xy);
xy.translate([126, 76]).scale(262);
g.selectAll('path')
.data(js.features)
.enter().append("path")
.attr({
'd': path,
'transform': 'translate(40, 60) scale(4)',
'fill': function (d, i) {
return cscale(d.properties.CATEGORY);
}
});
svg.selectAll('path.nohighlight')
.data(js.features.slice(10,15))
.enter().append("path")
.attr({
'd': path,
'class': 'nohighlight',
'transform': 'translate(40, 60) scale(4)',
'fill': function (d, i) {
return cscale(d.properties.CATEGORY);
}
});
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.