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.
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> | |
<script type="text/javascript" src="//code.jquery.com/jquery-1.10.2.min.js"></script> | |
<script type="text/javascript" src="http://s3.amazonaws.com/codecademy-content/courses/hour-of-code/js/alphabet.js"></script> | |
</head> | |
<body> | |
<canvas id="myCanvas"></canvas> | |
<script type="text/javascript" src="http://s3.amazonaws.com/codecademy-content/courses/hour-of-code/js/bubbles.js"></script> | |
<script type="text/javascript" src="main.js"></script> |
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
top50POCunhcr = [ | |
{ | |
"_id" : "Colombia", | |
"totrefs" : 4356236 | |
}, | |
{ | |
"_id" : "Afghanistan", | |
"totrefs" : 4023752 | |
}, | |
{ |
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
top50POCunhcr = [ | |
{ | |
"_id" : "Colombia", | |
"totrefs" : 4356236 | |
}, | |
{ | |
"_id" : "Afghanistan", | |
"totrefs" : 4023752 | |
}, | |
{ |
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
country | number_per_100_000_of_the_population | the_geom | cartodb_id | created_at | updated_at | |
---|---|---|---|---|---|---|
Japan | 1197 | 1 | 2013-09-27 14:54:45.614155 | 2013-09-27 14:54:45.862011 | ||
Sweden | 995 | 2 | 2013-09-27 14:54:45.614155 | 2013-09-27 14:54:45.862011 | ||
Italy | 908 | 3 | 2013-09-27 14:54:45.614155 | 2013-09-27 14:54:45.862011 | ||
France | 887 | 4 | 2013-09-27 14:54:45.614155 | 2013-09-27 14:54:45.862011 | ||
Norway | 813 | 6 | 2013-09-27 14:54:45.614155 | 2013-09-27 14:54:45.862011 | ||
Spain | 778 | 7 | 2013-09-27 14:54:45.614155 | 2013-09-27 14:54:45.862011 | ||
Denmark | 720 | 8 | 2013-09-27 14:54:45.614155 | 2013-09-27 14:54:45.862011 | ||
Finland | 710 | 9 | 2013-09-27 14:54:45.614155 | 2013-09-27 14:54:45.862011 | ||
United States | 666 | 10 | 2013-09-27 14:54:45.614155 | 2013-09-27 14:54:45.862011 |
[ Launch: Tributary inlet ] 9203884 by mpmckenna8
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> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script> | |
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"></script> | |
<script type="text/javascript" src="jquery.tipsy.js"></script> | |
<link href="tipsy.css" rel="stylesheet" type="text/css" /> | |
</head> | |
<body> | |
<div id="chart"></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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script src="http://d3js.org/topojson.v1.min.js"></script> | |
<style type="text/css"> | |
/* No style rules here yet */ | |
</style> | |
</head> |
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> | |
<title>Multiple concurrent popups w/ leaflet</title> | |
<script type="text/javascript" src="./maptimes4leaflet.json" ></script> | |
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script> | |
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" /> | |
<!--[if lte IE 8]><link rel="stylesheet" href="http://leaflet.cloudmade.com/dist/leaflet.ie.css" /><![endif]--> | |
<script type="text/javascript" src="http://maps.stamen.com/js/tile.stamen.js?v1.2.3"></script> |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.