Skip to content

Instantly share code, notes, and snippets.

View jasondavies's full-sized avatar
💭
💡

Jason Davies jasondavies

💭
💡
View GitHub Profile
@jasondavies
jasondavies / README.md
Created October 13, 2011 11:49
Zoom/Pan Map Example

Demonstrates using d3.behavior.zoom with a geographic projection. Based on an example by Iain Dillingham.

@jasondavies
jasondavies / README.md
Created September 26, 2012 15:59 — forked from jasondavies/README.md
Adaptive Resampling

D3 2.11’s projections will adaptively resample to reduce local distortion of lines. Move the mouse to change the precision, and drag to change the aspect.

Update: Mike has made some awesome improvements!

@jasondavies
jasondavies / .block
Last active February 4, 2024 12:38 — forked from mbostock/.block
Parallel Coordinates
license: gpl-3.0
@jasondavies
jasondavies / README.md
Created December 2, 2012 11:54 — forked from mbostock/.block
World Map

Based on Mike Bostock’s [World Map][0], modified to automatically colour countries such that no adjacent countries share the same colour.

This is done by extracting the topology via [TopoJSON][1] and greedily picking colours until the constraint is fulfilled.

See also: [Graph coloring][2] on Wikipedia.

Update: Greedily colouring is now performed in a single line, thanks to Mike Bostock!

@jasondavies
jasondavies / .gitignore
Last active October 27, 2019 19:48 — forked from mbostock/.block
Ocean
build
node_modules
@jasondavies
jasondavies / README.md
Created November 16, 2012 23:20 — forked from mbostock/.block
World Boundaries TopoJSON
@jasondavies
jasondavies / README.md
Last active June 13, 2019 23:16 — forked from mbostock/.block
Vertical Bullet Charts
@jasondavies
jasondavies / index.html
Created January 3, 2012 12:46 — forked from gka/index.html
alpha-shapes aka concave hulls in d3
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Alpha-Shapes</title>
<script src="http://mbostock.github.com/d3/d3.min.js"></script>
<script src="http://mbostock.github.com/d3/d3.geom.min.js"></script>
<style type="text/css">
path {
@jasondavies
jasondavies / README.md
Last active October 29, 2018 11:08 — forked from monsieurBelbo/caba.json
Areas of Clipped Voronoi Regions

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 / index.html
Created April 4, 2012 10:02 — forked from robdodson/index.html
D3.js Population Bar Chart
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Population Projection</title>
<link rel="stylesheet" href="main.css">
</head>