@visactor/vchart
Version:
charts lib based @visactor/VGrammar
28 lines (20 loc) • 840 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.findMarkGraphic = exports.getDatumOfGraphic = exports.isCollectionMark = void 0;
const isCollectionMark = type => "line" === type || "area" === type;
exports.isCollectionMark = isCollectionMark;
const getDatumOfGraphic = g => {
if (!g || !g.context) return null;
const {data: data, markType: markType} = g.context;
return (0, exports.isCollectionMark)(markType) ? data : null == data ? void 0 : data[0];
};
exports.getDatumOfGraphic = getDatumOfGraphic;
const findMarkGraphic = (rootGroup, target) => {
let g = target;
for (;(null == g ? void 0 : g.parent) && g.parent !== rootGroup; ) if (g = g.parent,
g.context) return g;
return null;
};
exports.findMarkGraphic = findMarkGraphic;
//# sourceMappingURL=mark.js.map