-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
As a side-effect, ticks are now generated in the same order as the domain. So, if you have a descending domain, you get descending ticks, too. Yay!
- Loading branch information
Showing
9 changed files
with
80 additions
and
118 deletions.
There are no files selected for viewing
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
import {ticks} from "d3-array"; | ||
import {map, slice} from "./array"; | ||
import number from "./number"; | ||
import tickFormat from "./tickFormat"; | ||
import ticks from "./ticks"; | ||
|
||
function newIdentity(domain) { | ||
function identity(domain) { | ||
|
||
function scale(x) { | ||
return +x; | ||
} | ||
|
||
scale.invert = scale; | ||
|
||
scale.domain = scale.range = function(x) { | ||
if (!arguments.length) return domain.slice(); | ||
domain = x.map(Number); | ||
return scale; | ||
scale.domain = scale.range = function(_) { | ||
return arguments.length ? (domain = map.call(_, number), scale) : domain.slice(); | ||
}; | ||
|
||
scale.ticks = function(count) { | ||
return ticks(domain, count); | ||
return ticks(domain[0], domain[domain.length - 1], count == null ? 10 : count); | ||
}; | ||
|
||
scale.tickFormat = function(count, specifier) { | ||
return tickFormat(domain, count, specifier); | ||
}; | ||
|
||
scale.copy = function() { | ||
return newIdentity(domain); | ||
return identity(domain); | ||
}; | ||
|
||
return scale; | ||
} | ||
|
||
export default function() { | ||
return newIdentity([0, 1]); | ||
return identity([0, 1]); | ||
}; |
This file contains 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 characters
This file contains 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 characters
This file was deleted.
Oops, something went wrong.
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters