@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.
Files changed (90) hide show
  1. package/.babelrc +8 -8
  2. package/.husky/commit-msg +3 -3
  3. package/CHANGELOG.md +18 -18
  4. package/commitlint.config.js +1 -1
  5. package/lib/components/AnimateData.js +40 -36
  6. package/lib/components/Axis.js +333 -329
  7. package/lib/components/Background.js +2 -2
  8. package/lib/components/Band.js +177 -173
  9. package/lib/components/Brush.js +201 -201
  10. package/lib/components/Carousel.js +171 -164
  11. package/lib/components/CartesianChart.js +11 -7
  12. package/lib/components/Chart.js +114 -111
  13. package/lib/components/ChartContainer.js +62 -58
  14. package/lib/components/ConicalGradient.js +268 -264
  15. package/lib/components/ExtentData.js +48 -45
  16. package/lib/components/FilterData.js +56 -53
  17. package/lib/components/Indicator.js +2 -2
  18. package/lib/components/Label.js +278 -278
  19. package/lib/components/Legend.js +160 -154
  20. package/lib/components/Lighter.js +179 -179
  21. package/lib/components/Line.js +187 -181
  22. package/lib/components/LinearGradient.js +2 -2
  23. package/lib/components/Mapping.js +130 -127
  24. package/lib/components/Marquee.js +98 -0
  25. package/lib/components/PieChart.js +1078 -1061
  26. package/lib/components/StackData.js +48 -45
  27. package/lib/components/StereoBar.js +340 -336
  28. package/lib/components/TextOverflow.js +65 -0
  29. package/lib/components/Tooltip.js +155 -155
  30. package/lib/components/index.js +202 -194
  31. package/lib/css/index.module.css +41 -41
  32. package/lib/css/piechart.module.css +26 -26
  33. package/lib/element/ConicGradient.js +72 -72
  34. package/lib/formatter/legend.js +91 -91
  35. package/lib/hooks/index.js +62 -62
  36. package/lib/hooks/useAnimateData.js +88 -88
  37. package/lib/hooks/useAxes.js +135 -135
  38. package/lib/hooks/useCarouselAxisX.js +184 -184
  39. package/lib/hooks/useExtentData.js +128 -128
  40. package/lib/hooks/useFilterData.js +112 -112
  41. package/lib/hooks/useStackData.js +136 -134
  42. package/lib/hooks/useTooltip.js +10 -10
  43. package/lib/index.js +89 -85
  44. package/lib/utils/index.js +835 -832
  45. package/package.json +53 -51
  46. package/src/components/AnimateData.tsx +24 -24
  47. package/src/components/Axis.tsx +354 -354
  48. package/src/components/Background.tsx +45 -45
  49. package/src/components/Band.tsx +173 -173
  50. package/src/components/Brush.js +159 -159
  51. package/src/components/Carousel.tsx +144 -144
  52. package/src/components/Chart.js +99 -99
  53. package/src/components/ChartContainer.tsx +63 -63
  54. package/src/components/ConicalGradient.js +258 -258
  55. package/src/components/ExtentData.js +17 -17
  56. package/src/components/FilterData.js +23 -23
  57. package/src/components/Indicator.js +13 -13
  58. package/src/components/Label.js +206 -206
  59. package/src/components/Legend.js +158 -158
  60. package/src/components/Lighter.jsx +173 -173
  61. package/src/components/Line.js +144 -144
  62. package/src/components/LinearGradient.js +29 -29
  63. package/src/components/Mapping.js +71 -71
  64. package/src/components/Marquee.js +93 -74
  65. package/src/components/PieChart.js +1288 -1097
  66. package/src/components/StackData.js +20 -20
  67. package/src/components/StereoBar.tsx +310 -310
  68. package/src/components/TextOverflow.js +51 -0
  69. package/src/components/Tooltip.js +169 -169
  70. package/src/components/index.js +53 -51
  71. package/src/context/index.js +2 -2
  72. package/src/css/index.module.css +41 -41
  73. package/src/css/piechart.module.css +26 -26
  74. package/src/element/ConicGradient.jsx +55 -55
  75. package/src/element/Line.tsx +33 -33
  76. package/src/element/index.ts +3 -3
  77. package/src/formatter/index.js +1 -1
  78. package/src/formatter/legend.js +90 -90
  79. package/src/hooks/index.js +17 -17
  80. package/src/hooks/useAnimateData.ts +67 -67
  81. package/src/hooks/useAxes.js +144 -144
  82. package/src/hooks/useCarouselAxisX.js +163 -163
  83. package/src/hooks/useExtentData.js +88 -88
  84. package/src/hooks/useFilterData.js +72 -72
  85. package/src/hooks/useStackData.js +100 -100
  86. package/src/hooks/useTooltip.ts +96 -96
  87. package/src/index.js +6 -6
  88. package/src/types/index.d.ts +67 -67
  89. package/src/utils/index.js +696 -696
  90. package/tsconfig.json +22 -22
