UNPKG

@antv/f2

Version:

Charts for mobile visualization.

26 lines 848 B
import { __extends } from "tslib"; import { Category as CategoryScale } from '../deps/f2-scale/src'; import Base from './base'; var Category = /** @class */function (_super) { __extends(Category, _super); function Category() { return _super !== null && _super.apply(this, arguments) || this; } Category.prototype.createScale = function (scaleConfig) { return new CategoryScale(scaleConfig); }; Category.prototype._mapping = function (value) { var _a = this, scale = _a.scale, range = _a.range; if (scale.type === 'cat') { var index_1 = scale.translate(value); return range[index_1 % range.length]; } var normalizeValue = scale.scale(value); var index = Math.round(normalizeValue * (range.length - 1)); return range[index]; }; return Category; }(Base); export default Category;