Skip to content

Instantly share code, notes, and snippets.

@Andrew-Reid
Andrew-Reid / Americas.json
Last active January 9, 2018 05:15
National Official Languages in the Americas
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Andrew-Reid
Andrew-Reid / d3Pattern.js
Last active January 9, 2018 00:41
Pattern Module Demo 2
d3.patternGetNextClass = function(svg) {
function increment() {
var selection = svg.select("#d3Pattern-"+i)
if (!selection.empty()) {
return false;
}
return true;
}
@Andrew-Reid
Andrew-Reid / d3Pattern.js
Last active January 9, 2018 00:38
Pattern Module Demo
d3.patternGetNextClass = function(svg) {
function increment() {
var selection = svg.select("#d3Pattern-"+i)
if (!selection.empty()) {
return false;
}
return true;
}
@Andrew-Reid
Andrew-Reid / index.html
Last active January 8, 2018 06:42
World Map and Pattern Transitions 2
<!DOCTYPE html>
<meta charset="utf-8">
<svg width="960" height="960"></svg>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://unpkg.com/topojson-client@3"></script>
<script>
var svg = d3.select("svg"),
width = +svg.attr("width"),
height = +svg.attr("height");
@Andrew-Reid
Andrew-Reid / index.html
Last active January 8, 2018 06:16
World Map and Pattern Transitions
<!DOCTYPE html>
<meta charset="utf-8">
<svg width="960" height="960"></svg>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://unpkg.com/topojson-client@3"></script>
<script>
var svg = d3.select("svg"),
width = +svg.attr("width"),
height = +svg.attr("height");
@Andrew-Reid
Andrew-Reid / data.json
Last active April 7, 2020 04:42
Grouped Force Layout
{
"nodes": [
{"id": "Myriel", "group": 1},
{"id": "Napoleon", "group": 1},
{"id": "Mlle.Baptistine", "group": 1},
{"id": "Mme.Magloire", "group": 1},
{"id": "CountessdeLo", "group": 1},
{"id": "Geborand", "group": 1},
{"id": "Champtercier", "group": 1},
{"id": "Cravatte", "group": 1},
@Andrew-Reid
Andrew-Reid / index.html
Last active November 29, 2017 03:45
Convex Hull with Centered Text
<!DOCTYPE html>
<meta charset="utf-8">
<title>Convex Hull</title>
<style>
rect {
fill: none;
pointer-events: all;
}
@Andrew-Reid
Andrew-Reid / d3orthoPath.js
Last active November 28, 2017 18:57
Orthographic Pie Chart
d3.orthoLabel = function() {
var falseSVG = d3.select(document.createElementNS(d3.namespaces.svg, 'svg'));
// projection variables:
var centroid = [0,0];
var scale = 1000;
var projection = d3.geoAzimuthalEquidistant()
@Andrew-Reid
Andrew-Reid / index.html
Last active November 27, 2017 02:40
Planetary Rings
<!DOCTYPE html>
<meta charset="utf-8">
<style>
path {
fill: none;
stroke-linejoin: round;
}
.sphere,
@Andrew-Reid
Andrew-Reid / index.html
Last active November 28, 2017 04:37
Orthographic Labels
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
background: #fcfcfa;
}
</style>
<body>