Files
openclaw 0a5f6a8047 Initial commit: Lan-manager project code
- Go backend (server/)
- Frontend (web/, server/static/)
- Database and deployment files
- Scripts and docs

Co-Authored-By: 狸花猫/Claude-Qwen3.6-Plus 🐾
2026-04-20 00:52:58 +08:00

33 lines
1.0 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var math_1 = require("../util/math");
/**
* 计算 log 的 ticks考虑 min = 0 的场景
* @param cfg 度量的配置项
* @returns 计算后的 ticks
*/
function calculateLogTicks(cfg) {
var base = cfg.base, tickCount = cfg.tickCount, min = cfg.min, max = cfg.max, values = cfg.values;
var minTick;
var maxTick = math_1.log(base, max);
if (min > 0) {
minTick = Math.floor(math_1.log(base, min));
}
else {
var positiveMin = math_1.getLogPositiveMin(values, base, max);
minTick = Math.floor(math_1.log(base, positiveMin));
}
var count = maxTick - minTick;
var avg = Math.ceil(count / tickCount);
var ticks = [];
for (var i = minTick; i < maxTick + avg; i = i + avg) {
ticks.push(Math.pow(base, i));
}
if (min <= 0) {
// 最小值 <= 0 时显示 0
ticks.unshift(0);
}
return ticks;
}
exports.default = calculateLogTicks;
//# sourceMappingURL=log.js.map