Last active
August 11, 2016 23:10
Revisions
-
mbostock renamed this gist
Feb 8, 2016 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
mbostock revised this gist
Feb 8, 2016 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ license: gpl-3.0 -
mbostock revised this gist
Oct 21, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,10 @@ <!DOCTYPE html> <html> <head> <script type="text/javascript" src="http://polymaps.org/polymaps.min.js"></script> <style type="text/css"> @import url("http://polymaps.org/style.css"); </style> </head> -
mbostock revised this gist
Oct 12, 2012 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
LoadingSorry, something went wrong. Reload?Sorry, we cannot display this file.Sorry, this file is invalid so it cannot be displayed. -
mbostock revised this gist
Sep 26, 2010 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -52,7 +52,7 @@ function rainbow(tile) { var rect = tile.element = po.svg("rect"), i = hilbert(tile.column, tile.row, tile.zoom), j = ~~(i * 360 / Math.pow(4, tile.zoom)), k = 1 << tile.zoom; if (tile.column < 0 || tile.column >= k) return; rect.setAttribute("width", size.x); -
mbostock revised this gist
Sep 26, 2010 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -52,7 +52,7 @@ function rainbow(tile) { var rect = tile.element = po.svg("rect"), i = hilbert(tile.column, tile.row, tile.zoom), j = ~~(i * 360 / (Math.pow(4, tile.zoom) - 1)), k = 1 << tile.zoom; if (tile.column < 0 || tile.column >= k) return; rect.setAttribute("width", size.x); -
mbostock revised this gist
Sep 25, 2010 . 1 changed file with 30 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -57,7 +57,36 @@ if (tile.column < 0 || tile.column >= k) return; rect.setAttribute("width", size.x); rect.setAttribute("height", size.y); rect.setAttribute("fill", hsl(j, 1, .5)); } function hsl(h, s, l) { var m1, m2; /* Some simple corrections for h, s and l. */ h = h % 360; if (h < 0) h += 360; s = s < 0 ? 0 : s > 1 ? 1 : s; l = l < 0 ? 0 : l > 1 ? 1 : l; /* From FvD 13.37, CSS Color Module Level 3 */ m2 = l <= .5 ? l * (1 + s) : l + s - l * s; m1 = 2 * l - m2; function v(h) { if (h > 360) h -= 360; else if (h < 0) h += 360; if (h < 60) return m1 + (m2 - m1) * h / 60; if (h < 180) return m2; if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60; return m1; } function vv(h) { return Math.round(v(h) * 255); } return "rgb(" + vv(h + 120) + "," + vv(h) + "," + vv(h - 120) + ")"; } </script> -
mbostock revised this gist
Sep 25, 2010 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -57,7 +57,7 @@ if (tile.column < 0 || tile.column >= k) return; rect.setAttribute("width", size.x); rect.setAttribute("height", size.y); rect.setAttribute("fill", "hsl(" + j + ",100%,50%)"); } </script> -
mbostock revised this gist
Sep 25, 2010 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -57,7 +57,7 @@ if (tile.column < 0 || tile.column >= k) return; rect.setAttribute("width", size.x); rect.setAttribute("height", size.y); rect.style.fill = "hsl(" + j + ",100%,50%)"; } </script> -
mbostock revised this gist
Sep 25, 2010 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ Say you have a bunch of things, like thousands of photos from your digital camera. What if you wanted to look at them all at once? A typical user interface might order the photos chronologically by column and then by row, which does a decent job of grouping related photos together... But, if you have thousands of photos, the rows may be hundreds of photos long, and it is impossible to zoom in on a group of related photos! An alternative that better preserves locality is a [space-filling curve](http://en.wikipedia.org/wiki/Space-filling_curve), such as the [Hilbert curve](http://en.wikipedia.org/wiki/Hilbert_curve). These curves can be used to place related things next to each other in space, avoiding those huge gaps across rows you see with sequential layout. This example demonstrates the effect of using a Hilbert curve for layout with [Polymaps](http://polymaps.org) by generating rainbow-colored tiles. As you can see, each tile is surrounded by its adjacent colors in the rainbow, even as you zoom in and out. In contrast, the [sequential layout](http://bl.ocks.org/597292) only preserves locality in one dimension. -
mbostock revised this gist
Sep 25, 2010 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ Say you have a bunch of things, like thousands of photos from your digital camera. What if you wanted to look at them all at once? A typical user interface might order the photos chronologically by column and then by row, which does a decent job of grouping related photos together... But, if you have thousands of photos, the rows may be hundreds of photos long, and it is impossible to zoom in on a group of related photos! An alternative with much better locality is a [space-filling curve](http://en.wikipedia.org/wiki/Space-filling_curve), such as the [Hilbert curve](http://en.wikipedia.org/wiki/Hilbert_curve). These curves can be used to place related things next to each other in space, avoiding those huge gaps across rows you see with sequential layout. -
mbostock revised this gist
Sep 25, 2010 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ Say you have a bunch of things, like thousands of photos from your digital camera. What if you wanted to look at them all at once? A typical user interface might order the photos chronologically by column and then by row, which does a decent job of grouping related photos together... But, if you have thousands of photos, the rows may be hundreds of photos long, and it is impossible to zoom in on a sequence of related photos! An alternative with much better locality is a [space-filling curve](http://en.wikipedia.org/wiki/Space-filling_curve), such as the [Hilbert curve](http://en.wikipedia.org/wiki/Hilbert_curve). These curves can be used to place related things next to each other in space, avoiding those huge gaps across rows you see with sequential layout. This example demonstrates the effect of using a Hilbert curve for layout with [Polymaps](http://polymaps.org) by generating rainbow-colored tiles. As you can see, each tile is surrounded by its adjacent colors in the rainbow, even as you zoom in and out. In contrast, the [sequential layout](http://bl.ocks.org/597292) only preserves locality in one dimension. -
mbostock revised this gist
Sep 25, 2010 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ Say you have a bunch of things, like thousands of photos from your digital camera. What if you wanted to look at them all at once? A typical user interface might order the photos chronologically by column and then by row, which does a decent job of grouping related photos together... But, if you have thousands of photos, the rows may be hundreds of photos long, and it is impossible to zoom in just one batch of related photos. An alternative with much better locality is a [space-filling curve](http://en.wikipedia.org/wiki/Space-filling_curve), such as the [Hilbert curve](http://en.wikipedia.org/wiki/Hilbert_curve)! These curves can be used to place related things next to each other in space, avoiding those huge gaps across rows you see with sequential layout. -
mbostock revised this gist
Sep 25, 2010 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ Say you have a bunch of things, like thousands of photos from your digital camera. What if you wanted to look at them all at once? A typical user interface might order the photos chronologically by column and then by row, which does a decent job of grouping related photos together... But, if you have thousands of photos, the rows get really long, causing [distracting striation](http://bl.ocks.org/597292). An alternative with much better locality is a [space-filling curve](http://en.wikipedia.org/wiki/Space-filling_curve), such as the [Hilbert curve](http://en.wikipedia.org/wiki/Hilbert_curve)! These curves can be used to place related things next to each other in space, avoiding those huge gaps across rows you see with sequential layout. This example demonstrates the effect of using a Hilbert curve for layout with [Polymaps](http://polymaps.org) by generating rainbow-colored tiles. As you can see, each tile is surrounded by its adjacent colors in the rainbow, even as you zoom in and out. In contrast, the [sequential layout](http://bl.ocks.org/597292) only preserves locality in one dimension. -
mbostock revised this gist
Sep 25, 2010 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -39,9 +39,10 @@ var map = po.map() .container(document.body.appendChild(po.svg("svg"))) .zoomRange([0, 6]) .zoom(4) .center({lat: 0, lon: 0}) .tileSize(size) .add(po.interact()); map.add(po.layer(rainbow)); -
mbostock revised this gist
Sep 25, 2010 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -37,7 +37,7 @@ var size = {x: 32, y: 32}; var map = po.map() .container(document.body.appendChild(po.svg("svg"))) .zoomRange([0, 6]) .tileSize(size) .add(po.interact()) -
mbostock created this gist
Sep 25, 2010 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,64 @@ <!DOCTYPE html> <html> <head> <script type="text/javascript" src="http://github.com/mbostock/polymaps/raw/fcfe7020bf8dfa27c4c7b032d74b6b5e24a18868/polymaps.min.js"></script> <style type="text/css"> @import url("http://github.com/mbostock/polymaps/raw/fcfe7020bf8dfa27c4c7b032d74b6b5e24a18868/examples/example.css"); </style> </head> <body> <script type="text/javascript"> hilbert = (function() { // Adapted from Nick Johnson: http://bit.ly/biWkkq var pairs = [ [[0, 3], [1, 0], [3, 1], [2, 0]], [[2, 1], [1, 1], [3, 0], [0, 2]], [[2, 2], [3, 3], [1, 2], [0, 1]], [[0, 0], [3, 2], [1, 3], [2, 3]] ]; return function(x, y, z) { var quad = 0, pair, i = 0; while (--z >= 0) { pair = pairs[quad][(x & (1 << z) ? 2 : 0) | (y & (1 << z) ? 1 : 0)]; i = (i << 2) | pair[0]; quad = pair[1]; } return i; }; })(); var po = org.polymaps; var size = {x: 32, y: 32}; var map = po.map() .container(document.getElementById("map").appendChild(po.svg("svg"))) .zoomRange([0, 6]) .tileSize(size) .add(po.interact()) .add(po.hash()); map.add(po.layer(rainbow)); map.add(po.compass() .pan("none")); function rainbow(tile) { var rect = tile.element = po.svg("rect"), i = hilbert(tile.column, tile.row, tile.zoom), j = ~~(i * 360 / Math.pow(4, tile.zoom)), k = 1 << tile.zoom; if (tile.column < 0 || tile.column >= k) return; rect.setAttribute("width", size.x); rect.setAttribute("height", size.y); rect.setAttribute("fill", "hsl(" + j + ",100%,50%)"); } </script> </body> </html>