@easyv/charts 1.6.8 → 1.6.10
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/lib/components/AnimateData.js +13 -22
- package/lib/components/Axis.js +106 -153
- package/lib/components/Background.js +18 -27
- package/lib/components/Band.js +79 -105
- package/lib/components/BaseLine.js +38 -52
- package/lib/components/Brush.js +31 -49
- package/lib/components/Carousel.js +20 -48
- package/lib/components/CartesianChart.js +136 -195
- package/lib/components/Chart.js +37 -59
- package/lib/components/ChartContainer.js +23 -33
- package/lib/components/ConicalGradient.js +38 -72
- package/lib/components/Control.js +61 -101
- package/lib/components/ExtentData.js +13 -22
- package/lib/components/FilterData.js +20 -32
- package/lib/components/Indicator.js +18 -26
- package/lib/components/Label.js +90 -121
- package/lib/components/Legend.js +48 -74
- package/lib/components/Lighter.js +22 -52
- package/lib/components/Line.js +41 -62
- package/lib/components/LinearGradient.js +16 -23
- package/lib/components/Mapping.js +15 -41
- package/lib/components/Marquee.js +23 -40
- package/lib/components/PieChart.js +352 -456
- package/lib/components/StackData.js +12 -23
- package/lib/components/StereoBar.js +69 -110
- package/lib/components/TextOverflow.js +17 -31
- package/lib/components/Tooltip.js +50 -65
- package/lib/components/index.js +1 -31
- package/lib/components/pieTooltip.js +46 -74
- package/lib/context/index.js +1 -4
- package/lib/css/index.module.css +1 -1
- package/lib/element/ConicGradient.js +31 -37
- package/lib/element/Line.js +11 -16
- package/lib/element/index.js +0 -2
- package/lib/formatter/index.js +0 -2
- package/lib/formatter/legend.js +48 -48
- package/lib/hooks/index.js +0 -9
- package/lib/hooks/useAiData.js +16 -27
- package/lib/hooks/useAnimateData.js +7 -21
- package/lib/hooks/useAxes.js +89 -151
- package/lib/hooks/useCarouselAxisX.js +30 -64
- package/lib/hooks/useExtentData.js +24 -65
- package/lib/hooks/useFilterData.js +16 -42
- package/lib/hooks/useStackData.js +11 -35
- package/lib/hooks/useTooltip.js +29 -47
- package/lib/index.js +2 -17
- package/lib/utils/index.js +138 -325
- package/package.json +1 -1
- package/src/components/Band.tsx +1 -1
- package/src/components/CartesianChart.js +2 -2
- package/src/css/index.module.css +1 -1
- package/src/formatter/legend.js +13 -1
package/lib/components/Label.js
CHANGED
|
@@ -1,87 +1,73 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
-
|
|
14
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
-
|
|
16
11
|
var _react = require("react");
|
|
17
|
-
|
|
18
12
|
var _utils = require("../utils");
|
|
19
|
-
|
|
20
13
|
var _context = require("../context");
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
14
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /**
|
|
16
|
+
* 轴类图表标签
|
|
17
|
+
*/
|
|
18
|
+
var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
27
19
|
var _ref$config = _ref.config,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
20
|
+
_ref$config$seriesInt = _ref$config.seriesIntervalWidth,
|
|
21
|
+
paddingInner = _ref$config$seriesInt === void 0 ? 0 : _ref$config$seriesInt,
|
|
22
|
+
_ref$config$paddingIn = _ref$config.paddingInner,
|
|
23
|
+
paddingOuter = _ref$config$paddingIn === void 0 ? 0 : _ref$config$paddingIn,
|
|
24
|
+
label = _ref$config.label,
|
|
25
|
+
icon = _ref$config.icon,
|
|
26
|
+
config = _ref.config,
|
|
27
|
+
_ref$bandLength = _ref.bandLength,
|
|
28
|
+
bandLength = _ref$bandLength === void 0 ? 0 : _ref$bandLength,
|
|
29
|
+
data = _ref.data,
|
|
30
|
+
_ref$xAxis = _ref.xAxis,
|
|
31
|
+
xScaler = _ref$xAxis.scaler,
|
|
32
|
+
step = _ref$xAxis.step,
|
|
33
|
+
direction = _ref$xAxis.direction,
|
|
34
|
+
_ref$yAxis = _ref.yAxis,
|
|
35
|
+
yScaler = _ref$yAxis.scaler,
|
|
36
|
+
isClipAxis = _ref$yAxis.isClipAxis,
|
|
37
|
+
clipValue = _ref$yAxis.clipValue,
|
|
38
|
+
triggerClick = _ref.triggerClick;
|
|
47
39
|
var lineType = config.hasOwnProperty("line"); // 堆叠处理
|
|
48
|
-
|
|
49
40
|
var showIcon = icon && icon.show;
|
|
50
41
|
var showLabel = label && label.show;
|
|
51
42
|
if (!(data.length && (showIcon || showLabel))) return null;
|
|
52
|
-
|
|
53
43
|
var _useContext = (0, _react.useContext)(_context.chartContext),
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
width = _useContext.width,
|
|
45
|
+
height = _useContext.height;
|
|
57
46
|
var _getSeriesInfo = (0, _utils.getSeriesInfo)({
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
47
|
+
step: step,
|
|
48
|
+
bandLength: bandLength,
|
|
49
|
+
paddingInner: paddingInner,
|
|
50
|
+
paddingOuter: paddingOuter
|
|
51
|
+
}),
|
|
52
|
+
seriesStep = _getSeriesInfo.seriesStep,
|
|
53
|
+
seriesWidth = _getSeriesInfo.seriesWidth,
|
|
54
|
+
seriesStart = _getSeriesInfo.seriesStart;
|
|
67
55
|
var isVertical = direction === "vertical";
|
|
68
56
|
var _position = label.position;
|
|
69
57
|
return /*#__PURE__*/React.createElement("g", {
|
|
70
58
|
className: "__easyv-label"
|
|
71
59
|
}, data.map(function (_ref2, i) {
|
|
72
60
|
var index = _ref2.index,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
61
|
+
_ref2$bound = (0, _slicedToArray2["default"])(_ref2.bound, 2),
|
|
62
|
+
start = _ref2$bound[0],
|
|
63
|
+
end = _ref2$bound[1],
|
|
64
|
+
data = _ref2.data,
|
|
65
|
+
_ref2$data = _ref2.data,
|
|
66
|
+
x = _ref2$data.x,
|
|
67
|
+
y = _ref2$data.y,
|
|
68
|
+
showY = _ref2$data.showY,
|
|
69
|
+
s = _ref2$data.s;
|
|
83
70
|
var y1, y2;
|
|
84
|
-
|
|
85
71
|
if (isClipAxis) {
|
|
86
72
|
if (end > +clipValue) {
|
|
87
73
|
y1 = yScaler[1](start);
|
|
@@ -91,12 +77,12 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
91
77
|
y2 = yScaler[1](end);
|
|
92
78
|
}
|
|
93
79
|
} else {
|
|
94
|
-
y1 = yScaler(isVertical ? end : start);
|
|
95
|
-
|
|
80
|
+
y1 = yScaler(isVertical ? end : start);
|
|
81
|
+
// 处理z型折线图和堆叠柱图的逻辑冲突
|
|
96
82
|
y2 = lineType ? start ? yScaler(isVertical ? start : end - start) : yScaler(isVertical ? start : end) : yScaler(isVertical ? start : end);
|
|
97
|
-
}
|
|
98
|
-
|
|
83
|
+
}
|
|
99
84
|
|
|
85
|
+
// const y2 = yScaler(isVertical ? start : end);
|
|
100
86
|
var positionX = xScaler(x) - step / 2 + seriesStart + index * seriesStep;
|
|
101
87
|
if (isNaN(positionX)) return null;
|
|
102
88
|
var position = positionX + (config.line ? step : seriesWidth) / 2;
|
|
@@ -137,30 +123,27 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
137
123
|
}, attr)));
|
|
138
124
|
}));
|
|
139
125
|
});
|
|
140
|
-
|
|
141
|
-
exports["default"] = _default;
|
|
142
|
-
|
|
143
126
|
var Label = function Label(_ref3) {
|
|
144
127
|
var x = _ref3.x,
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
128
|
+
y = _ref3.y,
|
|
129
|
+
value = _ref3.value,
|
|
130
|
+
_ref3$config = _ref3.config,
|
|
131
|
+
font = _ref3$config.font,
|
|
132
|
+
_ref3$config$translat = _ref3$config.translate,
|
|
133
|
+
_ref3$config$translat2 = _ref3$config$translat.x,
|
|
134
|
+
translateX = _ref3$config$translat2 === void 0 ? 0 : _ref3$config$translat2,
|
|
135
|
+
_ref3$config$translat3 = _ref3$config$translat.y,
|
|
136
|
+
translateY = _ref3$config$translat3 === void 0 ? 0 : _ref3$config$translat3,
|
|
137
|
+
_ref3$config$suffix = _ref3$config.suffix,
|
|
138
|
+
content = _ref3$config$suffix.content,
|
|
139
|
+
suffixFont = _ref3$config$suffix.font,
|
|
140
|
+
_ref3$config$suffix$t = _ref3$config$suffix.translate,
|
|
141
|
+
suffixX = _ref3$config$suffix$t.x,
|
|
142
|
+
suffixY = _ref3$config$suffix$t.y,
|
|
143
|
+
_ref3$textAnchor = _ref3.textAnchor,
|
|
144
|
+
textAnchor = _ref3$textAnchor === void 0 ? "middle" : _ref3$textAnchor,
|
|
145
|
+
_ref3$dominantBaselin = _ref3.dominantBaseline,
|
|
146
|
+
dominantBaseline = _ref3$dominantBaselin === void 0 ? "middle" : _ref3$dominantBaselin;
|
|
164
147
|
return /*#__PURE__*/React.createElement("text", (0, _extends2["default"])({
|
|
165
148
|
x: x,
|
|
166
149
|
y: y,
|
|
@@ -176,20 +159,19 @@ var Label = function Label(_ref3) {
|
|
|
176
159
|
style: _objectSpread({}, (0, _utils.getFontStyle)(suffixFont, "svg"))
|
|
177
160
|
}, content));
|
|
178
161
|
};
|
|
179
|
-
|
|
180
162
|
var Icon = function Icon(_ref4) {
|
|
181
163
|
var cx = _ref4.cx,
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
164
|
+
cy = _ref4.cy,
|
|
165
|
+
_ref4$config = _ref4.config,
|
|
166
|
+
mode = _ref4$config.mode,
|
|
167
|
+
inner = _ref4$config.inner,
|
|
168
|
+
outer = _ref4$config.outer,
|
|
169
|
+
color = _ref4$config.color,
|
|
170
|
+
radius = _ref4$config.radius,
|
|
171
|
+
image = _ref4$config.image,
|
|
172
|
+
_ref4$config$size = _ref4$config.size,
|
|
173
|
+
width = _ref4$config$size.width,
|
|
174
|
+
height = _ref4$config$size.height;
|
|
193
175
|
return mode == "single" ? /*#__PURE__*/React.createElement(Circle, {
|
|
194
176
|
cx: cx,
|
|
195
177
|
cy: cy,
|
|
@@ -209,12 +191,11 @@ var Icon = function Icon(_ref4) {
|
|
|
209
191
|
xlinkHref: window.appConfig.ASSETS_URL + image
|
|
210
192
|
}));
|
|
211
193
|
};
|
|
212
|
-
|
|
213
194
|
var Circle = function Circle(_ref5) {
|
|
214
195
|
var cx = _ref5.cx,
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
196
|
+
cy = _ref5.cy,
|
|
197
|
+
color = _ref5.color,
|
|
198
|
+
radius = _ref5.radius;
|
|
218
199
|
return /*#__PURE__*/React.createElement("circle", {
|
|
219
200
|
cx: cx,
|
|
220
201
|
cy: cy,
|
|
@@ -223,40 +204,34 @@ var Circle = function Circle(_ref5) {
|
|
|
223
204
|
stroke: "none"
|
|
224
205
|
});
|
|
225
206
|
};
|
|
226
|
-
|
|
227
207
|
var getVerticalLabel = function getVerticalLabel(_ref6) {
|
|
228
208
|
var _ref6$position = _ref6.position,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
209
|
+
position = _ref6$position === void 0 ? "outerStart" : _ref6$position,
|
|
210
|
+
width = _ref6.width,
|
|
211
|
+
y = _ref6.y,
|
|
212
|
+
y1 = _ref6.y1,
|
|
213
|
+
y2 = _ref6.y2;
|
|
235
214
|
switch (position) {
|
|
236
215
|
case "start":
|
|
237
216
|
return {
|
|
238
217
|
x: y > 0 ? y2 : y1,
|
|
239
218
|
textAnchor: "start"
|
|
240
219
|
};
|
|
241
|
-
|
|
242
220
|
case "middle":
|
|
243
221
|
return {
|
|
244
222
|
x: (y1 + y2) / 2,
|
|
245
223
|
textAnchor: "middle"
|
|
246
224
|
};
|
|
247
|
-
|
|
248
225
|
case "end":
|
|
249
226
|
return {
|
|
250
227
|
x: y > 0 ? y1 : y2,
|
|
251
228
|
textAnchor: "end"
|
|
252
229
|
};
|
|
253
|
-
|
|
254
230
|
case "outerStart":
|
|
255
231
|
return {
|
|
256
232
|
x: y1,
|
|
257
233
|
textAnchor: y > 0 ? "start" : "end"
|
|
258
234
|
};
|
|
259
|
-
|
|
260
235
|
case "chartStart":
|
|
261
236
|
return {
|
|
262
237
|
x: y > 0 ? width : 0,
|
|
@@ -264,40 +239,34 @@ var getVerticalLabel = function getVerticalLabel(_ref6) {
|
|
|
264
239
|
};
|
|
265
240
|
}
|
|
266
241
|
};
|
|
267
|
-
|
|
268
242
|
var getHorizontalLabel = function getHorizontalLabel(_ref7) {
|
|
269
243
|
var _ref7$position = _ref7.position,
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
244
|
+
position = _ref7$position === void 0 ? "outerStart" : _ref7$position,
|
|
245
|
+
height = _ref7.height,
|
|
246
|
+
y = _ref7.y,
|
|
247
|
+
y1 = _ref7.y1,
|
|
248
|
+
y2 = _ref7.y2;
|
|
276
249
|
switch (position) {
|
|
277
250
|
case "start":
|
|
278
251
|
return {
|
|
279
252
|
y: y > 0 ? y1 : y2,
|
|
280
253
|
dominantBaseline: "text-after-edge"
|
|
281
254
|
};
|
|
282
|
-
|
|
283
255
|
case "middle":
|
|
284
256
|
return {
|
|
285
257
|
y: (y1 + y2) / 2,
|
|
286
258
|
dominantBaseline: "middle"
|
|
287
259
|
};
|
|
288
|
-
|
|
289
260
|
case "end":
|
|
290
261
|
return {
|
|
291
262
|
y: y > 0 ? y2 : y1,
|
|
292
263
|
dominantBaseline: "text-before-edge"
|
|
293
264
|
};
|
|
294
|
-
|
|
295
265
|
case "outerStart":
|
|
296
266
|
return {
|
|
297
267
|
y: y2,
|
|
298
268
|
dominantBaseline: y >= 0 ? "text-after-edge" : "text-before-edge"
|
|
299
269
|
};
|
|
300
|
-
|
|
301
270
|
case "chartStart":
|
|
302
271
|
return {
|
|
303
272
|
y: y > 0 ? 0 : height,
|
package/lib/components/Legend.js
CHANGED
|
@@ -1,96 +1,79 @@
|
|
|
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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
-
|
|
14
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
-
|
|
16
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
17
|
-
|
|
18
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
-
|
|
20
13
|
var _utils = require("../utils");
|
|
21
|
-
|
|
22
14
|
var _TextOverflow = _interopRequireDefault(require("./TextOverflow"));
|
|
23
|
-
|
|
24
15
|
var _excluded = ["italic", "bold"];
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
function ownKeys(
|
|
31
|
-
|
|
32
|
-
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; }
|
|
33
|
-
|
|
16
|
+
/**
|
|
17
|
+
* 图例
|
|
18
|
+
*/
|
|
19
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
21
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
22
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
34
23
|
var defaultFont = {
|
|
35
24
|
fontStyle: 'normal',
|
|
36
25
|
fontWeight: 'normal'
|
|
37
26
|
};
|
|
38
|
-
|
|
39
|
-
var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
27
|
+
var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
40
28
|
var series = _ref.series,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
29
|
+
config = _ref.config,
|
|
30
|
+
_ref$config = _ref.config,
|
|
31
|
+
show = _ref$config.show,
|
|
32
|
+
_ref$config$order = _ref$config.order,
|
|
33
|
+
order = _ref$config$order === void 0 ? '' : _ref$config$order,
|
|
34
|
+
interactive = _ref$config.interactive,
|
|
35
|
+
maxWidth = _ref$config.maxWidth,
|
|
36
|
+
textOverflow = _ref$config.textOverflow,
|
|
37
|
+
speed = _ref$config.speed,
|
|
38
|
+
_ref$config$layout = _ref$config.layout,
|
|
39
|
+
_ref$config$layout$al = _ref$config$layout.alignment,
|
|
40
|
+
alignment = _ref$config$layout$al === void 0 ? 'right center' : _ref$config$layout$al,
|
|
41
|
+
gridTemplateColumns = _ref$config$layout.gridTemplateColumns,
|
|
42
|
+
_ref$config$layout$gr = _ref$config$layout.gridGap,
|
|
43
|
+
gridColumnGap = _ref$config$layout$gr.gridColumnGap,
|
|
44
|
+
gridRowGap = _ref$config$layout$gr.gridRowGap,
|
|
45
|
+
_ref$config$layout$tr = _ref$config$layout.translate,
|
|
46
|
+
x = _ref$config$layout$tr.x,
|
|
47
|
+
y = _ref$config$layout$tr.y,
|
|
48
|
+
_ref$config$font = _ref$config.font,
|
|
49
|
+
_ref$config$font2 = _ref$config$font === void 0 ? defaultFont : _ref$config$font,
|
|
50
|
+
italic = _ref$config$font2.italic,
|
|
51
|
+
bold = _ref$config$font2.bold,
|
|
52
|
+
font = (0, _objectWithoutProperties2["default"])(_ref$config$font2, _excluded),
|
|
53
|
+
_ref$config$unselect = _ref$config.unselect,
|
|
54
|
+
_ref$config$unselect2 = _ref$config$unselect === void 0 ? {} : _ref$config$unselect,
|
|
55
|
+
_ref$config$unselect3 = _ref$config$unselect2.opacity,
|
|
56
|
+
opacity = _ref$config$unselect3 === void 0 ? 1 : _ref$config$unselect3,
|
|
57
|
+
filterData = _ref.filterData,
|
|
58
|
+
formatter = _ref.formatter,
|
|
59
|
+
judge = _ref.judge;
|
|
72
60
|
if (!show) return null;
|
|
73
|
-
|
|
74
61
|
var _series = (0, _utils.sortPie)(series, order);
|
|
75
|
-
|
|
76
62
|
var _alignment$split = alignment.split(' '),
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
63
|
+
_alignment$split2 = (0, _slicedToArray2["default"])(_alignment$split, 2),
|
|
64
|
+
_alignment = _alignment$split2[0],
|
|
65
|
+
position = _alignment$split2[1];
|
|
81
66
|
var length = _series.length;
|
|
82
67
|
var onClick = (0, _react.useCallback)(function (e) {
|
|
83
68
|
var dataset = e.currentTarget.dataset;
|
|
84
69
|
var name = dataset.name;
|
|
85
70
|
filterData && interactive && filterData(name);
|
|
86
71
|
}, [interactive, filterData]);
|
|
87
|
-
|
|
88
72
|
if (judge == 0) {
|
|
89
73
|
_series.forEach(function (d) {
|
|
90
74
|
d.percent = 0;
|
|
91
75
|
});
|
|
92
76
|
}
|
|
93
|
-
|
|
94
77
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
95
78
|
className: "__easyv-legend-wrapper",
|
|
96
79
|
style: _objectSpread({
|
|
@@ -106,16 +89,13 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
106
89
|
gridTemplateColumns: 'repeat(' + Math.min(gridTemplateColumns, length) + ', 1fr)'
|
|
107
90
|
}
|
|
108
91
|
}, _series.map(function (series, index) {
|
|
109
|
-
var _series$config
|
|
110
|
-
|
|
92
|
+
var _series$config;
|
|
111
93
|
var type = series.type,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
var _icon = (0, _utils.getIcon)(type, icon, series === null || series === void 0 ? void 0 : (_series$config = series.config) === null || _series$config === void 0 ? void 0 : (_series$config$line = _series$config.line) === null || _series$config$line === void 0 ? void 0 : _series$config$line.type);
|
|
118
|
-
|
|
94
|
+
name = series.name,
|
|
95
|
+
displayName = series.displayName,
|
|
96
|
+
icon = series.icon,
|
|
97
|
+
selected = series.selected;
|
|
98
|
+
var _icon = (0, _utils.getIcon)(type, icon, series === null || series === void 0 || (_series$config = series.config) === null || _series$config === void 0 || (_series$config = _series$config.line) === null || _series$config === void 0 ? void 0 : _series$config.type);
|
|
119
99
|
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
120
100
|
key: index,
|
|
121
101
|
onClick: onClick,
|
|
@@ -141,9 +121,6 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
141
121
|
})));
|
|
142
122
|
})));
|
|
143
123
|
});
|
|
144
|
-
|
|
145
|
-
exports["default"] = _default;
|
|
146
|
-
|
|
147
124
|
var getPosition = function getPosition(position, alignment) {
|
|
148
125
|
switch (position) {
|
|
149
126
|
case 'top':
|
|
@@ -153,7 +130,6 @@ var getPosition = function getPosition(position, alignment) {
|
|
|
153
130
|
top: 5,
|
|
154
131
|
justifyContent: alignment === 'center' ? 'center' : alignment === 'left' ? 'flex-start' : 'flex-end'
|
|
155
132
|
};
|
|
156
|
-
|
|
157
133
|
case 'right':
|
|
158
134
|
return {
|
|
159
135
|
top: 0,
|
|
@@ -161,7 +137,6 @@ var getPosition = function getPosition(position, alignment) {
|
|
|
161
137
|
right: 10,
|
|
162
138
|
alignItems: alignment === 'center' ? 'center' : alignment === 'left' ? 'flex-start' : 'flex-end'
|
|
163
139
|
};
|
|
164
|
-
|
|
165
140
|
case 'left':
|
|
166
141
|
return {
|
|
167
142
|
top: 0,
|
|
@@ -169,7 +144,6 @@ var getPosition = function getPosition(position, alignment) {
|
|
|
169
144
|
left: 10,
|
|
170
145
|
alignItems: alignment === 'center' ? 'center' : alignment === 'left' ? 'flex-start' : 'flex-end'
|
|
171
146
|
};
|
|
172
|
-
|
|
173
147
|
default:
|
|
174
148
|
return {
|
|
175
149
|
left: 0,
|