Skip to content

Instantly share code, notes, and snippets.

@poezn
Created October 16, 2012 02:14
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/3896912 to your computer and use it in GitHub Desktop.
Save poezn/3896912 to your computer and use it in GitHub Desktop.
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: 6,
height: 6
})
.append('circle')
.attr({
r: 2.34,
cx: 3,
cy: 3,
fill: 'white'
})
;
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);
}
});
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment