Skip to content

Commit dd2a424

Browse files
committed
Merge branch '2.9.2'
2 parents 1affcd2 + 5fff2c3 commit dd2a424

File tree

10 files changed

+22
-17
lines changed

10 files changed

+22
-17
lines changed

d3.v2.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ try {
1010
d3_style_setProperty.call(this, name, value + "", priority);
1111
};
1212
}
13-
d3 = {version: "2.9.1"}; // semver
13+
d3 = {version: "2.9.2"}; // semver
1414
function d3_class(ctor, properties) {
1515
try {
1616
for (var key in properties) {
@@ -661,7 +661,7 @@ d3.format = function(specifier) {
661661
// Apply the scale, computing it from the value's exponent for si format.
662662
if (scale < 0) {
663663
var prefix = d3.formatPrefix(value, precision);
664-
value *= prefix.scale;
664+
value = prefix.scale(value);
665665
suffix = prefix.symbol;
666666
} else {
667667
value *= scale;
@@ -730,12 +730,12 @@ d3.formatPrefix = function(value, precision) {
730730
};
731731

732732
function d3_formatPrefix(d, i) {
733+
var k = Math.pow(10, Math.abs(8 - i) * 3);
733734
return {
734-
scale: Math.pow(10, (8 - i) * 3),
735+
scale: i > 8 ? function(d) { return d / k; } : function(d) { return d * k; },
735736
symbol: d
736737
};
737738
}
738-
739739
/*
740740
* TERMS OF USE - EASING EQUATIONS
741741
*
@@ -5564,6 +5564,7 @@ d3.layout.pie = function() {
55645564
// They are stored in the original data's order.
55655565
var arcs = [];
55665566
index.forEach(function(i) {
5567+
var d;
55675568
arcs[i] = {
55685569
data: data[i],
55695570
value: d = values[i],
@@ -5987,7 +5988,8 @@ d3.layout.hierarchy = function() {
59875988
n,
59885989
c = node.children = [],
59895990
v = 0,
5990-
j = depth + 1;
5991+
j = depth + 1,
5992+
d;
59915993
while (++i < n) {
59925994
d = recurse(childs[i], j, nodes);
59935995
d.parent = node;

d3.v2.min.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/mercator/mercator.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ <h3>Mercator Projection</h3>
6767

6868
equator
6969
.attr("y1", xy([0, 0])[1])
70-
.attr("y2", xy([0, 0])[1])
70+
.attr("y2", xy([0, 0])[1]);
7171
});
7272

7373
function refresh() {
@@ -77,7 +77,7 @@ <h3>Mercator Projection</h3>
7777

7878
equator
7979
.attr("y1", xy([0, 0])[1])
80-
.attr("y2", xy([0, 0])[1])
80+
.attr("y2", xy([0, 0])[1]);
8181

8282
d3.select("#scale span")
8383
.text(xy.scale());

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "d3",
3-
"version": "2.9.1",
3+
"version": "2.9.2",
44
"description": "A small, free JavaScript library for manipulating documents based on data.",
55
"keywords": [
66
"dom",

src/core/core.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
d3 = {version: "2.9.1"}; // semver
1+
d3 = {version: "2.9.2"}; // semver

src/core/format.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ d3.format = function(specifier) {
4343
// Apply the scale, computing it from the value's exponent for si format.
4444
if (scale < 0) {
4545
var prefix = d3.formatPrefix(value, precision);
46-
value *= prefix.scale;
46+
value = prefix.scale(value);
4747
suffix = prefix.symbol;
4848
} else {
4949
value *= scale;

src/core/formatPrefix.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ d3.formatPrefix = function(value, precision) {
1212
};
1313

1414
function d3_formatPrefix(d, i) {
15+
var k = Math.pow(10, Math.abs(8 - i) * 3);
1516
return {
16-
scale: Math.pow(10, (8 - i) * 3),
17+
scale: i > 8 ? function(d) { return d / k; } : function(d) { return d * k; },
1718
symbol: d
1819
};
1920
}
20-

src/layout/hierarchy.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ d3.layout.hierarchy = function() {
1515
n,
1616
c = node.children = [],
1717
v = 0,
18-
j = depth + 1;
18+
j = depth + 1,
19+
d;
1920
while (++i < n) {
2021
d = recurse(childs[i], j, nodes);
2122
d.parent = node;

src/layout/pie.js

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ d3.layout.pie = function() {
3030
// They are stored in the original data's order.
3131
var arcs = [];
3232
index.forEach(function(i) {
33+
var d;
3334
arcs[i] = {
3435
data: data[i],
3536
value: d = values[i],

test/core/format-test.js

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ suite.addBatch({
7878
assert.strictEqual(f(999.5), "999.5");
7979
assert.strictEqual(f(999500), "999.5k");
8080
assert.strictEqual(f(1000), "1k");
81+
assert.strictEqual(f(1400), "1.4k");
8182
assert.strictEqual(f(1500.5), "1.5005k");
8283
assert.strictEqual(f(.000001), "1μ");
8384
},

0 commit comments

Comments
 (0)