UNPKG

@visactor/vchart

Version:

charts lib based @visactor/VGrammar

30 lines (25 loc) 1.1 kB
const getMarkGraphicHost = graphic => { var _a; return null !== (_a = null == graphic ? void 0 : graphic.glyphHost) && void 0 !== _a ? _a : graphic; }; export const isCollectionMark = type => "line" === type || "area" === type; export const getDatumOfGraphic = g => { if (!g || !g.context) return null; const {data: data, markType: markType} = g.context; return "line" === (type = markType) || "area" === type ? data : null == data ? void 0 : data[0]; var type; }; export const findMarkGraphic = (rootGroup, target) => { let g = getMarkGraphicHost(target); if (null == g ? void 0 : g.context) return g; for (;(null == g ? void 0 : g.parent) && g.parent !== rootGroup; ) if (g = getMarkGraphicHost(g.parent), g.context) return g; return null; }; export const getDiffAttributesOfGraphic = (g, newAttrs) => { const prevAttrs = g.getAttributes(!0), diffAttrs = {}; return Object.keys(newAttrs).forEach((key => { prevAttrs[key] !== newAttrs[key] && (diffAttrs[key] = newAttrs[key]); })), diffAttrs; }; //# sourceMappingURL=mark.js.map