This example demonstrates D3’s support for azimuthal projections and clipping to great circles! Release 2.3.0 also includes support for Gnomonic, Bonne, Werner and Sinusoidal projections, as well as for rendering great arcs.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"> | |
<title>Force-Directed Graph</title> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.25.0"></script> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js?1.25.0"></script> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?1.25.0"></script> | |
<style type="text/css"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var chart = d3.select("#chart").append("svg") | |
.attr("width", w) | |
.attr("height", h) | |
.append("g") | |
.attr("id", "plotarea") | |
.attr("transform", "translate(" + margin.left + "," + margin.top + ")") | |
// DRAW DATALINES | |
path = chart.selectAll("path.dataline") | |
.data(data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var n = 9, // number of layers | |
m = 1, // number of samples per layer | |
sourceData = stream_layers(n, m, 0.1); | |
/* | |
sourceData = [ | |
[{x:0,y:9800}], | |
[{x:0,y:128}], | |
[{x:0,y:60}], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<link type="text/css" rel="stylesheet" href="rickshaw.min.css"> | |
</head> | |
<body> | |
<title>The Wealth & Health of Nations</title> | |
<style> | |
@import url(bost.ocks.org/mike/style.css?20120427); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<link type="text/css" rel="stylesheet" href="rickshaw.min.css"> | |
</head> | |
<body> | |
<div id="chartcontainer-31992208"> | |
<div id="chartyaxis-31992208"></div> | |
<div id="chart-31992208"></div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
svg { | |
background: #eee; | |
width: 960px; | |
height: 540px; | |
} | |
#countries path { | |
stroke: steelblue; | |
stroke-width: 1px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){d3.geo = {}; | |
var d3_geo_radians = Math.PI / 180; | |
// TODO clip input coordinates on opposite hemisphere | |
d3.geo.azimuthal = function() { | |
var mode = "orthographic", // or stereographic, gnomonic, equidistant or equalarea | |
origin, | |
scale = 200, | |
translate = [480, 250], | |
x0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
svg { | |
width: 1280px; | |
height: 800px; | |
pointer-events: all; | |
} | |
#countries path { | |
stroke: steelblue; | |
stroke-width: 1px; | |
} |