UNPKG

737 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var math_1 = require("../util/math");
4var pretty_1 = require("../util/pretty");
5/**
6 * 计算 Pow 的 ticks
7 * @param cfg 度量的配置项
8 * @returns 计算后的 ticks
9 */
10function calculatePowTicks(cfg) {
11 var exponent = cfg.exponent, tickCount = cfg.tickCount;
12 var max = Math.ceil(math_1.calBase(exponent, cfg.max));
13 var min = Math.floor(math_1.calBase(exponent, cfg.min));
14 var ticks = pretty_1.default(min, max, tickCount).ticks;
15 return ticks.map(function (tick) {
16 var factor = tick >= 0 ? 1 : -1;
17 return Math.pow(tick, exponent) * factor;
18 });
19}
20exports.default = calculatePowTicks;
21//# sourceMappingURL=pow.js.map
\No newline at end of file