Sci notation on continuous legend (#1450)

* sci notation on continuous legend

* significant digits
This commit is contained in:
Colin Megill
2020-05-07 12:59:10 -04:00
committed by GitHub
parent 7ec9bb92f7
commit 9026e0ce41
3 changed files with 37 additions and 6 deletions
+10
View File
@@ -0,0 +1,10 @@
/*
via https://github.com/nodef/extra-number/blob/master/scripts/significantDigits.js
*/
export default (n) => {
return n
.toExponential()
.replace(/e[\+\-0-9]*$/, "")
.replace(/^0\.?0*|\./, "").length;
};