MCPcopy Create free account
hub / github.com/breck7/scroll / tickFormat

Function tickFormat

external/.d3.js:15072–15097  ·  view source on GitHub ↗
(start, stop, count, specifier)

Source from the content-addressed store, hash-verified

15070}
15071
15072function tickFormat(start, stop, count, specifier) {
15073 var step = tickStep(start, stop, count),
15074 precision;
15075 specifier = formatSpecifier(specifier == null ? ",f" : specifier);
15076 switch (specifier.type) {
15077 case "s": {
15078 var value = Math.max(Math.abs(start), Math.abs(stop));
15079 if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;
15080 return exports.formatPrefix(specifier, value);
15081 }
15082 case "":
15083 case "e":
15084 case "g":
15085 case "p":
15086 case "r": {
15087 if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e");
15088 break;
15089 }
15090 case "f":
15091 case "%": {
15092 if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2;
15093 break;
15094 }
15095 }
15096 return exports.format(specifier);
15097}
15098
15099function linearish(scale) {
15100 var domain = scale.domain;

Callers 1

linearishFunction · 0.85

Calls 7

tickStepFunction · 0.85
formatSpecifierFunction · 0.85
precisionPrefixFunction · 0.85
precisionRoundFunction · 0.85
precisionFixedFunction · 0.85
maxMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected