@easyv/charts 1.2.1 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +8 -8
- package/.husky/commit-msg +3 -3
- package/CHANGELOG.md +18 -18
- package/commitlint.config.js +1 -1
- package/lib/components/AnimateData.js +40 -36
- package/lib/components/Axis.js +333 -329
- package/lib/components/Background.js +2 -2
- package/lib/components/Band.js +177 -173
- package/lib/components/Brush.js +201 -201
- package/lib/components/Carousel.js +171 -164
- package/lib/components/CartesianChart.js +11 -7
- package/lib/components/Chart.js +114 -111
- package/lib/components/ChartContainer.js +62 -58
- package/lib/components/ConicalGradient.js +268 -264
- package/lib/components/ExtentData.js +48 -45
- package/lib/components/FilterData.js +56 -53
- package/lib/components/Indicator.js +2 -2
- package/lib/components/Label.js +278 -278
- package/lib/components/Legend.js +160 -154
- package/lib/components/Lighter.js +179 -179
- package/lib/components/Line.js +187 -181
- package/lib/components/LinearGradient.js +2 -2
- package/lib/components/Mapping.js +130 -127
- package/lib/components/Marquee.js +98 -0
- package/lib/components/PieChart.js +1078 -1061
- package/lib/components/StackData.js +48 -45
- package/lib/components/StereoBar.js +340 -336
- package/lib/components/TextOverflow.js +65 -0
- package/lib/components/Tooltip.js +155 -155
- package/lib/components/index.js +202 -194
- package/lib/css/index.module.css +41 -41
- package/lib/css/piechart.module.css +26 -26
- package/lib/element/ConicGradient.js +72 -72
- package/lib/formatter/legend.js +91 -91
- package/lib/hooks/index.js +62 -62
- package/lib/hooks/useAnimateData.js +88 -88
- package/lib/hooks/useAxes.js +135 -135
- package/lib/hooks/useCarouselAxisX.js +184 -184
- package/lib/hooks/useExtentData.js +128 -128
- package/lib/hooks/useFilterData.js +112 -112
- package/lib/hooks/useStackData.js +136 -134
- package/lib/hooks/useTooltip.js +10 -10
- package/lib/index.js +89 -85
- package/lib/utils/index.js +835 -832
- package/package.json +53 -51
- package/src/components/AnimateData.tsx +24 -24
- package/src/components/Axis.tsx +354 -354
- package/src/components/Background.tsx +45 -45
- package/src/components/Band.tsx +173 -173
- package/src/components/Brush.js +159 -159
- package/src/components/Carousel.tsx +144 -144
- package/src/components/Chart.js +99 -99
- package/src/components/ChartContainer.tsx +63 -63
- package/src/components/ConicalGradient.js +258 -258
- package/src/components/ExtentData.js +17 -17
- package/src/components/FilterData.js +23 -23
- package/src/components/Indicator.js +13 -13
- package/src/components/Label.js +206 -206
- package/src/components/Legend.js +158 -158
- package/src/components/Lighter.jsx +173 -173
- package/src/components/Line.js +144 -144
- package/src/components/LinearGradient.js +29 -29
- package/src/components/Mapping.js +71 -71
- package/src/components/Marquee.js +93 -74
- package/src/components/PieChart.js +1288 -1097
- package/src/components/StackData.js +20 -20
- package/src/components/StereoBar.tsx +310 -310
- package/src/components/TextOverflow.js +51 -0
- package/src/components/Tooltip.js +169 -169
- package/src/components/index.js +53 -51
- package/src/context/index.js +2 -2
- package/src/css/index.module.css +41 -41
- package/src/css/piechart.module.css +26 -26
- package/src/element/ConicGradient.jsx +55 -55
- package/src/element/Line.tsx +33 -33
- package/src/element/index.ts +3 -3
- package/src/formatter/index.js +1 -1
- package/src/formatter/legend.js +90 -90
- package/src/hooks/index.js +17 -17
- package/src/hooks/useAnimateData.ts +67 -67
- package/src/hooks/useAxes.js +144 -144
- package/src/hooks/useCarouselAxisX.js +163 -163
- package/src/hooks/useExtentData.js +88 -88
- package/src/hooks/useFilterData.js +72 -72
- package/src/hooks/useStackData.js +100 -100
- package/src/hooks/useTooltip.ts +96 -96
- package/src/index.js +6 -6
- package/src/types/index.d.ts +67 -67
- package/src/utils/index.js +696 -696
- package/tsconfig.json +22 -22
|
@@ -1,1062 +1,1079 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports["default"] = void 0;
|
|
11
|
-
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
15
|
-
|
|
16
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
-
|
|
18
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
19
|
-
|
|
20
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
21
|
-
|
|
22
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
23
|
-
|
|
24
|
-
var _ = require(".");
|
|
25
|
-
|
|
26
|
-
var _context = require("../context");
|
|
27
|
-
|
|
28
|
-
var _utils = require("../utils");
|
|
29
|
-
|
|
30
|
-
var _d3v = require("d3v7");
|
|
31
|
-
|
|
32
|
-
var _popmotion = require("popmotion");
|
|
33
|
-
|
|
34
|
-
var _LinearGradient = _interopRequireDefault(require("./LinearGradient"));
|
|
35
|
-
|
|
36
|
-
var _formatter = require("../formatter");
|
|
37
|
-
|
|
38
|
-
var _piechartModule = _interopRequireDefault(require("../css/piechart.module.css"));
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
var
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
_ref3$
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
var
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
_ref5$config$chart
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
_ref5$config$
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
_ref5$config$fan$
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
_ref5$config$
|
|
310
|
-
|
|
311
|
-
_ref5$config$
|
|
312
|
-
|
|
313
|
-
_ref5$
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
var
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
var
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
var
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
var
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
}),
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
var
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
fill:
|
|
623
|
-
|
|
624
|
-
}),
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
fill:
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
_ref9$config$
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
},
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
}
|
|
769
|
-
},
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
})
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
//
|
|
833
|
-
//
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
//
|
|
837
|
-
//
|
|
838
|
-
//
|
|
839
|
-
//
|
|
840
|
-
//
|
|
841
|
-
// }
|
|
842
|
-
//
|
|
843
|
-
//
|
|
844
|
-
//
|
|
845
|
-
//
|
|
846
|
-
//
|
|
847
|
-
//
|
|
848
|
-
//
|
|
849
|
-
//
|
|
850
|
-
//
|
|
851
|
-
//
|
|
852
|
-
//
|
|
853
|
-
//
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
var
|
|
891
|
-
|
|
892
|
-
var
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
},
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
var
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
},
|
|
1038
|
-
|
|
1039
|
-
style:
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
15
|
+
|
|
16
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
+
|
|
18
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
19
|
+
|
|
20
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
21
|
+
|
|
22
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
23
|
+
|
|
24
|
+
var _ = require(".");
|
|
25
|
+
|
|
26
|
+
var _context = require("../context");
|
|
27
|
+
|
|
28
|
+
var _utils = require("../utils");
|
|
29
|
+
|
|
30
|
+
var _d3v = require("d3v7");
|
|
31
|
+
|
|
32
|
+
var _popmotion = require("popmotion");
|
|
33
|
+
|
|
34
|
+
var _LinearGradient = _interopRequireDefault(require("./LinearGradient"));
|
|
35
|
+
|
|
36
|
+
var _formatter = require("../formatter");
|
|
37
|
+
|
|
38
|
+
var _piechartModule = _interopRequireDefault(require("../css/piechart.module.css"));
|
|
39
|
+
|
|
40
|
+
var _excluded = ["startAngle", "endAngle", "antiClockwise"],
|
|
41
|
+
_excluded2 = ["padAngle", "innerRadius", "outerRadius", "cornerRadius", "startAngle", "endAngle"],
|
|
42
|
+
_excluded3 = ["formatter"],
|
|
43
|
+
_excluded4 = ["startAngle", "endAngle"];
|
|
44
|
+
|
|
45
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
46
|
+
|
|
47
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
48
|
+
|
|
49
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
50
|
+
|
|
51
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
52
|
+
|
|
53
|
+
var PI = Math.PI;
|
|
54
|
+
var defaultChart = {
|
|
55
|
+
outerRadius: 1,
|
|
56
|
+
innerRadius: 0,
|
|
57
|
+
cornerRadius: 0,
|
|
58
|
+
rose: false,
|
|
59
|
+
roseType: 'radius',
|
|
60
|
+
baseRadius: 0,
|
|
61
|
+
padAngle: 0
|
|
62
|
+
};
|
|
63
|
+
var defaultAngle = {
|
|
64
|
+
startAngle: 0,
|
|
65
|
+
endAngle: 360,
|
|
66
|
+
antiClockwise: false
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
var nameDy = function nameDy(showValue, showPercent, mode, dir) {
|
|
70
|
+
if (showValue || showPercent) {
|
|
71
|
+
if (mode == 'vertical') {
|
|
72
|
+
return dir == 1 ? '1.1em' : '-2.6em';
|
|
73
|
+
} else {
|
|
74
|
+
return 0;
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
if (mode == 'vertical') {
|
|
78
|
+
return dir * 1.1 + 'em';
|
|
79
|
+
} else {
|
|
80
|
+
return 0;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
var valueDy = function valueDy(value1, mode, dir) {
|
|
86
|
+
if (value1) {
|
|
87
|
+
if (mode == 'vertical') {
|
|
88
|
+
return '1.5em';
|
|
89
|
+
} else {
|
|
90
|
+
return 0;
|
|
91
|
+
}
|
|
92
|
+
} else {
|
|
93
|
+
if (mode == 'vertical') {
|
|
94
|
+
return dir == 1 ? '1.1em' : '-1.1em';
|
|
95
|
+
} else {
|
|
96
|
+
return 0;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
var percentDy_ = function percentDy_(showName, showValue, mode, dir) {
|
|
102
|
+
if (showValue) {
|
|
103
|
+
return 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (showName) {
|
|
107
|
+
if (mode == 'vertical') {
|
|
108
|
+
return '1.5em';
|
|
109
|
+
} else {
|
|
110
|
+
return 0;
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
if (mode == 'vertical') {
|
|
114
|
+
return dir * 1.1 + 'em';
|
|
115
|
+
} else {
|
|
116
|
+
return 0;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
var percentX = function percentX(showName, showValue, mode, x) {
|
|
122
|
+
if (showValue) {
|
|
123
|
+
return '';
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (showName) {
|
|
127
|
+
if (mode == 'vertical') {
|
|
128
|
+
return x;
|
|
129
|
+
} else {
|
|
130
|
+
return '';
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
return x;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
var percentDx = function percentDx(showName, showValue, mode) {
|
|
138
|
+
if (showValue) {
|
|
139
|
+
return '0.5em';
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (showName) {
|
|
143
|
+
if (mode == 'vertical') {
|
|
144
|
+
return 0;
|
|
145
|
+
} else {
|
|
146
|
+
return '0.5em';
|
|
147
|
+
}
|
|
148
|
+
} else {
|
|
149
|
+
return 0;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
var percentDy = function percentDy(showName, showValue, mode) {
|
|
154
|
+
if (showValue) {
|
|
155
|
+
return 0;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (showName) {
|
|
159
|
+
if (mode == 'vertical') {
|
|
160
|
+
return '1.5em';
|
|
161
|
+
} else {
|
|
162
|
+
return 0;
|
|
163
|
+
}
|
|
164
|
+
} else {
|
|
165
|
+
return 0;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
var valueDx = function valueDx(showName, mode) {
|
|
170
|
+
if (!showName) {
|
|
171
|
+
return '';
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (mode == 'vertical') {
|
|
175
|
+
return '';
|
|
176
|
+
} else {
|
|
177
|
+
return '0.5em';
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
var getCoord = function getCoord(deg, radius) {
|
|
182
|
+
var x = Math.cos(deg) * radius,
|
|
183
|
+
y = Math.sin(deg) * radius;
|
|
184
|
+
return [x, y];
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
var getRoseRadius = function getRoseRadius(_ref) {
|
|
188
|
+
var innerRadius = _ref.innerRadius,
|
|
189
|
+
baseRadius = _ref.baseRadius;
|
|
190
|
+
return innerRadius + (1 - innerRadius) * baseRadius;
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
var getAngle = function getAngle(_ref2) {
|
|
194
|
+
var startAngle = _ref2.startAngle,
|
|
195
|
+
endAngle = _ref2.endAngle,
|
|
196
|
+
antiClockwise = _ref2.antiClockwise,
|
|
197
|
+
rest = (0, _objectWithoutProperties2["default"])(_ref2, _excluded);
|
|
198
|
+
if (antiClockwise) return _objectSpread(_objectSpread({}, rest), {}, {
|
|
199
|
+
startAngle: endAngle - 180,
|
|
200
|
+
endAngle: startAngle - 180
|
|
201
|
+
});
|
|
202
|
+
return _objectSpread(_objectSpread({}, rest), {}, {
|
|
203
|
+
startAngle: startAngle,
|
|
204
|
+
endAngle: endAngle
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
var getArc = function getArc(radius, _ref3, series) {
|
|
209
|
+
var _ref3$padAngle = _ref3.padAngle,
|
|
210
|
+
padAngle = _ref3$padAngle === void 0 ? 0 : _ref3$padAngle,
|
|
211
|
+
_ref3$innerRadius = _ref3.innerRadius,
|
|
212
|
+
innerRadius = _ref3$innerRadius === void 0 ? 0 : _ref3$innerRadius,
|
|
213
|
+
_ref3$outerRadius = _ref3.outerRadius,
|
|
214
|
+
outerRadius = _ref3$outerRadius === void 0 ? 1 : _ref3$outerRadius,
|
|
215
|
+
_ref3$cornerRadius = _ref3.cornerRadius,
|
|
216
|
+
cornerRadius = _ref3$cornerRadius === void 0 ? 0 : _ref3$cornerRadius,
|
|
217
|
+
_ref3$startAngle = _ref3.startAngle,
|
|
218
|
+
startAngle = _ref3$startAngle === void 0 ? 0 : _ref3$startAngle,
|
|
219
|
+
_ref3$endAngle = _ref3.endAngle,
|
|
220
|
+
endAngle = _ref3$endAngle === void 0 ? 360 : _ref3$endAngle,
|
|
221
|
+
rest = (0, _objectWithoutProperties2["default"])(_ref3, _excluded2);
|
|
222
|
+
return _objectSpread(_objectSpread({}, rest), {}, {
|
|
223
|
+
type: 'pie',
|
|
224
|
+
fieldName: series.fieldName,
|
|
225
|
+
displayName: series.displayName || rest.data.s,
|
|
226
|
+
series: series,
|
|
227
|
+
innerRadius: innerRadius * radius,
|
|
228
|
+
outerRadius: outerRadius * radius,
|
|
229
|
+
arc: (0, _d3v.arc)().innerRadius(innerRadius * radius).outerRadius(outerRadius * radius).cornerRadius(cornerRadius).startAngle(startAngle).endAngle(endAngle).padAngle(padAngle)
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
var getCircleScale = function getCircleScale() {
|
|
234
|
+
var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : tick,
|
|
235
|
+
count = _ref4.count,
|
|
236
|
+
color = _ref4.color,
|
|
237
|
+
width = _ref4.width,
|
|
238
|
+
length = _ref4.length;
|
|
239
|
+
|
|
240
|
+
var radius = arguments.length > 1 ? arguments[1] : undefined;
|
|
241
|
+
var data = [],
|
|
242
|
+
arcs = [],
|
|
243
|
+
centroids = [];
|
|
244
|
+
|
|
245
|
+
for (var i = 0; i < count; i++) {
|
|
246
|
+
data.push(1);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
var scaleData = (0, _d3v.pie)()(data);
|
|
250
|
+
scaleData.map(function (data) {
|
|
251
|
+
var _arc = (0, _d3v.arc)().innerRadius(radius + length / 2).outerRadius(radius + length / 2).startAngle(data.startAngle).endAngle(data.endAngle);
|
|
252
|
+
|
|
253
|
+
arcs.push(_arc());
|
|
254
|
+
centroids.push(_arc.centroid());
|
|
255
|
+
});
|
|
256
|
+
return /*#__PURE__*/_react["default"].createElement("g", null, centroids.map(function (center, index) {
|
|
257
|
+
var x = center[0],
|
|
258
|
+
y = center[1];
|
|
259
|
+
var rate = length / Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
|
|
260
|
+
return /*#__PURE__*/_react["default"].createElement("path", {
|
|
261
|
+
key: index,
|
|
262
|
+
d: "M".concat(x, ",").concat(y, "l").concat(x * rate, ",").concat(y * rate),
|
|
263
|
+
strokeWidth: width,
|
|
264
|
+
stroke: color
|
|
265
|
+
});
|
|
266
|
+
}));
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
|
|
270
|
+
var _ref5$config = _ref5.config,
|
|
271
|
+
_ref5$config$chart = _ref5$config.chart,
|
|
272
|
+
_ref5$config$chart$di = _ref5$config$chart.dimension.chartDimension,
|
|
273
|
+
width = _ref5$config$chart$di.width,
|
|
274
|
+
height = _ref5$config$chart$di.height,
|
|
275
|
+
label = _ref5$config$chart.label,
|
|
276
|
+
_ref5$config$chart$le = _ref5$config$chart.legend,
|
|
277
|
+
_ref5$config$chart$le2 = _ref5$config$chart$le.formatter,
|
|
278
|
+
formatter = _ref5$config$chart$le2 === void 0 ? _formatter.pieLegendFormatter : _ref5$config$chart$le2,
|
|
279
|
+
legend = (0, _objectWithoutProperties2["default"])(_ref5$config$chart$le, _excluded3),
|
|
280
|
+
_ref5$config$chart$ma = _ref5$config$chart.margin,
|
|
281
|
+
marginLeft = _ref5$config$chart$ma.marginLeft,
|
|
282
|
+
marginTop = _ref5$config$chart$ma.marginTop,
|
|
283
|
+
_ref5$config$fan = _ref5$config.fan;
|
|
284
|
+
_ref5$config$fan = _ref5$config$fan === void 0 ? {} : _ref5$config$fan;
|
|
285
|
+
var _ref5$config$fan$char = _ref5$config$fan.chart,
|
|
286
|
+
chart = _ref5$config$fan$char === void 0 ? defaultChart : _ref5$config$fan$char,
|
|
287
|
+
_ref5$config$fan$char2 = _ref5$config$fan.chart,
|
|
288
|
+
_ref5$config$fan$char3 = _ref5$config$fan$char2.outerRadius,
|
|
289
|
+
outerRadius = _ref5$config$fan$char3 === void 0 ? defaultChart.outerRadius : _ref5$config$fan$char3,
|
|
290
|
+
padAngle = _ref5$config$fan$char2.padAngle,
|
|
291
|
+
_ref5$config$fan$angl = _ref5$config$fan.angle,
|
|
292
|
+
angle = _ref5$config$fan$angl === void 0 ? defaultAngle : _ref5$config$fan$angl,
|
|
293
|
+
_ref5$config$fan$stro = _ref5$config$fan.stroke;
|
|
294
|
+
_ref5$config$fan$stro = _ref5$config$fan$stro === void 0 ? {
|
|
295
|
+
show: false
|
|
296
|
+
} : _ref5$config$fan$stro;
|
|
297
|
+
var show = _ref5$config$fan$stro.show,
|
|
298
|
+
strokeWidth = _ref5$config$fan$stro.strokeWidth,
|
|
299
|
+
color = _ref5$config$fan$stro.color,
|
|
300
|
+
decorate = _ref5$config$fan.decorate,
|
|
301
|
+
decorate2 = _ref5$config$fan.decorate2,
|
|
302
|
+
categoryText = _ref5$config$fan.categoryText,
|
|
303
|
+
outerDecorate = _ref5$config$fan.outerDecorate,
|
|
304
|
+
current = _ref5$config$fan.current,
|
|
305
|
+
order = _ref5$config.order,
|
|
306
|
+
series = _ref5$config.series,
|
|
307
|
+
_ref5$config$animatio = _ref5$config.animation,
|
|
308
|
+
on = _ref5$config$animatio.on,
|
|
309
|
+
_ref5$config$animatio2 = _ref5$config$animatio.current,
|
|
310
|
+
_ref5$config$animatio3 = _ref5$config$animatio2.heighten,
|
|
311
|
+
heighten = _ref5$config$animatio3 === void 0 ? 0 : _ref5$config$animatio3,
|
|
312
|
+
_ref5$config$animatio4 = _ref5$config$animatio2.opacity,
|
|
313
|
+
opacity = _ref5$config$animatio4 === void 0 ? 0 : _ref5$config$animatio4,
|
|
314
|
+
_ref5$config$animatio5 = _ref5$config$animatio2.width,
|
|
315
|
+
radiusWidthAdd = _ref5$config$animatio5 === void 0 ? 0 : _ref5$config$animatio5,
|
|
316
|
+
animateColor = _ref5$config$animatio2.color,
|
|
317
|
+
animateCTS = _ref5$config$animatio2.textStyle,
|
|
318
|
+
_ref5$config$animatio6 = _ref5$config$animatio2.gap,
|
|
319
|
+
gap = _ref5$config$animatio6 === void 0 ? 0 : _ref5$config$animatio6,
|
|
320
|
+
_ref5$config$animatio7 = _ref5$config$animatio.rotate,
|
|
321
|
+
rotate = _ref5$config$animatio7 === void 0 ? 0 : _ref5$config$animatio7,
|
|
322
|
+
_ref5$state = _ref5.state,
|
|
323
|
+
currentIndex = _ref5$state.currentIndex,
|
|
324
|
+
trigger = _ref5$state.trigger,
|
|
325
|
+
onEvent = _ref5.onEvent,
|
|
326
|
+
_ref5$data = _ref5.data,
|
|
327
|
+
data = _ref5$data === void 0 ? [] : _ref5$data;
|
|
328
|
+
var prevIndex = (0, _react.useRef)(null);
|
|
329
|
+
var legendPrecision = legend.config.percent.precision;
|
|
330
|
+
|
|
331
|
+
var _useContext = (0, _react.useContext)(_context.chartContext),
|
|
332
|
+
id = _useContext.id,
|
|
333
|
+
chartWidth = _useContext.width,
|
|
334
|
+
chartHeight = _useContext.height,
|
|
335
|
+
triggerOnRelative = _useContext.triggerOnRelative,
|
|
336
|
+
onEmit = _useContext.onEmit;
|
|
337
|
+
|
|
338
|
+
var _useState = (0, _react.useState)(1),
|
|
339
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
340
|
+
y = _useState2[0],
|
|
341
|
+
setY = _useState2[1];
|
|
342
|
+
|
|
343
|
+
var radius = Math.min(chartWidth, chartHeight) / 2 * outerRadius;
|
|
344
|
+
var arcsFunc = (0, _react.useMemo)(function () {
|
|
345
|
+
var _getAngle = getAngle(angle),
|
|
346
|
+
_getAngle$startAngle = _getAngle.startAngle,
|
|
347
|
+
startAngle = _getAngle$startAngle === void 0 ? 0 : _getAngle$startAngle,
|
|
348
|
+
_getAngle$endAngle = _getAngle.endAngle,
|
|
349
|
+
endAngle = _getAngle$endAngle === void 0 ? 360 : _getAngle$endAngle;
|
|
350
|
+
|
|
351
|
+
var arcsFunc = (0, _d3v.pie)().startAngle(startAngle * PI / 180).endAngle(endAngle * PI / 180).value(function (d) {
|
|
352
|
+
return d.y;
|
|
353
|
+
});
|
|
354
|
+
return arcsFunc;
|
|
355
|
+
}, [angle]);
|
|
356
|
+
var arcs = (0, _react.useMemo)(function () {
|
|
357
|
+
var _chart = Object.assign(defaultChart, chart);
|
|
358
|
+
|
|
359
|
+
var innerRadius = _chart.innerRadius,
|
|
360
|
+
outerRadius = _chart.outerRadius,
|
|
361
|
+
rose = _chart.rose,
|
|
362
|
+
cornerRadius = _chart.cornerRadius,
|
|
363
|
+
padAngle = _chart.padAngle,
|
|
364
|
+
roseType = _chart.roseType;
|
|
365
|
+
|
|
366
|
+
var _padAngle = padAngle * Math.PI / 180;
|
|
367
|
+
|
|
368
|
+
switch (order) {
|
|
369
|
+
case '':
|
|
370
|
+
arcsFunc.sort(null);
|
|
371
|
+
break;
|
|
372
|
+
|
|
373
|
+
case 'desc':
|
|
374
|
+
arcsFunc.sort(function (a, b) {
|
|
375
|
+
return b.y - a.y;
|
|
376
|
+
});
|
|
377
|
+
break;
|
|
378
|
+
|
|
379
|
+
case 'asc':
|
|
380
|
+
arcsFunc.sort(function (a, b) {
|
|
381
|
+
return a.y - b.y;
|
|
382
|
+
});
|
|
383
|
+
break;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
var arcs = arcsFunc(data);
|
|
387
|
+
var legendDataWithPercent = (0, _utils.getDataWithPercent)(arcs, legendPrecision);
|
|
388
|
+
|
|
389
|
+
var _legendDataWithPercent = (0, _utils.sortPie)(legendDataWithPercent, order);
|
|
390
|
+
|
|
391
|
+
if (rose) {
|
|
392
|
+
var domain = (0, _d3v.extent)(_legendDataWithPercent, function (d) {
|
|
393
|
+
return d.value;
|
|
394
|
+
});
|
|
395
|
+
var roseRadius = getRoseRadius(_chart);
|
|
396
|
+
var scaler = (0, _d3v.scaleLinear)().domain(domain).range([roseRadius, 1]);
|
|
397
|
+
|
|
398
|
+
var _angle = PI * 2 / _legendDataWithPercent.length;
|
|
399
|
+
|
|
400
|
+
return _legendDataWithPercent.map(function (_ref6, index) {
|
|
401
|
+
var startAngle = _ref6.startAngle,
|
|
402
|
+
endAngle = _ref6.endAngle,
|
|
403
|
+
arc = (0, _objectWithoutProperties2["default"])(_ref6, _excluded4);
|
|
404
|
+
return _objectSpread(_objectSpread({}, arc), {}, {
|
|
405
|
+
id: id + '_linear_' + index,
|
|
406
|
+
startAngle: roseType == 'area' ? _angle * index : startAngle,
|
|
407
|
+
endAngle: roseType == 'area' ? _angle * (index + 1) : endAngle,
|
|
408
|
+
cornerRadius: cornerRadius,
|
|
409
|
+
padAngle: _padAngle,
|
|
410
|
+
innerRadius: innerRadius,
|
|
411
|
+
outerRadius: scaler(arc.value)
|
|
412
|
+
});
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
return _legendDataWithPercent.map(function (arc, index) {
|
|
417
|
+
return _objectSpread(_objectSpread({}, arc), {}, {
|
|
418
|
+
id: id + '_linear_' + index,
|
|
419
|
+
cornerRadius: cornerRadius,
|
|
420
|
+
padAngle: _padAngle,
|
|
421
|
+
innerRadius: innerRadius,
|
|
422
|
+
outerRadius: outerRadius
|
|
423
|
+
});
|
|
424
|
+
});
|
|
425
|
+
}, [data, arcsFunc, chart, legendPrecision]);
|
|
426
|
+
|
|
427
|
+
var _arcs = (0, _react.useMemo)(function () {
|
|
428
|
+
var seriesLength = series.size;
|
|
429
|
+
if (!seriesLength) return [];
|
|
430
|
+
|
|
431
|
+
var _series = (0, _toConsumableArray2["default"])(series.values());
|
|
432
|
+
|
|
433
|
+
return arcs.map(function (arc, index) {
|
|
434
|
+
return getArc(radius, arc, _series[index]);
|
|
435
|
+
});
|
|
436
|
+
}, [series, arcs, radius]);
|
|
437
|
+
|
|
438
|
+
var onClick = (0, _react.useCallback)(function (e) {
|
|
439
|
+
return onEvent({
|
|
440
|
+
currentIndex: +e.currentTarget.dataset.index,
|
|
441
|
+
type: 'onClick'
|
|
442
|
+
});
|
|
443
|
+
}, [onEvent]);
|
|
444
|
+
var onMouseEnter = (0, _react.useCallback)(function (e) {
|
|
445
|
+
return onEvent({
|
|
446
|
+
currentIndex: +e.currentTarget.dataset.index,
|
|
447
|
+
type: 'onMouseEnter'
|
|
448
|
+
});
|
|
449
|
+
}, [onEvent]);
|
|
450
|
+
var onMouseLeave = (0, _react.useCallback)(function (e) {
|
|
451
|
+
return onEvent({
|
|
452
|
+
currentIndex: +e.currentTarget.dataset.index,
|
|
453
|
+
type: 'onMouseLeave'
|
|
454
|
+
});
|
|
455
|
+
}, [onEvent]);
|
|
456
|
+
(0, _react.useLayoutEffect)(function () {
|
|
457
|
+
var animation;
|
|
458
|
+
|
|
459
|
+
if (!!on) {
|
|
460
|
+
animation = (0, _popmotion.animate)({
|
|
461
|
+
from: 0,
|
|
462
|
+
to: 1,
|
|
463
|
+
duration: 500,
|
|
464
|
+
ease: _popmotion.linear,
|
|
465
|
+
onPlay: function onPlay() {},
|
|
466
|
+
onUpdate: function onUpdate(v) {
|
|
467
|
+
setY(v);
|
|
468
|
+
},
|
|
469
|
+
onComplete: function onComplete() {
|
|
470
|
+
var _data = arcs[+currentIndex].data;
|
|
471
|
+
triggerOnRelative(_data);
|
|
472
|
+
onEmit('carousel', _data);
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
} else {
|
|
476
|
+
if (currentIndex !== null && trigger === 'onClick') {
|
|
477
|
+
var _data = arcs[+currentIndex].data;
|
|
478
|
+
triggerOnRelative(_data);
|
|
479
|
+
onEmit(trigger, _data);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
return function () {
|
|
484
|
+
prevIndex.current = currentIndex;
|
|
485
|
+
animation && animation.stop();
|
|
486
|
+
animation = null;
|
|
487
|
+
};
|
|
488
|
+
}, [JSON.stringify(arcs), on, currentIndex, trigger, onEmit, triggerOnRelative]);
|
|
489
|
+
var halfChartWidth = chartWidth / 2;
|
|
490
|
+
var halfChartHeight = chartHeight / 2;
|
|
491
|
+
var rotate_ = decorate2 ? -(arcs[+currentIndex].startAngle + arcs[+currentIndex].endAngle) * 90 / Math.PI + rotate : 0;
|
|
492
|
+
var maxRadius = 0;
|
|
493
|
+
|
|
494
|
+
_arcs.map(function (d) {
|
|
495
|
+
maxRadius = Math.max(maxRadius, d.outerRadius);
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
var centerRadius = 0.5 * maxRadius + 0.5 * _arcs[0].innerRadius;
|
|
499
|
+
return outerDecorate ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_.ChartContainer //用于生成甜甜圈图,判断依据是外环装饰这个配置项(outerDecorate)
|
|
500
|
+
, {
|
|
501
|
+
width: width,
|
|
502
|
+
height: height,
|
|
503
|
+
marginLeft: marginLeft,
|
|
504
|
+
marginTop: marginTop
|
|
505
|
+
}, /*#__PURE__*/_react["default"].createElement("g", {
|
|
506
|
+
style: {
|
|
507
|
+
transition: 'transform ease-in-out 0.3s',
|
|
508
|
+
transform: 'translate(' + halfChartWidth + 'px, ' + halfChartHeight + 'px) rotate(' + rotate_ + 'deg)'
|
|
509
|
+
}
|
|
510
|
+
}, //用于生成外环装饰的刻度
|
|
511
|
+
outerDecorate.tick.show && getCircleScale(outerDecorate.tick, maxRadius), /*#__PURE__*/_react["default"].createElement("circle", {
|
|
512
|
+
//外环装饰
|
|
513
|
+
cx: "0",
|
|
514
|
+
cy: "0",
|
|
515
|
+
r: maxRadius + 2,
|
|
516
|
+
fill: "none",
|
|
517
|
+
stroke: outerDecorate.color,
|
|
518
|
+
strokeWidth: outerDecorate.width
|
|
519
|
+
}), _arcs.map(function (_ref7, index) {
|
|
520
|
+
var id = _ref7.id,
|
|
521
|
+
value = _ref7.value,
|
|
522
|
+
series = _ref7.series,
|
|
523
|
+
arc = _ref7.arc,
|
|
524
|
+
innerRadius = _ref7.innerRadius,
|
|
525
|
+
outerRadius = _ref7.outerRadius,
|
|
526
|
+
dataIndex = _ref7.index;
|
|
527
|
+
var arcWidth = outerRadius - innerRadius;
|
|
528
|
+
var path = arc.innerRadius(centerRadius).outerRadius(centerRadius)(value);
|
|
529
|
+
var dashLength = Math.ceil(Math.PI * centerRadius * 2 / _arcs.length);
|
|
530
|
+
var pie = (0, _utils.getColorList)(series.color);
|
|
531
|
+
return /*#__PURE__*/_react["default"].createElement(_react.Fragment, {
|
|
532
|
+
key: index
|
|
533
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
534
|
+
className: _piechartModule["default"]['inner-arc'],
|
|
535
|
+
style: {
|
|
536
|
+
strokeDasharray: "".concat(dashLength, ",").concat(2 * dashLength),
|
|
537
|
+
strokeDashoffset: dashLength,
|
|
538
|
+
animationDelay: "".concat(index * 2000, "ms")
|
|
539
|
+
},
|
|
540
|
+
"data-index": dataIndex,
|
|
541
|
+
onClick: onClick,
|
|
542
|
+
onMouseEnter: onMouseEnter,
|
|
543
|
+
onMouseLeave: onMouseLeave,
|
|
544
|
+
d: path.split('L')[0],
|
|
545
|
+
stroke: 'url(#' + id + ')',
|
|
546
|
+
strokeWidth: arcWidth,
|
|
547
|
+
fill: "none"
|
|
548
|
+
}), /*#__PURE__*/_react["default"].createElement("defs", null, /*#__PURE__*/_react["default"].createElement(_LinearGradient["default"], {
|
|
549
|
+
id: id,
|
|
550
|
+
colors: pie,
|
|
551
|
+
rotate: series.color.linear.angle + 180 // gradientUnits='objectBoundingBox'
|
|
552
|
+
|
|
553
|
+
})));
|
|
554
|
+
}), label && /*#__PURE__*/_react["default"].createElement(RingLabel, {
|
|
555
|
+
config: _objectSpread(_objectSpread({}, label), {}, {
|
|
556
|
+
maxRadius: maxRadius + 2
|
|
557
|
+
}),
|
|
558
|
+
arcs: _arcs
|
|
559
|
+
}))), /*#__PURE__*/_react["default"].createElement(_.Legend, (0, _extends2["default"])({}, legend, {
|
|
560
|
+
series: _arcs,
|
|
561
|
+
formatter: formatter
|
|
562
|
+
}))) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_.ChartContainer, {
|
|
563
|
+
width: width,
|
|
564
|
+
height: height,
|
|
565
|
+
marginLeft: marginLeft,
|
|
566
|
+
marginTop: marginTop
|
|
567
|
+
}, /*#__PURE__*/_react["default"].createElement("g", {
|
|
568
|
+
style: {
|
|
569
|
+
transition: 'transform ease-in-out 0.3s',
|
|
570
|
+
transform: 'translate(' + halfChartWidth + 'px, ' + halfChartHeight + 'px) rotate(' + rotate_ + 'deg)'
|
|
571
|
+
}
|
|
572
|
+
}, _arcs.map(function (_ref8, index) {
|
|
573
|
+
var id = _ref8.id,
|
|
574
|
+
value = _ref8.value,
|
|
575
|
+
series = _ref8.series,
|
|
576
|
+
arc = _ref8.arc,
|
|
577
|
+
innerRadius = _ref8.innerRadius,
|
|
578
|
+
outerRadius = _ref8.outerRadius,
|
|
579
|
+
dataIndex = _ref8.index;
|
|
580
|
+
var current = index == currentIndex;
|
|
581
|
+
var prev = index == prevIndex.current;
|
|
582
|
+
var offset = current ? y : prev ? 1 - y : 0;
|
|
583
|
+
var fillOpacity = animateColor ? 1 : current ? opacity / 100 : 1;
|
|
584
|
+
var deltaHeighten = offset * heighten;
|
|
585
|
+
var path = arc.innerRadius(innerRadius + deltaHeighten).outerRadius(outerRadius + deltaHeighten)(value);
|
|
586
|
+
var pie = (0, _utils.getColorList)(series.color);
|
|
587
|
+
var currentPie = animateColor ? (0, _utils.getColorList)(animateColor) : (0, _utils.getColorList)(series.color);
|
|
588
|
+
var textPath = '',
|
|
589
|
+
categoryTextStyle = {};
|
|
590
|
+
|
|
591
|
+
if (categoryText && categoryText.show) {
|
|
592
|
+
//如果有类目文本,则需要计算文字路径
|
|
593
|
+
//let offsetWidth=decorate2.radiusWidth/2 + radiusWidthAdd/2; //当前文字需生成在装饰物内,故而半径需要减小
|
|
594
|
+
var textArc = arc.innerRadius(outerRadius + (current ? gap : categoryText.gap)).outerRadius(outerRadius + (current ? gap : categoryText.gap))(value);
|
|
595
|
+
var lastA = textArc.lastIndexOf('A');
|
|
596
|
+
textPath = textArc.slice(0, lastA > 0 ? lastA : textArc.length); //文字路径
|
|
597
|
+
|
|
598
|
+
categoryTextStyle = current ? animateCTS : categoryText.textStyle; //这里把textstyle拿出来
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
return /*#__PURE__*/_react["default"].createElement(_react.Fragment, {
|
|
602
|
+
key: index
|
|
603
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
604
|
+
"data-index": dataIndex,
|
|
605
|
+
onClick: onClick,
|
|
606
|
+
onMouseEnter: onMouseEnter,
|
|
607
|
+
onMouseLeave: onMouseLeave,
|
|
608
|
+
d: path,
|
|
609
|
+
stroke: show ? color : 'none',
|
|
610
|
+
strokeWidth: show ? strokeWidth : '0',
|
|
611
|
+
fill: 'url(#' + id + ')',
|
|
612
|
+
fillOpacity: fillOpacity
|
|
613
|
+
}), //装饰物2,产生于每个弧的外部
|
|
614
|
+
decorate2 && decorate2.show && /*#__PURE__*/_react["default"].createElement("path", {
|
|
615
|
+
"data-index": dataIndex,
|
|
616
|
+
onClick: onClick,
|
|
617
|
+
onMouseEnter: onMouseEnter,
|
|
618
|
+
onMouseLeave: onMouseLeave,
|
|
619
|
+
d: arc.innerRadius(outerRadius).outerRadius(outerRadius + decorate2.radiusWidth + (current ? radiusWidthAdd : 0))(value),
|
|
620
|
+
stroke: show ? color : 'none',
|
|
621
|
+
strokeWidth: show ? strokeWidth : '0',
|
|
622
|
+
fill: 'url(#' + id + ')',
|
|
623
|
+
fillOpacity: decorate2.opacity / 100
|
|
624
|
+
}), //类目文本
|
|
625
|
+
categoryText && categoryText.show && /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("path", {
|
|
626
|
+
onClick: onClick,
|
|
627
|
+
onMouseEnter: onMouseEnter,
|
|
628
|
+
onMouseLeave: onMouseLeave,
|
|
629
|
+
id: id + '_text_' + index,
|
|
630
|
+
d: textPath,
|
|
631
|
+
fill: "none",
|
|
632
|
+
stroke: "none"
|
|
633
|
+
}), /*#__PURE__*/_react["default"].createElement("text", {
|
|
634
|
+
textAnchor: "middle",
|
|
635
|
+
style: _objectSpread(_objectSpread({}, categoryTextStyle), {}, {
|
|
636
|
+
fontWeight: categoryTextStyle.bold ? 'bold' : 'normal',
|
|
637
|
+
fontStyle: categoryTextStyle.italic ? 'italic' : 'normal',
|
|
638
|
+
pointerEvents: 'none'
|
|
639
|
+
}),
|
|
640
|
+
fill: categoryTextStyle.color
|
|
641
|
+
}, /*#__PURE__*/_react["default"].createElement("textPath", {
|
|
642
|
+
startOffset: "50%",
|
|
643
|
+
href: '#' + id + '_text_' + index
|
|
644
|
+
}, _arcs[index].displayName || _arcs[index].fieldName))), /*#__PURE__*/_react["default"].createElement("defs", null, /*#__PURE__*/_react["default"].createElement(_LinearGradient["default"], {
|
|
645
|
+
id: id,
|
|
646
|
+
colors: current ? currentPie : pie,
|
|
647
|
+
rotate: current ? animateColor ? animateColor.linear.angle + 180 : series.color.linear.angle + 180 : series.color.linear.angle + 180 // gradientUnits='objectBoundingBox'
|
|
648
|
+
|
|
649
|
+
})));
|
|
650
|
+
}), label && /*#__PURE__*/_react["default"].createElement(Label, {
|
|
651
|
+
config: label,
|
|
652
|
+
arcs: _arcs
|
|
653
|
+
}), current && /*#__PURE__*/_react["default"].createElement("g", {
|
|
654
|
+
fillOpacity: y,
|
|
655
|
+
style: {
|
|
656
|
+
transform: 'rotate(' + -rotate_ + 'deg)'
|
|
657
|
+
}
|
|
658
|
+
}, /*#__PURE__*/_react["default"].createElement(Current, {
|
|
659
|
+
config: current,
|
|
660
|
+
width: width,
|
|
661
|
+
height: height,
|
|
662
|
+
data: _arcs,
|
|
663
|
+
currentIndex: +currentIndex
|
|
664
|
+
})))), decorate && /*#__PURE__*/_react["default"].createElement(_.ConicalGradient, {
|
|
665
|
+
width: width,
|
|
666
|
+
height: height,
|
|
667
|
+
centerX: halfChartWidth + marginLeft,
|
|
668
|
+
centerY: halfChartHeight + marginTop,
|
|
669
|
+
config: decorate,
|
|
670
|
+
arcs: _arcs,
|
|
671
|
+
radius: radius
|
|
672
|
+
}), /*#__PURE__*/_react["default"].createElement(_.Legend, (0, _extends2["default"])({}, legend, {
|
|
673
|
+
series: _arcs,
|
|
674
|
+
formatter: formatter
|
|
675
|
+
})));
|
|
676
|
+
});
|
|
677
|
+
|
|
678
|
+
var Current = function Current(_ref9) {
|
|
679
|
+
var _ref9$config = _ref9.config,
|
|
680
|
+
show = _ref9$config.show,
|
|
681
|
+
gap = _ref9$config.gap,
|
|
682
|
+
_ref9$config$name = _ref9$config.name,
|
|
683
|
+
showName = _ref9$config$name.show,
|
|
684
|
+
nameColor = _ref9$config$name.sameColor,
|
|
685
|
+
nameFont = _ref9$config$name.font,
|
|
686
|
+
textBreak = _ref9$config$name.textBreak,
|
|
687
|
+
_ref9$config$percent = _ref9$config.percent,
|
|
688
|
+
showPercent = _ref9$config$percent.show,
|
|
689
|
+
percentColor = _ref9$config$percent.sameColor,
|
|
690
|
+
percentFont = _ref9$config$percent.font,
|
|
691
|
+
precision = _ref9$config$percent.precision,
|
|
692
|
+
_ref9$config$percent$ = _ref9$config$percent.translate,
|
|
693
|
+
translatePercentX = _ref9$config$percent$.x,
|
|
694
|
+
translatePercentY = _ref9$config$percent$.y,
|
|
695
|
+
_ref9$config$value = _ref9$config.value,
|
|
696
|
+
showValue = _ref9$config$value.show,
|
|
697
|
+
valueColor = _ref9$config$value.sameColor,
|
|
698
|
+
valueFont = _ref9$config$value.font,
|
|
699
|
+
_ref9$config$value$tr = _ref9$config$value.translate,
|
|
700
|
+
translateValueX = _ref9$config$value$tr.x,
|
|
701
|
+
translateValueY = _ref9$config$value$tr.y,
|
|
702
|
+
_ref9$config$value$su = _ref9$config$value.suffix,
|
|
703
|
+
showSuffix = _ref9$config$value$su.show,
|
|
704
|
+
fontSize = _ref9$config$value$su.fontSize,
|
|
705
|
+
text = _ref9$config$value$su.text,
|
|
706
|
+
_ref9$config$value$su2 = _ref9$config$value$su.translate,
|
|
707
|
+
translateSuffixX = _ref9$config$value$su2.x,
|
|
708
|
+
translateSuffixY = _ref9$config$value$su2.y,
|
|
709
|
+
width = _ref9.width,
|
|
710
|
+
height = _ref9.height,
|
|
711
|
+
data = _ref9.data,
|
|
712
|
+
currentIndex = _ref9.currentIndex;
|
|
713
|
+
|
|
714
|
+
var _data = (0, _react.useMemo)(function () {
|
|
715
|
+
var legendDataWithPercent = (0, _utils.getDataWithPercent)(data, precision);
|
|
716
|
+
return (0, _utils.sortPie)(legendDataWithPercent, '');
|
|
717
|
+
}, [data, precision]);
|
|
718
|
+
|
|
719
|
+
var currentData = _data[currentIndex];
|
|
720
|
+
if (!currentData) return null;
|
|
721
|
+
var displayName = currentData.displayName,
|
|
722
|
+
fieldName = currentData.fieldName,
|
|
723
|
+
value = currentData.value,
|
|
724
|
+
percent = currentData.percent;
|
|
725
|
+
var nameTemp = displayName ? displayName : fieldName; //类目名
|
|
726
|
+
|
|
727
|
+
var nameList = [];
|
|
728
|
+
|
|
729
|
+
if (textBreak) {
|
|
730
|
+
//如果限制了首行字符,则切割组件
|
|
731
|
+
while (nameTemp.length > textBreak) {
|
|
732
|
+
nameList.push(nameTemp.slice(0, textBreak));
|
|
733
|
+
nameTemp = nameTemp.slice(textBreak);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
nameList.push(nameTemp);
|
|
738
|
+
var foreignStyle = {
|
|
739
|
+
//foreignObject标签样式,
|
|
740
|
+
width: width,
|
|
741
|
+
height: height,
|
|
742
|
+
transform: "translate(-".concat(width / 2, "px,-").concat(height / 2, "px)"),
|
|
743
|
+
pointerEvents: 'none'
|
|
744
|
+
},
|
|
745
|
+
boxStyle = {
|
|
746
|
+
//弹性盒子样式,用于当前值的上下居中对齐等
|
|
747
|
+
width: width,
|
|
748
|
+
height: height,
|
|
749
|
+
display: 'flex',
|
|
750
|
+
flexDirection: 'column',
|
|
751
|
+
justifyContent: 'center',
|
|
752
|
+
alignItems: 'center'
|
|
753
|
+
};
|
|
754
|
+
var seriesColor = currentData.series.color;
|
|
755
|
+
seriesColor = seriesColor.type == 'pure' ? seriesColor.pure : seriesColor.linear.stops[0].color;
|
|
756
|
+
return show && /*#__PURE__*/_react["default"].createElement("foreignObject", {
|
|
757
|
+
style: foreignStyle
|
|
758
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
759
|
+
style: boxStyle
|
|
760
|
+
}, //类目名称
|
|
761
|
+
showName && /*#__PURE__*/_react["default"].createElement("div", {
|
|
762
|
+
style: _objectSpread(_objectSpread({}, (0, _utils.getFontStyle)(nameFont)), {}, {
|
|
763
|
+
margin: gap / 2 + 'px 0',
|
|
764
|
+
display: 'flex',
|
|
765
|
+
flexDirection: 'column',
|
|
766
|
+
alignItems: 'center',
|
|
767
|
+
color: nameColor ? seriesColor : nameFont.color
|
|
768
|
+
})
|
|
769
|
+
}, nameList.map(function (d, i) {
|
|
770
|
+
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
771
|
+
key: i
|
|
772
|
+
}, d);
|
|
773
|
+
})), //真实值
|
|
774
|
+
showValue && /*#__PURE__*/_react["default"].createElement("span", {
|
|
775
|
+
style: _objectSpread(_objectSpread({}, (0, _utils.getFontStyle)(valueFont)), {}, {
|
|
776
|
+
transform: 'translate(' + translateValueX + 'px,' + translateValueY + 'px)',
|
|
777
|
+
margin: gap / 2 + 'px 0',
|
|
778
|
+
color: valueColor ? seriesColor : valueFont.color
|
|
779
|
+
})
|
|
780
|
+
}, value, showSuffix && text && /*#__PURE__*/_react["default"].createElement("span", {
|
|
781
|
+
style: {
|
|
782
|
+
transform: 'translate(' + translateSuffixX + 'px,' + translateSuffixY + 'px)',
|
|
783
|
+
fontSize: fontSize
|
|
784
|
+
}
|
|
785
|
+
}, text)), //百分比值
|
|
786
|
+
showPercent && /*#__PURE__*/_react["default"].createElement("span", {
|
|
787
|
+
style: _objectSpread(_objectSpread({
|
|
788
|
+
transform: 'translate(' + translatePercentX + 'px,' + translatePercentY + 'px)'
|
|
789
|
+
}, (0, _utils.getFontStyle)(percentFont)), {}, {
|
|
790
|
+
margin: gap / 2 + 'px 0',
|
|
791
|
+
color: percentColor ? seriesColor : percentFont.color
|
|
792
|
+
})
|
|
793
|
+
}, percent + '%')));
|
|
794
|
+
};
|
|
795
|
+
|
|
796
|
+
var Label = function Label(_ref10) {
|
|
797
|
+
var _ref10$config = _ref10.config,
|
|
798
|
+
_ref10$config$maxRadi = _ref10$config.maxRadius,
|
|
799
|
+
maxRadius = _ref10$config$maxRadi === void 0 ? 0 : _ref10$config$maxRadi,
|
|
800
|
+
lineLength = _ref10$config.lineLength,
|
|
801
|
+
lineColor = _ref10$config.lineColor,
|
|
802
|
+
distance = _ref10$config.distance,
|
|
803
|
+
mode = _ref10$config.mode,
|
|
804
|
+
show = _ref10$config.show,
|
|
805
|
+
_ref10$config$transla = _ref10$config.translate,
|
|
806
|
+
translateX = _ref10$config$transla.x,
|
|
807
|
+
translateY = _ref10$config$transla.y,
|
|
808
|
+
_ref10$config$name = _ref10$config.name,
|
|
809
|
+
showName = _ref10$config$name.show,
|
|
810
|
+
nameFont = _ref10$config$name.font,
|
|
811
|
+
_ref10$config$value = _ref10$config.value,
|
|
812
|
+
showValue = _ref10$config$value.show,
|
|
813
|
+
valueFont = _ref10$config$value.font,
|
|
814
|
+
_ref10$config$value$s = _ref10$config$value.suffix,
|
|
815
|
+
showSuffix = _ref10$config$value$s.show,
|
|
816
|
+
text = _ref10$config$value$s.text,
|
|
817
|
+
suffixFontSize = _ref10$config$value$s.fontSize,
|
|
818
|
+
_ref10$config$value$s2 = _ref10$config$value$s.translate,
|
|
819
|
+
suffixTranslateX = _ref10$config$value$s2.x,
|
|
820
|
+
suffixTranslateY = _ref10$config$value$s2.y,
|
|
821
|
+
_ref10$config$value$s3 = _ref10$config$value.sameColor,
|
|
822
|
+
valueSameColor = _ref10$config$value$s3 === void 0 ? false : _ref10$config$value$s3,
|
|
823
|
+
_ref10$config$percent = _ref10$config.percent,
|
|
824
|
+
showPercent = _ref10$config$percent.show,
|
|
825
|
+
percentFont = _ref10$config$percent.font,
|
|
826
|
+
precision = _ref10$config$percent.precision,
|
|
827
|
+
_ref10$config$percent2 = _ref10$config$percent.sameColor,
|
|
828
|
+
percentSameColor = _ref10$config$percent2 === void 0 ? false : _ref10$config$percent2,
|
|
829
|
+
arcs = _ref10.arcs,
|
|
830
|
+
animation = _ref10.animation;
|
|
831
|
+
|
|
832
|
+
// const [labels, setLabels] = useState(null);
|
|
833
|
+
// const [opacity, setOpacity] = useState(0);
|
|
834
|
+
var _arcs = (0, _react.useMemo)(function () {
|
|
835
|
+
return (0, _utils.getDataWithPercent)(arcs, precision);
|
|
836
|
+
}, [arcs, precision]); // useEffect(() => {
|
|
837
|
+
// if (labels) {
|
|
838
|
+
// const children = [...labels.children];
|
|
839
|
+
// const bbox = children.reduce(
|
|
840
|
+
// (prev, current) => {
|
|
841
|
+
// const { topRight, bottomRight, bottomLeft, topLeft } = prev;
|
|
842
|
+
// const { x, y, height } = current.getBBox();
|
|
843
|
+
// current._y1 = y;
|
|
844
|
+
// current._y2 = y + height;
|
|
845
|
+
// current._delta = 0;
|
|
846
|
+
// if (x > 0) {
|
|
847
|
+
// if (y > 0) {
|
|
848
|
+
// bottomRight.push(current);
|
|
849
|
+
// } else {
|
|
850
|
+
// topRight.push(current);
|
|
851
|
+
// }
|
|
852
|
+
// } else {
|
|
853
|
+
// if (y > 0) {
|
|
854
|
+
// bottomLeft.push(current);
|
|
855
|
+
// } else {
|
|
856
|
+
// topLeft.push(current);
|
|
857
|
+
// }
|
|
858
|
+
// }
|
|
859
|
+
// return prev;
|
|
860
|
+
// },
|
|
861
|
+
// {
|
|
862
|
+
// topRight: [],
|
|
863
|
+
// bottomRight: [],
|
|
864
|
+
// bottomLeft: [],
|
|
865
|
+
// topLeft: [],
|
|
866
|
+
// }
|
|
867
|
+
// );
|
|
868
|
+
// console.log('bbox: ', bbox);
|
|
869
|
+
// }
|
|
870
|
+
// }, [labels]);
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
return /*#__PURE__*/_react["default"].createElement("g", null, _arcs.map(function (_ref11, index) {
|
|
874
|
+
var _ref11$series$color = _ref11.series.color,
|
|
875
|
+
type = _ref11$series$color.type,
|
|
876
|
+
pure = _ref11$series$color.pure,
|
|
877
|
+
stops = _ref11$series$color.linear.stops,
|
|
878
|
+
displayName = _ref11.displayName,
|
|
879
|
+
value = _ref11.value,
|
|
880
|
+
percent = _ref11.percent,
|
|
881
|
+
arc = _ref11.arc,
|
|
882
|
+
outerRadius = _ref11.outerRadius,
|
|
883
|
+
actualIndex = _ref11.index;
|
|
884
|
+
|
|
885
|
+
var _arc$centroid = arc.centroid(),
|
|
886
|
+
_arc$centroid2 = (0, _slicedToArray2["default"])(_arc$centroid, 2),
|
|
887
|
+
x = _arc$centroid2[0],
|
|
888
|
+
y = _arc$centroid2[1];
|
|
889
|
+
|
|
890
|
+
var midAngle = Math.atan2(y, x);
|
|
891
|
+
|
|
892
|
+
var _getCoord = getCoord(midAngle, maxRadius ? maxRadius : outerRadius),
|
|
893
|
+
_getCoord2 = (0, _slicedToArray2["default"])(_getCoord, 2),
|
|
894
|
+
x1 = _getCoord2[0],
|
|
895
|
+
y1 = _getCoord2[1];
|
|
896
|
+
|
|
897
|
+
var radius = (maxRadius ? maxRadius : outerRadius) + distance;
|
|
898
|
+
|
|
899
|
+
var _getCoord3 = getCoord(midAngle, radius),
|
|
900
|
+
_getCoord4 = (0, _slicedToArray2["default"])(_getCoord3, 2),
|
|
901
|
+
x2 = _getCoord4[0],
|
|
902
|
+
y2 = _getCoord4[1];
|
|
903
|
+
|
|
904
|
+
var direction = x2 < 0 ? -1 : 1;
|
|
905
|
+
var x3 = x2 + lineLength * direction;
|
|
906
|
+
|
|
907
|
+
var _x = x3 + (translateX + 6) * direction;
|
|
908
|
+
|
|
909
|
+
var _showName = showName && displayName;
|
|
910
|
+
|
|
911
|
+
var _showValue = showValue && (value || showSuffix);
|
|
912
|
+
|
|
913
|
+
return show && (_showName || showPercent || showValue) && /*#__PURE__*/_react["default"].createElement("g", {
|
|
914
|
+
key: index
|
|
915
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
916
|
+
className: animation ? _piechartModule["default"]['label-line'] : '',
|
|
917
|
+
style: {
|
|
918
|
+
animationDelay: "".concat(animation ? (actualIndex + 1) * 2000 - 800 : 0, "ms")
|
|
919
|
+
},
|
|
920
|
+
d: 'M' + x1 + ', ' + y1 + 'L' + x2 + ', ' + y2 + 'L' + x3 + ', ' + y2,
|
|
921
|
+
stroke: lineColor ? lineColor : type == 'pure' ? pure : stops[0].color,
|
|
922
|
+
fill: "none"
|
|
923
|
+
}), /*#__PURE__*/_react["default"].createElement("text", {
|
|
924
|
+
className: animation ? _piechartModule["default"]['label-text'] : '',
|
|
925
|
+
style: {
|
|
926
|
+
animationDelay: "".concat(animation ? (actualIndex + 1) * 2000 - 800 : 0, "ms")
|
|
927
|
+
},
|
|
928
|
+
x: _x,
|
|
929
|
+
y: y2 + translateY,
|
|
930
|
+
dominantBaseline: "middle",
|
|
931
|
+
textAnchor: x3 >= 0 ? 'start' : 'end'
|
|
932
|
+
}, _showName && /*#__PURE__*/_react["default"].createElement("tspan", {
|
|
933
|
+
style: (0, _utils.getFontStyle)(nameFont, 'svg')
|
|
934
|
+
}, displayName + (showValue || showPercent ? ':' : '')), showValue && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("tspan", {
|
|
935
|
+
x: !!(_showName && mode == 'vertical') ? _x : '',
|
|
936
|
+
dx: valueDx(_showName, mode),
|
|
937
|
+
dy: !!(_showName && mode == 'vertical') ? '1.5em' : '',
|
|
938
|
+
style: (0, _utils.getFontStyle)(valueFont, 'svg')
|
|
939
|
+
}, value), showSuffix && /*#__PURE__*/_react["default"].createElement("tspan", {
|
|
940
|
+
style: _objectSpread(_objectSpread({}, (0, _utils.getFontStyle)(valueFont, 'svg')), {}, {
|
|
941
|
+
fontSize: suffixFontSize
|
|
942
|
+
}),
|
|
943
|
+
dx: suffixTranslateX,
|
|
944
|
+
dy: suffixTranslateY
|
|
945
|
+
}, text)), showPercent && /*#__PURE__*/_react["default"].createElement("tspan", {
|
|
946
|
+
x: percentX(_showName, _showValue, mode, _x),
|
|
947
|
+
dx: percentDx(_showName, _showValue, mode),
|
|
948
|
+
dy: percentDy(_showName, _showValue, mode) + (_showValue && showSuffix ? suffixTranslateY * -1 : ''),
|
|
949
|
+
style: (0, _utils.getFontStyle)(percentFont, 'svg')
|
|
950
|
+
}, (_showValue ? '(' : '') + percent + '%' + (_showValue ? ')' : ''))));
|
|
951
|
+
}));
|
|
952
|
+
};
|
|
953
|
+
|
|
954
|
+
var RingLabel = function RingLabel(_ref12) {
|
|
955
|
+
var _ref12$config = _ref12.config,
|
|
956
|
+
_ref12$config$maxRadi = _ref12$config.maxRadius,
|
|
957
|
+
maxRadius = _ref12$config$maxRadi === void 0 ? 0 : _ref12$config$maxRadi,
|
|
958
|
+
lineLength = _ref12$config.lineLength,
|
|
959
|
+
lineColor = _ref12$config.lineColor,
|
|
960
|
+
distance = _ref12$config.distance,
|
|
961
|
+
mode = _ref12$config.mode,
|
|
962
|
+
show = _ref12$config.show,
|
|
963
|
+
_ref12$config$transla = _ref12$config.translate,
|
|
964
|
+
translateX = _ref12$config$transla.x,
|
|
965
|
+
translateY = _ref12$config$transla.y,
|
|
966
|
+
_ref12$config$name = _ref12$config.name,
|
|
967
|
+
showName = _ref12$config$name.show,
|
|
968
|
+
nameFont = _ref12$config$name.font,
|
|
969
|
+
_ref12$config$value = _ref12$config.value,
|
|
970
|
+
showValue = _ref12$config$value.show,
|
|
971
|
+
valueFont = _ref12$config$value.font,
|
|
972
|
+
_ref12$config$value$s = _ref12$config$value.suffix,
|
|
973
|
+
showSuffix = _ref12$config$value$s.show,
|
|
974
|
+
text = _ref12$config$value$s.text,
|
|
975
|
+
suffixFontSize = _ref12$config$value$s.fontSize,
|
|
976
|
+
_ref12$config$value$s2 = _ref12$config$value$s.translate,
|
|
977
|
+
suffixTranslateX = _ref12$config$value$s2.x,
|
|
978
|
+
suffixTranslateY = _ref12$config$value$s2.y,
|
|
979
|
+
_ref12$config$value$s3 = _ref12$config$value.sameColor,
|
|
980
|
+
valueSameColor = _ref12$config$value$s3 === void 0 ? false : _ref12$config$value$s3,
|
|
981
|
+
_ref12$config$percent = _ref12$config.percent,
|
|
982
|
+
showPercent = _ref12$config$percent.show,
|
|
983
|
+
percentFont = _ref12$config$percent.font,
|
|
984
|
+
precision = _ref12$config$percent.precision,
|
|
985
|
+
_ref12$config$percent2 = _ref12$config$percent.sameColor,
|
|
986
|
+
percentSameColor = _ref12$config$percent2 === void 0 ? false : _ref12$config$percent2,
|
|
987
|
+
arcs = _ref12.arcs;
|
|
988
|
+
|
|
989
|
+
var _arcs = (0, _react.useMemo)(function () {
|
|
990
|
+
return (0, _utils.getDataWithPercent)(arcs, precision);
|
|
991
|
+
}, [arcs, precision]);
|
|
992
|
+
|
|
993
|
+
return /*#__PURE__*/_react["default"].createElement("g", null, _arcs.map(function (_ref13, index) {
|
|
994
|
+
var _ref13$series$color = _ref13.series.color,
|
|
995
|
+
type = _ref13$series$color.type,
|
|
996
|
+
pure = _ref13$series$color.pure,
|
|
997
|
+
stops = _ref13$series$color.linear.stops,
|
|
998
|
+
realData = _ref13.data,
|
|
999
|
+
displayName = _ref13.displayName,
|
|
1000
|
+
value = _ref13.value,
|
|
1001
|
+
percent = _ref13.percent,
|
|
1002
|
+
arc = _ref13.arc,
|
|
1003
|
+
outerRadius = _ref13.outerRadius,
|
|
1004
|
+
actualIndex = _ref13.index;
|
|
1005
|
+
|
|
1006
|
+
var _arc$centroid3 = arc.centroid(),
|
|
1007
|
+
_arc$centroid4 = (0, _slicedToArray2["default"])(_arc$centroid3, 2),
|
|
1008
|
+
x = _arc$centroid4[0],
|
|
1009
|
+
y = _arc$centroid4[1];
|
|
1010
|
+
|
|
1011
|
+
var midAngle = Math.atan2(y, x);
|
|
1012
|
+
|
|
1013
|
+
var _getCoord5 = getCoord(midAngle, maxRadius ? maxRadius : outerRadius),
|
|
1014
|
+
_getCoord6 = (0, _slicedToArray2["default"])(_getCoord5, 2),
|
|
1015
|
+
x1 = _getCoord6[0],
|
|
1016
|
+
y1 = _getCoord6[1];
|
|
1017
|
+
|
|
1018
|
+
var radius = (maxRadius ? maxRadius : outerRadius) + distance;
|
|
1019
|
+
|
|
1020
|
+
var _getCoord7 = getCoord(midAngle, radius),
|
|
1021
|
+
_getCoord8 = (0, _slicedToArray2["default"])(_getCoord7, 2),
|
|
1022
|
+
x2 = _getCoord8[0],
|
|
1023
|
+
y2 = _getCoord8[1];
|
|
1024
|
+
|
|
1025
|
+
var directionX = x2 < 0 ? -1 : 1;
|
|
1026
|
+
var directionY = y2 < 0 ? -1 : 1;
|
|
1027
|
+
var x3 = x2 + lineLength * directionX;
|
|
1028
|
+
|
|
1029
|
+
var _x = x3 + (translateX + 6) * directionX;
|
|
1030
|
+
|
|
1031
|
+
var _showName = showName && displayName;
|
|
1032
|
+
|
|
1033
|
+
var _showValue = showValue && (value || showSuffix);
|
|
1034
|
+
|
|
1035
|
+
return show && (_showName || showPercent || _showValue) && /*#__PURE__*/_react["default"].createElement("g", {
|
|
1036
|
+
key: index
|
|
1037
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
1038
|
+
className: _piechartModule["default"]['label-line'],
|
|
1039
|
+
style: {
|
|
1040
|
+
animationDelay: "".concat((actualIndex + 1) * 2000 - 800, "ms")
|
|
1041
|
+
},
|
|
1042
|
+
d: 'M' + x1 + ', ' + y1 + 'L' + x2 + ', ' + y2 + 'L' + x3 + ', ' + y2,
|
|
1043
|
+
stroke: lineColor ? lineColor : type == 'pure' ? pure : stops[0].color,
|
|
1044
|
+
fill: "none"
|
|
1045
|
+
}), /*#__PURE__*/_react["default"].createElement("text", {
|
|
1046
|
+
className: _piechartModule["default"]['label-text'],
|
|
1047
|
+
style: {
|
|
1048
|
+
animationDelay: "".concat((actualIndex + 1) * 2000 - 800, "ms")
|
|
1049
|
+
},
|
|
1050
|
+
x: mode == 'horizontal' ? _x : x2,
|
|
1051
|
+
y: y2 + translateY,
|
|
1052
|
+
dominantBaseline: "middle",
|
|
1053
|
+
textAnchor: x3 >= 0 ? 'start' : 'end'
|
|
1054
|
+
}, _showName && /*#__PURE__*/_react["default"].createElement("tspan", {
|
|
1055
|
+
dy: nameDy(_showValue, showPercent, mode, directionY),
|
|
1056
|
+
style: (0, _utils.getFontStyle)(nameFont, 'svg')
|
|
1057
|
+
}, displayName + (showValue || showPercent ? ':' : '')), _showValue && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("tspan", {
|
|
1058
|
+
x: _showName ? mode == 'horizontal' ? '' : x2 : '',
|
|
1059
|
+
dx: valueDx(_showName, mode),
|
|
1060
|
+
dy: valueDy(_showName, mode, directionY),
|
|
1061
|
+
style: (0, _utils.getFontStyle)(valueFont, 'svg')
|
|
1062
|
+
}, realData.y), showSuffix && /*#__PURE__*/_react["default"].createElement("tspan", {
|
|
1063
|
+
style: _objectSpread(_objectSpread({}, (0, _utils.getFontStyle)(valueFont, 'svg')), {}, {
|
|
1064
|
+
fontSize: suffixFontSize
|
|
1065
|
+
}),
|
|
1066
|
+
dx: suffixTranslateX,
|
|
1067
|
+
dy: suffixTranslateY
|
|
1068
|
+
}, text)), showPercent && /*#__PURE__*/_react["default"].createElement("tspan", {
|
|
1069
|
+
x: _showName ? _showValue ? '' : mode == 'vertical' ? x2 : '' : '',
|
|
1070
|
+
dx: percentDx(_showName, _showValue, mode),
|
|
1071
|
+
dy: percentDy_(_showName, _showValue, mode, directionY) + (_showValue && showSuffix ? suffixTranslateY * -1 : ''),
|
|
1072
|
+
style: (0, _utils.getFontStyle)(percentFont, 'svg')
|
|
1073
|
+
}, (_showValue ? '(' : '') + percent + '%' + (_showValue ? ')' : ''))));
|
|
1074
|
+
}));
|
|
1075
|
+
};
|
|
1076
|
+
|
|
1077
|
+
var _default = (0, _.Mapping)((0, _.Carousel)(Component));
|
|
1078
|
+
|
|
1062
1079
|
exports["default"] = _default;
|