Skip to content

Instantly share code, notes, and snippets.

💭
💡

Jason Davies jasondavies

💭
💡
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am jasondavies on github.
  • I am jasondavies (https://keybase.io/jasondavies) on keybase.
  • I have a public key whose fingerprint is 341D 39FF 0F5D 07C5 3BE7 9A5D BAE3 9383 18C9 0D61

To claim this, I am signing this object:

@jasondavies
jasondavies / README.md
Last active Aug 29, 2015 — forked from mbostock/.block
Wrapped d3.geo.tile
View README.md
@jasondavies
jasondavies / README.md
Last active Jun 15, 2016 — forked from mbostock/.block
Rotated hexbin
View README.md

A version of Mike Bostock’s hexbin example, modified to use hexagons rotated by 90°. Aside from rotating the hexagon primitives, the only other change is to swap the meaning of x and y, for all inputs and outputs of the plugin.

@jasondavies
jasondavies / .gitignore
Last active Aug 29, 2015 — forked from mbostock/.block
Quantised States
View .gitignore
.DS_Store
build
node_modules
@jasondavies
jasondavies / index.html
Created Jun 12, 2014
Cocircular Voronoi
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.voronoi {
fill-opacity: .5;
}
.delaunay {
@jasondavies
jasondavies / index.html
Last active Mar 22, 2019
RequireJS and D3
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<style> body { font-family: sans-serif; } </style>
<body>
<script src="require.js"></script>
<script>
require.config({
paths: {
d3: "http://d3js.org/d3.v3.min"
}
@jasondavies
jasondavies / csv-benchmark
Last active Aug 29, 2015
d3.csv benchmark
View csv-benchmark
#!/usr/bin/env node
var d3 = require("./");
var csv = ["foo", "bar", "baz", "foobarbaz", "BLAHBLAH"].join(",") + "\n" +
d3.csv.formatRows(d3.range(10000).map(function() {
return d3.range(5).map(Math.random);
}));
benchmark("Slow", function() { parseSlow(csv); });
@jasondavies
jasondavies / README.md
Last active Oct 29, 2018 — forked from monsieurBelbo/caba.json
Areas of Clipped Voronoi Regions
View README.md

A demonstration of how to calculate the areas of Voronoi regions clipped by geographic features using D3.

[D3’s implementation](Sutherland–Hodgman algorithm) of the Sutherland–Hodgman algorithm only works for convex clip polygons, but we exploit the fact that Voronoi regions are guaranteed to be convex, and use each Voronoi region as a clip polygon, with the projected geographic boundary as a subject polygon.

In response to a question by Gonzalo Bellver.

@jasondavies
jasondavies / README.md
Last active Aug 29, 2015 — forked from mbostock/README.md
Voronoi Clip Bug
View README.md

There seems to be a bug in voronoi clipping; setting .clipExtent([[-1, -10], [width + 1, height + 1]]) works around the issue for these particular points.

View .gitignore
build
node_modules
You can’t perform that action at this time.