| 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 4 | value: true
|
|---|
| 5 | });
|
|---|
| 6 | exports.default = tickFormat;
|
|---|
| 7 | var _index = require("../../../lib-vendor/d3-array/src/index.js");
|
|---|
| 8 | var _index2 = require("../../../lib-vendor/d3-format/src/index.js");
|
|---|
| 9 | function tickFormat(start, stop, count, specifier) {
|
|---|
| 10 | var step = (0, _index.tickStep)(start, stop, count),
|
|---|
| 11 | precision;
|
|---|
| 12 | specifier = (0, _index2.formatSpecifier)(specifier == null ? ",f" : specifier);
|
|---|
| 13 | switch (specifier.type) {
|
|---|
| 14 | case "s":
|
|---|
| 15 | {
|
|---|
| 16 | var value = Math.max(Math.abs(start), Math.abs(stop));
|
|---|
| 17 | if (specifier.precision == null && !isNaN(precision = (0, _index2.precisionPrefix)(step, value))) specifier.precision = precision;
|
|---|
| 18 | return (0, _index2.formatPrefix)(specifier, value);
|
|---|
| 19 | }
|
|---|
| 20 | case "":
|
|---|
| 21 | case "e":
|
|---|
| 22 | case "g":
|
|---|
| 23 | case "p":
|
|---|
| 24 | case "r":
|
|---|
| 25 | {
|
|---|
| 26 | if (specifier.precision == null && !isNaN(precision = (0, _index2.precisionRound)(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e");
|
|---|
| 27 | break;
|
|---|
| 28 | }
|
|---|
| 29 | case "f":
|
|---|
| 30 | case "%":
|
|---|
| 31 | {
|
|---|
| 32 | if (specifier.precision == null && !isNaN(precision = (0, _index2.precisionFixed)(step))) specifier.precision = precision - (specifier.type === "%") * 2;
|
|---|
| 33 | break;
|
|---|
| 34 | }
|
|---|
| 35 | }
|
|---|
| 36 | return (0, _index2.format)(specifier);
|
|---|
| 37 | } |
|---|