@visactor/vchart
Version:
charts lib based @visactor/VGrammar
21 lines (17 loc) • 924 B
JavaScript
import { minInArray } from "@visactor/vutils";
import { DiffState } from "../../../mark/interface/enum";
export const computeRatio = (angle, range) => {
const ratio = (angle - range[0]) / (range[1] - range[0] || 1);
return Math.max(0, Math.min(1, ratio));
};
export const getInnerMostElements = graphics => {
const updateElements = graphics.filter((g => g.context.diffState === DiffState.update)), minDepth = minInArray(updateElements.map((g => {
var _a, _b;
return null === (_b = null === (_a = null == g ? void 0 : g.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0].depth;
})));
return updateElements.filter((g => {
var _a, _b;
return (null === (_b = null === (_a = null == g ? void 0 : g.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0].depth) === minDepth;
}));
};
//# sourceMappingURL=utils.js.map