UNPKG

@visactor/vtable

Version:

canvas table width high performance

24 lines (18 loc) 1.43 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.getTickModeFunction = exports.getZeroAlignTickAlignTicks = void 0; const factory_1 = require("../../core/factory"), get_axis_config_1 = require("./get-axis-config"); function getZeroAlignTickAlignTicks(targetRange, col, row, index, position, layout) { const getAxisDomainRangeAndLabels = factory_1.Factory.getFunction("getAxisDomainRangeAndLabels"), {axisOption: axisOption, isZeroAlign: isZeroAlign} = (0, get_axis_config_1.getAxisOption)(col, row, 0 === index ? "right" : "left", layout), {ticks: ticks} = getAxisDomainRangeAndLabels(targetRange.min, targetRange.max, axisOption, isZeroAlign, "bottom" === position || "top" === position ? layout._table.getColWidth(col) || layout._table.tableNoFrameWidth : layout._table.getRowHeight(row) || layout._table.tableNoFrameHeight); return ticks; } function getTickModeFunction(targetTicks, targetRange, range, indicatorIndex) { return 0 !== indicatorIndex && targetTicks ? () => targetTicks.map((value => { const percent = (value - targetRange.min) / (targetRange.max - targetRange.min), tick = (range.max - range.min) * percent + range.min; return Math.round(100 * tick) / 100; })) : void 0; } exports.getZeroAlignTickAlignTicks = getZeroAlignTickAlignTicks, exports.getTickModeFunction = getTickModeFunction; //# sourceMappingURL=tick-align.js.map