@easyv/charts 1.4.14 → 1.4.16

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