Merge branch 'master' of github.com:mbostock/d3

This commit is contained in:
Mike Bostock 2011-11-03 17:02:19 -07:00
Родитель fb07750993 c0e5b96336
Коммит 98da365557
17 изменённых файлов: 70 добавлений и 61 удалений

Просмотреть файл

@ -94,8 +94,6 @@ d3.core.js: \
src/core/selection-insert.js \
src/core/selection-remove.js \
src/core/selection-data.js \
src/core/selection-enter.js \
src/core/selection-enter-select.js \
src/core/selection-filter.js \
src/core/selection-map.js \
src/core/selection-sort.js \
@ -106,6 +104,8 @@ d3.core.js: \
src/core/selection-node.js \
src/core/selection-transition.js \
src/core/selection-root.js \
src/core/selection-enter.js \
src/core/selection-enter-select.js \
src/core/transition.js \
src/core/transition-select.js \
src/core/transition-selectAll.js \
@ -255,7 +255,7 @@ install:
mkdir -p node_modules
npm install
package.json: d3.js
package.json: d3.js src/package.js
node src/package.js > $@
clean:

2
d3.chart.min.js поставляемый

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

2
d3.csv.min.js поставляемый
Просмотреть файл

@ -1 +1 @@
(function(){function b(a){return/[",\n]/.test(a)?'"'+a.replace(/\"/g,'""')+'"':a}function a(a){return a.map(b).join(",")}d3.csv=function(a,b){d3.text(a,"text/csv",function(a){b(a&&d3.csv.parse(a))})},d3.csv.parse=function(a){var b;return d3.csv.parseRows(a,function(a,c){if(c){var d={},e=-1,f=b.length;while(++e<f)d[b[e]]=a[e];return d}b=a;return null})},d3.csv.parseRows=function(a,b){function j(){if(f.lastIndex>=a.length)return d;if(i){i=!1;return c}var b=f.lastIndex;if(a.charCodeAt(b)===34){var e=b;while(e++<a.length)if(a.charCodeAt(e)===34){if(a.charCodeAt(e+1)!==34)break;e++}f.lastIndex=e+2;var g=a.charCodeAt(e+1);g===13?(i=!0,a.charCodeAt(e+2)===10&&f.lastIndex++):g===10&&(i=!0);return a.substring(b+1,e).replace(/""/g,'"')}var h=f.exec(a);if(h){i=h[0].charCodeAt(0)!==44;return a.substring(b,h.index)}f.lastIndex=a.length;return a.substring(b)}var c={},d={},e=[],f=/\r\n|[,\r\n]/g,g=0,h,i;f.lastIndex=0;while((h=j())!==d){var k=[];while(h!==c&&h!==d)k.push(h),h=j();if(b&&!(k=b(k,g++)))continue;e.push(k)}return e},d3.csv.format=function(b){return b.map(a).join("\n")}})()
(function(){function a(a){return a.map(b).join(",")}function b(a){return/[",\n]/.test(a)?'"'+a.replace(/\"/g,'""')+'"':a}d3.csv=function(a,b){d3.text(a,"text/csv",function(a){b(a&&d3.csv.parse(a))})},d3.csv.parse=function(a){var b;return d3.csv.parseRows(a,function(a,c){if(c){var d={},e=-1,f=b.length;while(++e<f)d[b[e]]=a[e];return d}return b=a,null})},d3.csv.parseRows=function(a,b){function j(){if(f.lastIndex>=a.length)return d;if(i)return i=!1,c;var b=f.lastIndex;if(a.charCodeAt(b)===34){var e=b;while(e++<a.length)if(a.charCodeAt(e)===34){if(a.charCodeAt(e+1)!==34)break;e++}f.lastIndex=e+2;var g=a.charCodeAt(e+1);return g===13?(i=!0,a.charCodeAt(e+2)===10&&f.lastIndex++):g===10&&(i=!0),a.substring(b+1,e).replace(/""/g,'"')}var h=f.exec(a);return h?(i=h[0].charCodeAt(0)!==44,a.substring(b,h.index)):(f.lastIndex=a.length,a.substring(b))}var c={},d={},e=[],f=/\r\n|[,\r\n]/g,g=0,h,i;f.lastIndex=0;while((h=j())!==d){var k=[];while(h!==c&&h!==d)k.push(h),h=j();if(b&&!(k=b(k,g++)))continue;e.push(k)}return e},d3.csv.format=function(b){return b.map(a).join("\n")}})();

2
d3.geo.min.js поставляемый

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

2
d3.geom.min.js поставляемый

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

71
d3.js поставляемый
Просмотреть файл

@ -10,7 +10,7 @@ try {
d3_style_setProperty.call(this, name, value + "", priority);
};
}
d3 = {version: "2.4.4"}; // semver
d3 = {version: "2.4.6"}; // semver
var d3_array = d3_arraySlice; // conversion for NodeLists
function d3_arrayCopy(pseudoarray) {
@ -1666,40 +1666,6 @@ d3_selectionPrototype.data = function(data, join) {
function d3_selection_dataNode(data) {
return {__data__: data};
}
function d3_selection_enter(selection) {
d3_arraySubclass(selection, d3_selection_enterPrototype);
return selection;
}
var d3_selection_enterPrototype = [];
d3_selection_enterPrototype.append = d3_selectionPrototype.append;
d3_selection_enterPrototype.insert = d3_selectionPrototype.insert;
d3_selection_enterPrototype.empty = d3_selectionPrototype.empty;
d3_selection_enterPrototype.select = function(selector) {
var subgroups = [],
subgroup,
subnode,
upgroup,
group,
node;
for (var j = -1, m = this.length; ++j < m;) {
upgroup = (group = this[j]).update;
subgroups.push(subgroup = []);
subgroup.parentNode = group.parentNode;
for (var i = -1, n = group.length; ++i < n;) {
if (node = group[i]) {
subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i));
subnode.__data__ = node.__data__;
} else {
subgroup.push(null);
}
}
}
return d3_selection(subgroups);
};
// TODO preserve null elements to maintain index?
d3_selectionPrototype.filter = function(filter) {
var subgroups = [],
@ -1844,6 +1810,41 @@ d3.selectAll = function(selector) {
? d3_selectionRoot.selectAll(selector)
: d3_selection([d3_array(selector)]); // assume node[]
};
function d3_selection_enter(selection) {
d3_arraySubclass(selection, d3_selection_enterPrototype);
return selection;
}
var d3_selection_enterPrototype = [];
d3_selection_enterPrototype.append = d3_selectionPrototype.append;
d3_selection_enterPrototype.insert = d3_selectionPrototype.insert;
d3_selection_enterPrototype.empty = d3_selectionPrototype.empty;
d3_selection_enterPrototype.node = d3_selectionPrototype.node;
d3_selection_enterPrototype.select = function(selector) {
var subgroups = [],
subgroup,
subnode,
upgroup,
group,
node;
for (var j = -1, m = this.length; ++j < m;) {
upgroup = (group = this[j]).update;
subgroups.push(subgroup = []);
subgroup.parentNode = group.parentNode;
for (var i = -1, n = group.length; ++i < n;) {
if (node = group[i]) {
subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i));
subnode.__data__ = node.__data__;
} else {
subgroup.push(null);
}
}
}
return d3_selection(subgroups);
};
function d3_transition(groups, id, time) {
d3_arraySubclass(groups, d3_transitionPrototype);

Просмотреть файл

@ -116,7 +116,7 @@ d3.layout.chord = function() {
x = 0, i = -1; while (++i < n) {
x0 = x, j = -1; while (++j < n) {
var di = groupIndex[i],
dj = subgroupIndex[i][j],
dj = subgroupIndex[di][j],
v = matrix[di][dj];
subgroups[di + "-" + dj] = {
index: di,
@ -153,7 +153,9 @@ d3.layout.chord = function() {
function resort() {
chords.sort(function(a, b) {
return sortChords(a.target.value, b.target.value);
return sortChords(
(a.source.value + a.target.value) / 2,
(b.source.value + b.target.value) / 2);
});
}

2
d3.layout.min.js поставляемый

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

4
d3.min.js поставляемый

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

2
d3.time.min.js поставляемый

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -35,6 +35,7 @@ d3.json("../data/us-states.json", function(json) {
.selectAll("path")
.data(json.features)
.enter().append("svg:path")
.attr("d", path)
.attr("transform", function(d) {
var centroid = path.centroid(d),
x = centroid[0],
@ -44,8 +45,7 @@ d3.json("../data/us-states.json", function(json) {
+ "translate(" + -x + "," + -y + ")";
})
.style("stroke-width", function(d) {
return 1 / Math.sqrt(data[+d.id] * 5);
})
.attr("d", path);
return 1 / Math.sqrt(data[+d.id] * 5 || 1);
});
});

Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "d3",
"version": "2.4.4",
"version": "2.4.6",
"description": "A small, free JavaScript library for manipulating documents based on data.",
"keywords": [
"dom",
@ -20,8 +20,8 @@
"url": "http://github.com/mbostock/d3.git"
},
"dependencies": {
"uglify-js": "1.0.6",
"jsdom": "0.2.3",
"vows": "0.5.10"
"uglify-js": "1.1.1",
"jsdom": "0.2.8",
"vows": "0.5.11"
}
}

Просмотреть файл

@ -1 +1 @@
d3 = {version: "2.4.4"}; // semver
d3 = {version: "2.4.6"}; // semver

Просмотреть файл

@ -8,3 +8,4 @@ var d3_selection_enterPrototype = [];
d3_selection_enterPrototype.append = d3_selectionPrototype.append;
d3_selection_enterPrototype.insert = d3_selectionPrototype.insert;
d3_selection_enterPrototype.empty = d3_selectionPrototype.empty;
d3_selection_enterPrototype.node = d3_selectionPrototype.node;

Просмотреть файл

@ -58,7 +58,7 @@ d3.layout.chord = function() {
x = 0, i = -1; while (++i < n) {
x0 = x, j = -1; while (++j < n) {
var di = groupIndex[i],
dj = subgroupIndex[i][j],
dj = subgroupIndex[di][j],
v = matrix[di][dj];
subgroups[di + "-" + dj] = {
index: di,
@ -95,7 +95,9 @@ d3.layout.chord = function() {
function resort() {
chords.sort(function(a, b) {
return sortChords(a.target.value, b.target.value);
return sortChords(
(a.source.value + a.target.value) / 2,
(b.source.value + b.target.value) / 2);
});
}

Просмотреть файл

@ -10,8 +10,8 @@ require("util").puts(JSON.stringify({
"author": {"name": "Mike Bostock", "url": "http://bost.ocks.org/mike"},
"repository": {"type": "git", "url": "http://github.com/mbostock/d3.git"},
"dependencies": {
"uglify-js": "1.0.6",
"jsdom": "0.2.3",
"vows": "0.5.10"
"uglify-js": "1.1.1",
"jsdom": "0.2.8",
"vows": "0.5.11"
}
}, null, 2));

Просмотреть файл

@ -109,6 +109,7 @@ suite.addBatch({
},
"defines an enter selection for entering data": function(span) {
var enter = span.data(d3.range(4)).enter();
assert.isFalse(enter.empty());
assert.equal(enter.length, 2);
assert.equal(enter[0].length, 4);
assert.equal(enter[1].length, 4);
@ -123,6 +124,7 @@ suite.addBatch({
},
"defines an exit selection for exiting data": function(span) {
var exit = span.data(d3.range(1)).exit();
assert.isFalse(exit.empty());
assert.equal(exit.length, 2);
assert.equal(exit[0].length, 2);
assert.equal(exit[1].length, 2);
@ -133,6 +135,7 @@ suite.addBatch({
},
"observes the specified key function": function(span) {
var update = span.data([1, 2], Number);
assert.isFalse(update.empty());
assert.equal(update.length, 2);
assert.equal(update[0].length, 2);
assert.equal(update[1].length, 2);