@antv/f2
Version:
Charts for mobile visualization.
83 lines (82 loc) • 2.3 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _tslib = require("tslib");
var _util = require("@antv/util");
var _fEngine = require("@antv/f-engine");
var _default = exports.default = function _default(props) {
var records = props.records,
animation = props.animation,
clip = props.clip;
return (0, _fEngine.jsx)("group", {
attrs: {
clip: clip
}
}, records.map(function (record) {
var key = record.key,
children = record.children;
return (0, _fEngine.jsx)("group", {
key: key
}, children.map(function (item) {
var x = item.x,
y = item.y,
size = item.size,
color = item.color,
shapeName = item.shapeName,
shape = item.shape;
if (isNaN(x) || isNaN(y)) {
return null;
}
if (shapeName === 'rect') {
var rectSize = (0, _util.isNil)(size) ? shape.size : size;
return (0, _fEngine.jsx)("rect", {
key: key,
attrs: (0, _tslib.__assign)((0, _tslib.__assign)({
x: x - rectSize,
y: y - rectSize,
fill: color,
stroke: color
}, shape), {
width: rectSize * 2,
height: rectSize * 2
}),
animation: (0, _util.deepMix)({
appear: {
easing: 'linear',
duration: 450
},
update: {
easing: 'linear',
duration: 450,
property: ['x', 'y', 'width', 'height', 'fill']
}
}, animation)
});
}
return (0, _fEngine.jsx)("circle", {
key: key,
style: (0, _tslib.__assign)((0, _tslib.__assign)({
cx: x,
cy: y,
fill: shapeName === 'circle' ? color : null,
stroke: shapeName === 'hollowCircle' ? color : null
}, shape), {
r: (0, _util.isNil)(size) ? shape.size : size
}),
animation: (0, _util.deepMix)({
appear: {
easing: 'linear',
duration: 450
},
update: {
easing: 'linear',
duration: 450,
property: ['cx', 'cy', 'r', 'fill']
}
}, animation)
});
}));
}));
};
;