Skip to content

Instantly share code, notes, and snippets.

View jasondavies's full-sized avatar
💭
💡

Jason Davies jasondavies

💭
💡
View GitHub Profile
@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 / index.html
Created October 27, 2011 14:45
Counties of the United Kingdom
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<link type="text/css" rel="stylesheet" href="style.css"/>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.csv.js"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js"></script>
<style type="text/css">
@jasondavies
jasondavies / index.html
Created September 10, 2012 08:33
longscroll.js
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.longscroll {
overflow-y: auto;
width: 480px;
height: 500px;
float: left;
}
.longscroll .row {
@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 / LICENSE
Last active October 6, 2018 08:54
Zoom by Rectangle
Copyright 2012 Jason Davies https://www.jasondavies.com
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
@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>
@jasondavies
jasondavies / README.md
Created December 1, 2012 18:19 — forked from mbostock/.block
World Countries
@jasondavies
jasondavies / README.md
Created December 2, 2012 10:04 — forked from jasondavies/README.md
Australia↔Austria

Trying to figure out if there’s a problem with Australia↔Austria spherical linear interpolation in the [World Countries][1] example, as hinted at by Hadley Wickham.

Note how the geodesic is always a straight line under the orthographic projection, since it is always going through the centre. (Except for the initial view centred at (0°, 0°), which is not on the geodesic). This is true for all azimuthal projections.

@jasondavies
jasondavies / README.md
Created September 14, 2012 12:49 — forked from mbostock/.block
Antemeridian Cutting

D3 2.11’s d3.geo.path will automatically cut features for any aspect. Try dragging to rotate the world and see a new aspect.

@jasondavies
jasondavies / README.md
Last active June 15, 2016 22:26 — forked from mbostock/.block
Rotated hexbin

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.