Created
October 4, 2016 08:38
-
-
Save ningunaparte/bdb0e6be3b7f675d66b7f7320c0c8682 to your computer and use it in GitHub Desktop.
Formatting numbers with d3
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
//BASED ON Michael Stanaland’s Block 6106487 | |
//http://bl.ocks.org/mstanaland/6106487 | |
Starting number: 1500 | |
d3.format(",") : 1,500 | |
d3.format(".1f") : 1500.0 | |
d3.format(",.2f") : 1,500.00 | |
d3.format("s") : 1.5k | |
d3.format(".1s") : 2k | |
d3.format(".2s") : 1.5k | |
function(d) { return "$" + d3.format(",.2f")(d); } : $1,500.00 | |
d3.format(",.2%") : 150,000.00% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment