A demo of TopoJSON on a U.S. counties shapefile from the U.S. census bureau. The same TopoJSON file can also be used to show states and counties.
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Foo</title> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" /> | |
<style type='text/css'> | |
body { | |
font-family: 'Helvetica'; | |
letter-spacing:-5px; |
This example demonstrates the use of a Voronoi tessellation as a simple heuristic for labeling scatterplots. The area of the Voronoi cell associated with each point in the scatterplot is used to determine which points are labeled: points with large cells likely have enough room to accommodate labels. Then, the vector between the point and the associated cell’s centroid (shown in orange) is used to choose between four label orientations: top, right, bottom and left.
Part of a series of examples. See:
The gnomonic projection is available as d3.geo.gnomonic. See also the interactive version.
This is copied from mbostock's example
It shows what happens when you start a transition and select shit that would also include shit but it's not inside the async function where it's getting created so it never gets selected and transitioned.
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!
#Generate cities data
wget http://download.geonames.org/export/dump/cities15000.zip
unzip cities15000.zip
node geonames.js cities15000.txt
The result is json array of cities in the following format:
{
_id:
.DS_Store | |
node_modules | |
us-judicial-districts.zip | |
build |
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!