@@ -1,265 +1,269 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
-
5
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports["default"] = void 0;
11
-
12
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
-
14
- var _react = _interopRequireWildcard(require("react"));
15
-
16
- var _d3v = require("d3v7");
17
-
18
- var _utils = require("@easyv/utils/lib/common/utils");
19
-
20
- var _indexModule = _interopRequireDefault(require("../css/index.module.css"));
21
-
22
- /**
23
- * 饼图装饰内圈
24
- */
25
- var _default = function _default(_ref) {
26
- var width = _ref.width,
27
- height = _ref.height,
28
- centerX = _ref.centerX,
29
- centerY = _ref.centerY,
30
- radius = _ref.radius,
31
- _ref$config = _ref.config,
32
- show = _ref$config.show,
33
- innerRadius = _ref$config.innerRadius,
34
- outerRadius = _ref$config.outerRadius,
35
- opacity = _ref$config.opacity,
36
- speed = _ref$config.speed,
37
- direction = _ref$config.direction,
38
- arcs = _ref.arcs;
39
- if (!show) return null;
40
-
41
- var _useState = (0, _react.useState)(null),
42
- _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
43
- canvas = _useState2[0],
44
- setCanvas = _useState2[1];
45
-
46
- (0, _react.useEffect)(function () {
47
- if (arcs && arcs.length > 0 && canvas && canvas.getContext('2d')) {
48
- var _radius = radius * devicePixelRatio;
49
-
50
- var context = canvas.getContext('2d');
51
- context.clearRect(0, 0, width * devicePixelRatio, height * devicePixelRatio);
52
- context.save();
53
- context.translate(centerX * devicePixelRatio, centerY * devicePixelRatio);
54
- context.beginPath();
55
-
56
- var _arc = (0, _d3v.arc)().innerRadius(innerRadius * _radius).outerRadius(outerRadius * _radius) // .padAngle(axis.pole.padAngle)
57
- // .cornerRadius(axis.pole.cornerRadius)
58
- .context(context);
59
-
60
- arcs.forEach(function (element) {
61
- var startAngle = element.arc.startAngle()();
62
- var endAngle = element.arc.endAngle()();
63
-
64
- _arc.startAngle(startAngle).endAngle(endAngle)();
65
-
66
- context.fillStyle = 'rgba(255, 255, 255, 0)';
67
- context.fill();
68
- });
69
- context.clip();
70
- context.rotate(-Math.PI / 2);
71
- var conic = new ConicalGradient();
72
- arcs.reduce(function (reduced, _ref2) {
73
- var percent = _ref2.percent,
74
- _ref2$series$color = _ref2.series.color,
75
- type = _ref2$series$color.type,
76
- pure = _ref2$series$color.pure,
77
- stops = _ref2$series$color.linear.stops;
78
- var result = reduced + percent / 100;
79
- var color = type == 'pure' ? pure : stops[0].color;
80
-
81
- if (!!color) {
82
- var _converColor = (0, _utils.converColor)(color, 1),
83
- r = _converColor.r,
84
- g = _converColor.g,
85
- b = _converColor.b,
86
- a = _converColor.a;
87
-
88
- conic.addColorStop(reduced, {
89
- r: r,
90
- g: g,
91
- b: b,
92
- a: 0
93
- });
94
- conic.addColorStop(result, {
95
- r: r,
96
- g: g,
97
- b: b,
98
- a: a
99
- });
100
- }
101
-
102
- return result;
103
- }, 0);
104
- conic.fill(context, 0, 0, _radius, 0, 2 * Math.PI, false);
105
- context.restore();
106
- }
107
- }, [canvas, radius, arcs, innerRadius, outerRadius]);
108
- return /*#__PURE__*/_react["default"].createElement("canvas", {
109
- className: direction == 'clockwise' ? _indexModule["default"].rotateClockwise : _indexModule["default"].rotateCounterClockwise,
110
- ref: setCanvas,
111
- width: width * devicePixelRatio,
112
- height: height * devicePixelRatio,
113
- style: {
114
- opacity: opacity / 100,
115
- width: width,
116
- height: height,
117
- pointerEvents: 'none',
118
- position: 'absolute',
119
- animationTimingFunction: 'linear',
120
- animationDuration: speed + 's',
121
- animationIterationCount: 'infinite',
122
- transformOrigin: centerX + 'px ' + centerY + 'px'
123
- }
124
- });
125
- };
126
- /**
127
- * ConicalGradient
128
- */
129
-
130
-
131
- exports["default"] = _default;
132
-
133
- function ConicalGradient() {
134
- this._offsets = [];
135
- this._colors = [];
136
- }
137
-
138
- ConicalGradient.prototype = {
139
- /**
140
- * addColorStop
141
- *
142
- * @param {Number} offset
143
- * @param {Array} color RGBA值
144
- */
145
- addColorStop: function addColorStop(offset, color) {
146
- this._offsets.push(offset);
147
-
148
- this._colors.push(color);
149
-
150
- return this;
151
- },
152
-
153
- /**
154
- * _offsetsReverse (array.forEach callback)
155
- */
156
- _offsetsReverse: function _offsetsReverse(offset, index, array) {
157
- array[index] = 1 - offset;
158
- },
159
-
160
- /**
161
- * fill
162
- *
163
- * @param {Number} context
164
- * @param {Number} x
165
- * @param {Number} y
166
- * @param {Number} radius
167
- * @param {Number} startAngle
168
- * @param {Number} endAngle
169
- * @param {Boolean} anticlockwise
170
- */
171
- fill: function fill(context, x, y, radius, startAngle, endAngle, anticlockwise) {
172
- var offsets = this._offsets;
173
- var colors = this._colors;
174
- var PI = Math.PI;
175
- var TWO_PI = PI * 2;
176
- if (startAngle < 0) startAngle = startAngle % TWO_PI + TWO_PI;
177
- startAngle %= TWO_PI;
178
- if (endAngle < 0) endAngle = endAngle % TWO_PI + TWO_PI;
179
- endAngle %= TWO_PI;
180
-
181
- if (anticlockwise) {
182
- // 逆时针
183
- var swap = startAngle;
184
- startAngle = endAngle;
185
- endAngle = swap;
186
- colors.reverse();
187
- offsets.reverse();
188
- offsets.forEach(this._offsetsReverse);
189
- }
190
-
191
- if (startAngle > endAngle || Math.abs(endAngle - startAngle) < 0.0001) {
192
- endAngle += TWO_PI;
193
- }
194
-
195
- var colorsLength = colors.length;
196
- var currentColorIndex = 0;
197
- var currentColor = colors[currentColorIndex];
198
- var nextColor = colors[currentColorIndex];
199
- var prevOffset = 0;
200
- var currentOffset = offsets[currentColorIndex];
201
- var offsetDist = currentOffset - prevOffset;
202
- var totalAngleDeg = (endAngle - startAngle) * 180 / PI;
203
- var stepAngleRad = (endAngle - startAngle) / totalAngleDeg;
204
- var arcStartAngle = startAngle;
205
- var arcEndAngle;
206
- var r1 = currentColor.r,
207
- g1 = currentColor.g,
208
- b1 = currentColor.b,
209
- a1 = currentColor.a,
210
- r2 = nextColor.r,
211
- g2 = nextColor.g,
212
- b2 = nextColor.b,
213
- a2 = nextColor.a;
214
- if (!a1 && a1 !== 0) a1 = 1;
215
- if (!a2 && a2 !== 0) a2 = 1;
216
- var rd = r2 - r1,
217
- gd = g2 - g1,
218
- bd = b2 - b1,
219
- ad = a2 - a1;
220
- var t, r, g, b, a;
221
- context.save();
222
-
223
- for (var i = 0, n = 1 / totalAngleDeg; i < 1; i += n) {
224
- if (i >= currentOffset) {
225
- currentColorIndex++;
226
- currentColor = nextColor;
227
- r1 = currentColor.r;
228
- g1 = currentColor.g;
229
- b1 = currentColor.b;
230
- a1 = currentColor.a;
231
- if (!a1 && a1 !== 0) a1 = 1;
232
- nextColor = colors[currentColorIndex];
233
- r2 = nextColor.r;
234
- g2 = nextColor.g;
235
- b2 = nextColor.b;
236
- a2 = nextColor.a;
237
- if (!a2 && a2 !== 0) a2 = 1;
238
- rd = r2 - r1;
239
- gd = g2 - g1;
240
- bd = b2 - b1;
241
- ad = a2 - a1;
242
- prevOffset = currentOffset;
243
- currentOffset = offsets[currentColorIndex];
244
- offsetDist = currentOffset - prevOffset;
245
- }
246
-
247
- t = (i - prevOffset) / offsetDist;
248
- r = rd * t + r1 & 255;
249
- g = gd * t + g1 & 255;
250
- b = bd * t + b1 & 255;
251
- a = ad * t + a1;
252
- arcEndAngle = arcStartAngle + stepAngleRad;
253
- context.fillStyle = 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')';
254
- context.beginPath();
255
- context.moveTo(x, y);
256
- context.arc(x, y, radius, arcStartAngle - 0.02, arcEndAngle, false);
257
- context.closePath();
258
- context.fill();
259
- arcStartAngle += stepAngleRad;
260
- }
261
-
262
- context.restore();
263
- return this;
264
- }
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 _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
+
14
+ var _react = _interopRequireWildcard(require("react"));
15
+
16
+ var _d3v = require("d3v7");
17
+
18
+ var _utils = require("@easyv/utils/lib/common/utils");
19
+
20
+ var _indexModule = _interopRequireDefault(require("../css/index.module.css"));
21
+
22
+ 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); }
23
+
24
+ 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; }
25
+
26
+ /**
27
+ * 饼图装饰内圈
28
+ */
29
+ var _default = function _default(_ref) {
30
+ var width = _ref.width,
31
+ height = _ref.height,
32
+ centerX = _ref.centerX,
33
+ centerY = _ref.centerY,
34
+ radius = _ref.radius,
35
+ _ref$config = _ref.config,
36
+ show = _ref$config.show,
37
+ innerRadius = _ref$config.innerRadius,
38
+ outerRadius = _ref$config.outerRadius,
39
+ opacity = _ref$config.opacity,
40
+ speed = _ref$config.speed,
41
+ direction = _ref$config.direction,
42
+ arcs = _ref.arcs;
43
+ if (!show) return null;
44
+
45
+ var _useState = (0, _react.useState)(null),
46
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
47
+ canvas = _useState2[0],
48
+ setCanvas = _useState2[1];
49
+
50
+ (0, _react.useEffect)(function () {
51
+ if (arcs && arcs.length > 0 && canvas && canvas.getContext('2d')) {
52
+ var _radius = radius * devicePixelRatio;
53
+
54
+ var context = canvas.getContext('2d');
55
+ context.clearRect(0, 0, width * devicePixelRatio, height * devicePixelRatio);
56
+ context.save();
57
+ context.translate(centerX * devicePixelRatio, centerY * devicePixelRatio);
58
+ context.beginPath();
59
+
60
+ var _arc = (0, _d3v.arc)().innerRadius(innerRadius * _radius).outerRadius(outerRadius * _radius) // .padAngle(axis.pole.padAngle)
61
+ // .cornerRadius(axis.pole.cornerRadius)
62
+ .context(context);
63
+
64
+ arcs.forEach(function (element) {
65
+ var startAngle = element.arc.startAngle()();
66
+ var endAngle = element.arc.endAngle()();
67
+
68
+ _arc.startAngle(startAngle).endAngle(endAngle)();
69
+
70
+ context.fillStyle = 'rgba(255, 255, 255, 0)';
71
+ context.fill();
72
+ });
73
+ context.clip();
74
+ context.rotate(-Math.PI / 2);
75
+ var conic = new ConicalGradient();
76
+ arcs.reduce(function (reduced, _ref2) {
77
+ var percent = _ref2.percent,
78
+ _ref2$series$color = _ref2.series.color,
79
+ type = _ref2$series$color.type,
80
+ pure = _ref2$series$color.pure,
81
+ stops = _ref2$series$color.linear.stops;
82
+ var result = reduced + percent / 100;
83
+ var color = type == 'pure' ? pure : stops[0].color;
84
+
85
+ if (!!color) {
86
+ var _converColor = (0, _utils.converColor)(color, 1),
87
+ r = _converColor.r,
88
+ g = _converColor.g,
89
+ b = _converColor.b,
90
+ a = _converColor.a;
91
+
92
+ conic.addColorStop(reduced, {
93
+ r: r,
94
+ g: g,
95
+ b: b,
96
+ a: 0
97
+ });
98
+ conic.addColorStop(result, {
99
+ r: r,
100
+ g: g,
101
+ b: b,
102
+ a: a
103
+ });
104
+ }
105
+
106
+ return result;
107
+ }, 0);
108
+ conic.fill(context, 0, 0, _radius, 0, 2 * Math.PI, false);
109
+ context.restore();
110
+ }
111
+ }, [canvas, radius, arcs, innerRadius, outerRadius]);
112
+ return /*#__PURE__*/_react["default"].createElement("canvas", {
113
+ className: direction == 'clockwise' ? _indexModule["default"].rotateClockwise : _indexModule["default"].rotateCounterClockwise,
114
+ ref: setCanvas,
115
+ width: width * devicePixelRatio,
116
+ height: height * devicePixelRatio,
117
+ style: {
118
+ opacity: opacity / 100,
119
+ width: width,
120
+ height: height,
121
+ pointerEvents: 'none',
122
+ position: 'absolute',
123
+ animationTimingFunction: 'linear',
124
+ animationDuration: speed + 's',
125
+ animationIterationCount: 'infinite',
126
+ transformOrigin: centerX + 'px ' + centerY + 'px'
127
+ }
128
+ });
129
+ };
130
+ /**
131
+ * ConicalGradient
132
+ */
133
+
134
+
135
+ exports["default"] = _default;
136
+
137
+ function ConicalGradient() {
138
+ this._offsets = [];
139
+ this._colors = [];
140
+ }
141
+
142
+ ConicalGradient.prototype = {
143
+ /**
144
+ * addColorStop
145
+ *
146
+ * @param {Number} offset
147
+ * @param {Array} color RGBA值
148
+ */
149
+ addColorStop: function addColorStop(offset, color) {
150
+ this._offsets.push(offset);
151
+
152
+ this._colors.push(color);
153
+
154
+ return this;
155
+ },
156
+
157
+ /**
158
+ * _offsetsReverse (array.forEach callback)
159
+ */
160
+ _offsetsReverse: function _offsetsReverse(offset, index, array) {
161
+ array[index] = 1 - offset;
162
+ },
163
+
164
+ /**
165
+ * fill
166
+ *
167
+ * @param {Number} context
168
+ * @param {Number} x
169
+ * @param {Number} y
170
+ * @param {Number} radius
171
+ * @param {Number} startAngle
172
+ * @param {Number} endAngle
173
+ * @param {Boolean} anticlockwise
174
+ */
175
+ fill: function fill(context, x, y, radius, startAngle, endAngle, anticlockwise) {
176
+ var offsets = this._offsets;
177
+ var colors = this._colors;
178
+ var PI = Math.PI;
179
+ var TWO_PI = PI * 2;
180
+ if (startAngle < 0) startAngle = startAngle % TWO_PI + TWO_PI;
181
+ startAngle %= TWO_PI;
182
+ if (endAngle < 0) endAngle = endAngle % TWO_PI + TWO_PI;
183
+ endAngle %= TWO_PI;
184
+
185
+ if (anticlockwise) {
186
+ // 逆时针
187
+ var swap = startAngle;
188
+ startAngle = endAngle;
189
+ endAngle = swap;
190
+ colors.reverse();
191
+ offsets.reverse();
192
+ offsets.forEach(this._offsetsReverse);
193
+ }
194
+
195
+ if (startAngle > endAngle || Math.abs(endAngle - startAngle) < 0.0001) {
196
+ endAngle += TWO_PI;
197
+ }
198
+
199
+ var colorsLength = colors.length;
200
+ var currentColorIndex = 0;
201
+ var currentColor = colors[currentColorIndex];
202
+ var nextColor = colors[currentColorIndex];
203
+ var prevOffset = 0;
204
+ var currentOffset = offsets[currentColorIndex];
205
+ var offsetDist = currentOffset - prevOffset;
206
+ var totalAngleDeg = (endAngle - startAngle) * 180 / PI;
207
+ var stepAngleRad = (endAngle - startAngle) / totalAngleDeg;
208
+ var arcStartAngle = startAngle;
209
+ var arcEndAngle;
210
+ var r1 = currentColor.r,
211
+ g1 = currentColor.g,
212
+ b1 = currentColor.b,
213
+ a1 = currentColor.a,
214
+ r2 = nextColor.r,
215
+ g2 = nextColor.g,
216
+ b2 = nextColor.b,
217
+ a2 = nextColor.a;
218
+ if (!a1 && a1 !== 0) a1 = 1;
219
+ if (!a2 && a2 !== 0) a2 = 1;
220
+ var rd = r2 - r1,
221
+ gd = g2 - g1,
222
+ bd = b2 - b1,
223
+ ad = a2 - a1;
224
+ var t, r, g, b, a;
225
+ context.save();
226
+
227
+ for (var i = 0, n = 1 / totalAngleDeg; i < 1; i += n) {
228
+ if (i >= currentOffset) {
229
+ currentColorIndex++;
230
+ currentColor = nextColor;
231
+ r1 = currentColor.r;
232
+ g1 = currentColor.g;
233
+ b1 = currentColor.b;
234
+ a1 = currentColor.a;
235
+ if (!a1 && a1 !== 0) a1 = 1;
236
+ nextColor = colors[currentColorIndex];
237
+ r2 = nextColor.r;
238
+ g2 = nextColor.g;
239
+ b2 = nextColor.b;
240
+ a2 = nextColor.a;
241
+ if (!a2 && a2 !== 0) a2 = 1;
242
+ rd = r2 - r1;
243
+ gd = g2 - g1;
244
+ bd = b2 - b1;
245
+ ad = a2 - a1;
246
+ prevOffset = currentOffset;
247
+ currentOffset = offsets[currentColorIndex];
248
+ offsetDist = currentOffset - prevOffset;
249
+ }
250
+
251
+ t = (i - prevOffset) / offsetDist;
252
+ r = rd * t + r1 & 255;
253
+ g = gd * t + g1 & 255;
254
+ b = bd * t + b1 & 255;
255
+ a = ad * t + a1;
256
+ arcEndAngle = arcStartAngle + stepAngleRad;
257
+ context.fillStyle = 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')';
258
+ context.beginPath();
259
+ context.moveTo(x, y);
260
+ context.arc(x, y, radius, arcStartAngle - 0.02, arcEndAngle, false);
261
+ context.closePath();
262
+ context.fill();
263
+ arcStartAngle += stepAngleRad;
264
+ }
265
+
266
+ context.restore();
267
+ return this;
268
+ }
265
269
  };
