MCPcopy Create free account
hub / github.com/microsoft/SandDance / variablePrecision

Function variablePrecision

docs/tests/v2/es6/js/sanddance.js:110038–110060  ·  view source on GitHub ↗
(specifier)

Source from the content-addressed store, hash-verified

110036}
110037
110038function variablePrecision(specifier) {
110039 var s = (0, _d3Format.formatSpecifier)(specifier || ',');
110040
110041 if (s.precision == null) {
110042 s.precision = 12;
110043
110044 switch (s.type) {
110045 case '%':
110046 s.precision -= 2;
110047 break;
110048
110049 case 'e':
110050 s.precision -= 1;
110051 break;
110052 }
110053
110054 return trimZeroes((0, _d3Format.format)(s), // number format
110055 (0, _d3Format.format)('.1f')(1)[1] // decimal point character
110056 );
110057 } else {
110058 return (0, _d3Format.format)(s);
110059 }
110060}
110061
110062function trimZeroes(format, decimalChar) {
110063 return function (x) {

Callers 1

tickFormatFunction · 0.85

Calls 1

trimZeroesFunction · 0.70

Tested by

no test coverage detected