Files
lan-manager/web/node_modules/@antv/scale/esm/identity/index.js
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

37 lines
1.3 KiB
JavaScript
Raw 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.
import { __extends } from "tslib";
import { isNumber } from '@antv/util';
import Base from '../base';
/**
* identity scale原则上是定义域和值域一致scale/invert方法也是一致的
* 参考R的实现https://github.com/r-lib/scales/blob/master/R/pal-identity.r
* 参考d3的实现做了下转型https://github.com/d3/d3-scale/blob/master/src/identity.js
*/
var Identity = /** @class */ (function (_super) {
__extends(Identity, _super);
function Identity() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = 'identity';
_this.isIdentity = true;
return _this;
}
Identity.prototype.calculateTicks = function () {
return this.values;
};
Identity.prototype.scale = function (value) {
// 如果传入的值不等于 identity 的值,则直接返回,用于一维图时的 dodge
if (this.values[0] !== value && isNumber(value)) {
return value;
}
return this.range[0];
};
Identity.prototype.invert = function (value) {
var range = this.range;
if (value < range[0] || value > range[1]) {
return NaN;
}
return this.values[0];
};
return Identity;
}(Base));
export default Identity;
//# sourceMappingURL=index.js.map