@@ -1,46 +1,49 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = void 0;
9
-
10
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
-
14
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
-
16
- var _react = require("react");
17
-
18
- var _hooks = require("../hooks");
19
-
20
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
21
-
22
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
23
-
24
- var _default = function _default(Component) {
25
- return /*#__PURE__*/(0, _react.memo)(function (_ref) {
26
- var _ref$config = _ref.config,
27
- axes = _ref$config.axes,
28
- series = _ref$config.series,
29
- config = (0, _objectWithoutProperties2["default"])(_ref$config, ["axes", "series"]),
30
- data = _ref.data,
31
- props = (0, _objectWithoutProperties2["default"])(_ref, ["config", "data"]);
32
- return /*#__PURE__*/React.createElement(Component, (0, _extends2["default"])({}, props, {
33
- config: _objectSpread(_objectSpread({}, config), {}, {
34
- axes: (0, _hooks.useExtentData)({
35
- series: series,
36
- axes: axes,
37
- data: data
38
- }),
39
- series: series
40
- }),
41
- data: data
42
- }));
43
- });
44
- };
45
-
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+
14
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
+
16
+ var _react = require("react");
17
+
18
+ var _hooks = require("../hooks");
19
+
20
+ var _excluded = ["axes", "series"],
21
+ _excluded2 = ["config", "data"];
22
+
23
+ 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; }
24
+
25
+ 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; }
26
+
27
+ var _default = function _default(Component) {
28
+ return /*#__PURE__*/(0, _react.memo)(function (_ref) {
29
+ var _ref$config = _ref.config,
30
+ axes = _ref$config.axes,
31
+ series = _ref$config.series,
32
+ config = (0, _objectWithoutProperties2["default"])(_ref$config, _excluded),
33
+ data = _ref.data,
34
+ props = (0, _objectWithoutProperties2["default"])(_ref, _excluded2);
35
+ return /*#__PURE__*/React.createElement(Component, (0, _extends2["default"])({}, props, {
36
+ config: _objectSpread(_objectSpread({}, config), {}, {
37
+ axes: (0, _hooks.useExtentData)({
38
+ series: series,
39
+ axes: axes,
40
+ data: data
41
+ }),
42
+ series: series
43
+ }),
44
+ data: data
45
+ }));
46
+ });
47
+ };
48
+
46
49
  exports["default"] = _default;