Created
October 11, 2019 06:11
-
-
Save ypetya/6e2a95927f85229d708bf7114ae73e61 to your computer and use it in GitHub Desktop.
Invertable d3.axis
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
makeInvertable = (axis, t) => { | |
axis.invert = x => { | |
const domain = axis.domain(), | |
range = axis.range(), | |
invertScale = t ? t.domain(range).range(domain) : | |
d3.scaleQuantize().domain(range).range(domain); | |
return invertScale(x); | |
}; | |
}; | |
// makeInvertable(x); | |
// makeInvertable(y, d3.scaleLinear()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment