UNPKG

1.71 kBJavaScriptView Raw
1import { jsx } from '../../jsx';
2export default (function (props) {
3 var nodes = props.nodes,
4 coord = props.coord;
5
6 if (coord.isPolar) {
7 var center = coord.center;
8 var x = center.x,
9 y = center.y;
10 return jsx("group", null, nodes.map(function (node) {
11 var xMin = node.xMin,
12 xMax = node.xMax,
13 yMin = node.yMin,
14 yMax = node.yMax,
15 color = node.color;
16 return jsx("sector", {
17 attrs: {
18 x: x,
19 y: y,
20 lineWidth: '1px',
21 stroke: '#fff',
22 startAngle: xMin,
23 endAngle: xMax,
24 r0: yMin,
25 r: yMax,
26 anticlockwise: false,
27 fill: color
28 }
29 });
30 }));
31 }
32
33 return jsx("group", null, nodes.map(function (node) {
34 var key = node.key,
35 xMin = node.xMin,
36 xMax = node.xMax,
37 yMin = node.yMin,
38 yMax = node.yMax,
39 color = node.color;
40 return jsx("rect", {
41 key: key,
42 attrs: {
43 x: xMin,
44 y: yMin,
45 width: xMax - xMin,
46 height: yMax - yMin,
47 fill: color,
48 lineWidth: '4px',
49 stroke: '#fff',
50 radius: '8px'
51 },
52 animation: {
53 appear: {
54 easing: 'linear',
55 duration: 450,
56 property: ['fillOpacity', 'strokeOpacity'],
57 start: {
58 fillOpacity: 0,
59 strokeOpacity: 0
60 },
61 end: {
62 fillOpacity: 1,
63 strokeOpacity: 1
64 }
65 },
66 update: {
67 easing: 'linear',
68 duration: 450,
69 property: ['x', 'y', 'width', 'height', 'radius', 'lineWidth']
70 }
71 }
72 });
73 }));
74});
\No newline at end of file