@antv/f2
Version:
Charts for mobile visualization.
83 lines (82 loc) • 2.43 kB
JavaScript
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
var _util = require("@antv/util");
var _jsx = require("../../jsx");
var _default = function _default(props) {
var records = props.records,
animation = props.animation,
clip = props.clip;
return (0, _jsx.jsx)("group", {
attrs: {
clip: clip
}
}, records.map(function (record) {
var key = record.key,
children = record.children;
return (0, _jsx.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, _jsx.jsx)("rect", {
attrs: (0, _objectSpread2.default)((0, _objectSpread2.default)({
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, _jsx.jsx)("circle", {
attrs: (0, _objectSpread2.default)((0, _objectSpread2.default)({
x: x,
y: 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: ['x', 'y', 'r', 'fill']
}
}, animation)
});
}));
}));
};
exports.default = _default;
;