Last active
April 19, 2016 18:07
Revisions
-
mbostock revised this gist
Feb 9, 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
Feb 9, 2016 . 1 changed file with 5 additions and 23 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,24 +1,8 @@ <!DOCTYPE html> <meta charset="utf-8"> <body> <script src="//d3js.org/d3.v3.min.js"></script> <script> var div = d3.select("body").selectAll("div") .data(["a", "b", "f"]) @@ -33,6 +17,4 @@ div.order(); </script> -
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
Dec 7, 2011 . 2 changed files with 38 additions and 25 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,38 @@ <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> </head> <body> <script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.6.0"></script> <script type="text/javascript"> d3.selection.prototype.order = function() { for (var j = 0, m = this.length; j < m; j++) { for (var group = this[j], i = 1, n = group.length, prev = group[0]; i < n; i++) { var node = group[i]; if (node) { if (prev) prev.parentNode.insertBefore(node, prev.nextSibling); prev = node; } } } return this; }; var div = d3.select("body").selectAll("div") .data(["a", "b", "f"]) .enter().append("div") .text(String); var div = d3.select("body").selectAll("div") .data(["a", "b", "c", "d", "e", "f"], String); div.enter().append("div") .text(String); div.order(); </script> </body> </html> 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,25 +0,0 @@ -
mbostock created this gist
Dec 7, 2011 .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,25 @@ d3_selectionPrototype.order = function() { for (var j = 0, m = this.length; j < m; j++) { for (var group = this[j], i = 1, n = group.length, prev = group[0]; i < n; i++) { var node = group[i]; if (node) { if (prev) prev.parentNode.insertBefore(node, prev.nextSibling); prev = node; } } } return this; }; d3_selectionPrototype.sort = function(comparator) { comparator = d3_selection_sortComparator.apply(this, arguments); for (var j = 0, m = this.length; j < m; j++) this[j].sort(comparator); return this.reorder(); }; function d3_selection_sortComparator(comparator) { if (!arguments.length) comparator = d3.ascending; return function(a, b) { return comparator(a && a.__data__, b && b.__data__); }; }