Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
MUR Drupal
d3-library
Commits
4c9f77d2
Commit
4c9f77d2
authored
Apr 08, 2014
by
Mike Bostock
Browse files
The quantile scale should ignore null, too.
parent
92c9d9d8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
10 deletions
+9
-10
d3.js
d3.js
+1
-3
d3.min.js
d3.min.js
+5
-5
src/scale/quantile.js
src/scale/quantile.js
+2
-1
test/scale/quantile-test.js
test/scale/quantile-test.js
+1
-1
No files found.
d3.js
View file @
4c9f77d2
...
@@ -7703,9 +7703,7 @@
...
@@ -7703,9 +7703,7 @@
}
}
scale
.
domain
=
function
(
x
)
{
scale
.
domain
=
function
(
x
)
{
if
(
!
arguments
.
length
)
return
domain
;
if
(
!
arguments
.
length
)
return
domain
;
domain
=
x
.
filter
(
function
(
d
)
{
domain
=
x
.
filter
(
d3_number
).
sort
(
d3_ascending
);
return
!
isNaN
(
d
);
}).
sort
(
d3_ascending
);
return
rescale
();
return
rescale
();
};
};
scale
.
range
=
function
(
x
)
{
scale
.
range
=
function
(
x
)
{
...
...
d3.min.js
View file @
4c9f77d2
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/scale/quantile.js
View file @
4c9f77d2
import
"
../arrays/ascending
"
;
import
"
../arrays/ascending
"
;
import
"
../arrays/bisect
"
;
import
"
../arrays/bisect
"
;
import
"
../arrays/quantile
"
;
import
"
../arrays/quantile
"
;
import
"
../math/number
"
;
import
"
scale
"
;
import
"
scale
"
;
d3
.
scale
.
quantile
=
function
()
{
d3
.
scale
.
quantile
=
function
()
{
...
@@ -24,7 +25,7 @@ function d3_scale_quantile(domain, range) {
...
@@ -24,7 +25,7 @@ function d3_scale_quantile(domain, range) {
scale
.
domain
=
function
(
x
)
{
scale
.
domain
=
function
(
x
)
{
if
(
!
arguments
.
length
)
return
domain
;
if
(
!
arguments
.
length
)
return
domain
;
domain
=
x
.
filter
(
function
(
d
)
{
return
!
isNaN
(
d
);
}
).
sort
(
d3_ascending
);
domain
=
x
.
filter
(
d3_number
).
sort
(
d3_ascending
);
return
rescale
();
return
rescale
();
};
};
...
...
test/scale/quantile-test.js
View file @
4c9f77d2
...
@@ -30,7 +30,7 @@ suite.addBatch({
...
@@ -30,7 +30,7 @@ suite.addBatch({
assert
.
deepEqual
(
x
.
domain
(),
[
3
,
6
,
7
,
8
,
8
,
10
,
13
,
15
,
16
,
20
]);
assert
.
deepEqual
(
x
.
domain
(),
[
3
,
6
,
7
,
8
,
8
,
10
,
13
,
15
,
16
,
20
]);
},
},
"
non-numeric domain values are ignored
"
:
function
(
quantile
)
{
"
non-numeric domain values are ignored
"
:
function
(
quantile
)
{
var
x
=
quantile
().
domain
([
6
,
3
,
NaN
,
undefined
,
7
,
8
,
8
,
13
,
20
,
15
,
16
,
10
,
NaN
]);
var
x
=
quantile
().
domain
([
6
,
3
,
NaN
,
undefined
,
7
,
8
,
8
,
13
,
null
,
20
,
15
,
16
,
10
,
NaN
]);
assert
.
deepEqual
(
x
.
domain
(),
[
3
,
6
,
7
,
8
,
8
,
10
,
13
,
15
,
16
,
20
]);
assert
.
deepEqual
(
x
.
domain
(),
[
3
,
6
,
7
,
8
,
8
,
10
,
13
,
15
,
16
,
20
]);
},
},
"
quantiles returns the inner thresholds
"
:
function
(
quantile
)
{
"
quantiles returns the inner thresholds
"
:
function
(
quantile
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment