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
abbe1c75
Commit
abbe1c75
authored
Mar 23, 2014
by
Mike Bostock
Browse files
Preserve tick ordering when updating axis.
Fixes #1748.
parent
b86e4e4a
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
3 deletions
+12
-3
d3.js
d3.js
+1
-1
d3.min.js
d3.min.js
+1
-1
src/svg/axis.js
src/svg/axis.js
+1
-1
test/svg/axis-test.js
test/svg/axis-test.js
+9
-0
No files found.
d3.js
View file @
abbe1c75
...
@@ -8686,7 +8686,7 @@
...
@@ -8686,7 +8686,7 @@
g
.
each
(
function
()
{
g
.
each
(
function
()
{
var
g
=
d3
.
select
(
this
);
var
g
=
d3
.
select
(
this
);
var
scale0
=
this
.
__chart__
||
scale
,
scale1
=
this
.
__chart__
=
scale
.
copy
();
var
scale0
=
this
.
__chart__
||
scale
,
scale1
=
this
.
__chart__
=
scale
.
copy
();
var
ticks
=
tickValues
==
null
?
scale1
.
ticks
?
scale1
.
ticks
.
apply
(
scale1
,
tickArguments_
)
:
scale1
.
domain
()
:
tickValues
,
tickFormat
=
tickFormat_
==
null
?
scale1
.
tickFormat
?
scale1
.
tickFormat
.
apply
(
scale1
,
tickArguments_
)
:
d3_identity
:
tickFormat_
,
tick
=
g
.
selectAll
(
"
.tick
"
).
data
(
ticks
,
scale1
),
tickEnter
=
tick
.
enter
().
insert
(
"
g
"
,
"
.domain
"
).
attr
(
"
class
"
,
"
tick
"
).
style
(
"
opacity
"
,
ε
),
tickExit
=
d3
.
transition
(
tick
.
exit
()).
style
(
"
opacity
"
,
ε
).
remove
(),
tickUpdate
=
d3
.
transition
(
tick
).
style
(
"
opacity
"
,
1
),
tickTransform
;
var
ticks
=
tickValues
==
null
?
scale1
.
ticks
?
scale1
.
ticks
.
apply
(
scale1
,
tickArguments_
)
:
scale1
.
domain
()
:
tickValues
,
tickFormat
=
tickFormat_
==
null
?
scale1
.
tickFormat
?
scale1
.
tickFormat
.
apply
(
scale1
,
tickArguments_
)
:
d3_identity
:
tickFormat_
,
tick
=
g
.
selectAll
(
"
.tick
"
).
data
(
ticks
,
scale1
),
tickEnter
=
tick
.
enter
().
insert
(
"
g
"
,
"
.domain
"
).
attr
(
"
class
"
,
"
tick
"
).
style
(
"
opacity
"
,
ε
),
tickExit
=
d3
.
transition
(
tick
.
exit
()).
style
(
"
opacity
"
,
ε
).
remove
(),
tickUpdate
=
d3
.
transition
(
tick
.
order
()
).
style
(
"
opacity
"
,
1
),
tickTransform
;
var
range
=
d3_scaleRange
(
scale1
),
path
=
g
.
selectAll
(
"
.domain
"
).
data
([
0
]),
pathUpdate
=
(
path
.
enter
().
append
(
"
path
"
).
attr
(
"
class
"
,
"
domain
"
),
var
range
=
d3_scaleRange
(
scale1
),
path
=
g
.
selectAll
(
"
.domain
"
).
data
([
0
]),
pathUpdate
=
(
path
.
enter
().
append
(
"
path
"
).
attr
(
"
class
"
,
"
domain
"
),
d3
.
transition
(
path
));
d3
.
transition
(
path
));
tickEnter
.
append
(
"
line
"
);
tickEnter
.
append
(
"
line
"
);
...
...
d3.min.js
View file @
abbe1c75
This diff is collapsed.
Click to expand it.
src/svg/axis.js
View file @
abbe1c75
...
@@ -30,7 +30,7 @@ d3.svg.axis = function() {
...
@@ -30,7 +30,7 @@ d3.svg.axis = function() {
tick
=
g
.
selectAll
(
"
.tick
"
).
data
(
ticks
,
scale1
),
tick
=
g
.
selectAll
(
"
.tick
"
).
data
(
ticks
,
scale1
),
tickEnter
=
tick
.
enter
().
insert
(
"
g
"
,
"
.domain
"
).
attr
(
"
class
"
,
"
tick
"
).
style
(
"
opacity
"
,
ε
),
tickEnter
=
tick
.
enter
().
insert
(
"
g
"
,
"
.domain
"
).
attr
(
"
class
"
,
"
tick
"
).
style
(
"
opacity
"
,
ε
),
tickExit
=
d3
.
transition
(
tick
.
exit
()).
style
(
"
opacity
"
,
ε
).
remove
(),
tickExit
=
d3
.
transition
(
tick
.
exit
()).
style
(
"
opacity
"
,
ε
).
remove
(),
tickUpdate
=
d3
.
transition
(
tick
).
style
(
"
opacity
"
,
1
),
tickUpdate
=
d3
.
transition
(
tick
.
order
()
).
style
(
"
opacity
"
,
1
),
tickTransform
;
tickTransform
;
// Domain.
// Domain.
...
...
test/svg/axis-test.js
View file @
abbe1c75
...
@@ -486,6 +486,15 @@ suite.addBatch({
...
@@ -486,6 +486,15 @@ suite.addBatch({
assert
.
isFalse
(
t
.
select
(
"
text
"
).
empty
());
assert
.
isFalse
(
t
.
select
(
"
text
"
).
empty
());
assert
.
equal
(
t
.
select
(
"
text
"
).
text
(),
tickFormat
(
ticks
[
i
]));
assert
.
equal
(
t
.
select
(
"
text
"
).
text
(),
tickFormat
(
ticks
[
i
]));
});
});
},
"
maintains the order of tick marks
"
:
function
(
d3
)
{
var
a
=
d3
.
svg
.
axis
(),
g
=
d3
.
select
(
"
body
"
).
html
(
""
).
append
(
"
g
"
).
call
(
a
),
x
=
d3
.
scale
.
linear
().
domain
([
1
,
1.5
]);
a
.
scale
().
domain
(
x
.
domain
());
g
.
call
(
a
.
ticks
(
10
));
g
.
call
(
a
.
ticks
(
20
));
assert
.
deepEqual
(
g
.
selectAll
(
"
.tick
"
).
data
(),
x
.
ticks
(
20
));
}
}
}
}
}
}
...
...
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