@antv/f2
Version:
Charts for mobile visualization.
70 lines • 1.8 kB
JavaScript
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import { jsx } from '../../../jsx';
import { deepMix } from '@antv/util';
export default (function (props) {
var coord = props.coord,
records = props.records,
animation = props.animation;
var center = coord.center,
startAngle = coord.startAngle,
endAngle = coord.endAngle,
radius = coord.radius;
return jsx("group", {
animation: {
appear: _objectSpread(_objectSpread({
easing: 'quadraticOut',
duration: 450
}, animation && animation.appear), {}, {
clip: {
type: 'sector',
property: ['endAngle'],
attrs: {
x: center.x,
y: center.y,
startAngle: startAngle,
r: radius
},
start: {
endAngle: startAngle
},
end: {
endAngle: endAngle
}
}
})
}
}, records.map(function (record) {
var key = record.key,
children = record.children;
return jsx("group", {
key: key
}, children.map(function (item) {
var key = item.key,
xMin = item.xMin,
xMax = item.xMax,
yMin = item.yMin,
yMax = item.yMax,
color = item.color,
shape = item.shape;
return jsx("sector", {
key: key,
attrs: _objectSpread({
x: center.x,
y: center.y,
fill: color,
startAngle: xMin,
endAngle: xMax,
r0: yMin,
r: yMax
}, shape),
animation: deepMix({
update: {
easing: 'linear',
duration: 450,
property: ['x', 'y', 'startAngle', 'endAngle', 'r0', 'r']
}
}, animation)
});
}));
}));
});