@visactor/vchart
Version:
charts lib based @visactor/VGrammar
24 lines (20 loc) • 848 B
JavaScript
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 = target;
for (;(null == g ? void 0 : g.parent) && g.parent !== rootGroup; ) if (g = 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