@easyv/charts 1.6.21 → 1.6.23
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/Band.js +21 -4
- package/lib/components/CartesianChart.js +60 -19
- package/lib/components/Control.js +2 -1
- package/lib/components/Indicator.js +3 -2
- package/lib/components/Label.js +63 -60
- package/lib/hooks/useTooltip.js +4 -5
- package/lib/utils/index.js +17 -1
- package/package.json +1 -1
- package/src/components/Band.tsx +15 -4
- package/src/components/CartesianChart.js +69 -22
- package/src/components/Control.jsx +1 -0
- package/src/components/Indicator.js +3 -2
- package/src/components/Label.js +1 -1
- package/src/hooks/useTooltip.ts +4 -5
- package/src/utils/index.js +12 -0
package/lib/components/Band.js
CHANGED
|
@@ -108,6 +108,8 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
108
108
|
selectStyle = _ref3.selectStyle,
|
|
109
109
|
_ref3$bandLength = _ref3.bandLength,
|
|
110
110
|
bandLength = _ref3$bandLength === void 0 ? 0 : _ref3$bandLength,
|
|
111
|
+
_ref3$auto = _ref3.auto,
|
|
112
|
+
auto = _ref3$auto === void 0 ? false : _ref3$auto,
|
|
111
113
|
data = _ref3.data,
|
|
112
114
|
_ref3$xAxis = _ref3.xAxis,
|
|
113
115
|
normalScaler = _ref3$xAxis.scaler,
|
|
@@ -182,7 +184,17 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
182
184
|
border = _ref5.border,
|
|
183
185
|
opacity = _ref5.opacity,
|
|
184
186
|
headDecorate = _ref5.headDecorate;
|
|
185
|
-
var
|
|
187
|
+
var _ref6 = border || {},
|
|
188
|
+
_ref6$borderColor = _ref6.borderColor,
|
|
189
|
+
_ref6$borderColor$typ = _ref6$borderColor.type,
|
|
190
|
+
type = _ref6$borderColor$typ === void 0 ? "pure" : _ref6$borderColor$typ,
|
|
191
|
+
_ref6$borderColor$pur = _ref6$borderColor.pure,
|
|
192
|
+
pure = _ref6$borderColor$pur === void 0 ? "transparent" : _ref6$borderColor$pur,
|
|
193
|
+
linear = _ref6$borderColor.linear,
|
|
194
|
+
_ref6$borderWidth = _ref6.borderWidth,
|
|
195
|
+
borderWidth = _ref6$borderWidth === void 0 ? 0 : _ref6$borderWidth;
|
|
196
|
+
var borderStr = "".concat(pure, " solid ").concat(borderWidth, "px");
|
|
197
|
+
var borderImageSource = (0, _utils.getMultiColorStr)(linear);
|
|
186
198
|
var positionX = xScaler(x) - step / 2 + seriesStart + index * seriesStep;
|
|
187
199
|
var showHead, headType, headUrl, headVideo, headWidth, headHeight, headTranslate;
|
|
188
200
|
if (headDecorate) {
|
|
@@ -246,7 +258,7 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
246
258
|
}
|
|
247
259
|
},
|
|
248
260
|
onMouseLeave: function onMouseLeave() {
|
|
249
|
-
if (isControlChart) {
|
|
261
|
+
if (isControlChart && !auto) {
|
|
250
262
|
setCtlTip(function (pre) {
|
|
251
263
|
return {
|
|
252
264
|
show: false,
|
|
@@ -300,7 +312,7 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
300
312
|
transform: "translate(calc(-50% + ".concat(headTranslate.x, "px), calc(-50% + ").concat(headTranslate.y, "px))")
|
|
301
313
|
}
|
|
302
314
|
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
303
|
-
style: _objectSpread({
|
|
315
|
+
style: _objectSpread(_objectSpread({
|
|
304
316
|
width: "100%",
|
|
305
317
|
height: "100%",
|
|
306
318
|
/** Safari Bug **/
|
|
@@ -315,7 +327,7 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
315
327
|
positive: y > 0,
|
|
316
328
|
seriesWidth: seriesWidth
|
|
317
329
|
})
|
|
318
|
-
}, isVertical ? {
|
|
330
|
+
}, type == "pure" && (isVertical ? {
|
|
319
331
|
borderTop: borderStr,
|
|
320
332
|
borderRight: borderStr,
|
|
321
333
|
borderBottom: borderStr
|
|
@@ -323,6 +335,11 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
323
335
|
borderTop: borderStr,
|
|
324
336
|
borderRight: borderStr,
|
|
325
337
|
borderLeft: borderStr
|
|
338
|
+
})), type == "linear" && {
|
|
339
|
+
borderImageSource: borderImageSource,
|
|
340
|
+
borderImageSlice: 1,
|
|
341
|
+
borderWidth: isVertical ? "".concat(borderWidth, "px ").concat(borderWidth, "px ").concat(borderWidth, "px 0") : "".concat(borderWidth, "px ").concat(borderWidth, "px 0 ").concat(borderWidth, "px"),
|
|
342
|
+
borderStyle: "solid"
|
|
326
343
|
})
|
|
327
344
|
})));
|
|
328
345
|
}));
|
|
@@ -83,6 +83,8 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
83
83
|
triggerOnRelative = context.triggerOnRelative,
|
|
84
84
|
onEmit = context.onEmit;
|
|
85
85
|
var defaultSelected = selectStyle ? selectStyle.defaultSelected : "";
|
|
86
|
+
var _indicator$zIndex = indicator.zIndex,
|
|
87
|
+
zIndex = _indicator$zIndex === void 0 ? "bottom" : _indicator$zIndex;
|
|
86
88
|
var xLineRange = chartWidth;
|
|
87
89
|
var yLineRange = chartHeight;
|
|
88
90
|
//获取控制条相关的参数
|
|
@@ -149,7 +151,7 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
149
151
|
};
|
|
150
152
|
document.addEventListener("setCurrent_".concat(id), handleAction, false);
|
|
151
153
|
return function () {
|
|
152
|
-
document.removeEventListener("
|
|
154
|
+
document.removeEventListener("setCurrent_".concat(id), handleAction);
|
|
153
155
|
};
|
|
154
156
|
}, []);
|
|
155
157
|
(0, _react.useEffect)(function () {
|
|
@@ -384,6 +386,26 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
384
386
|
});
|
|
385
387
|
var bodyWidth = isVertical ? xLineRange + 100 + marginRight + marginLeft : xLineRange,
|
|
386
388
|
bodyHeight = isVertical ? yLineRange : yLineRange + marginTop + marginBottom;
|
|
389
|
+
(0, _react.useEffect)(function () {
|
|
390
|
+
setCtlTip(function (pre) {
|
|
391
|
+
return {
|
|
392
|
+
show: !!tickName,
|
|
393
|
+
x: tooltipX,
|
|
394
|
+
xName: tickName,
|
|
395
|
+
indicatorList: pre.indicatorList.map(function (item) {
|
|
396
|
+
if (item.tick === tickName) {
|
|
397
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
398
|
+
isShow: true
|
|
399
|
+
});
|
|
400
|
+
} else {
|
|
401
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
402
|
+
isShow: false
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
})
|
|
406
|
+
};
|
|
407
|
+
});
|
|
408
|
+
}, [tooltipX, tickName]);
|
|
387
409
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_.ChartContainer, {
|
|
388
410
|
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
389
411
|
position: "absolute"
|
|
@@ -395,7 +417,7 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
395
417
|
onMouseEnter: function onMouseEnter() {
|
|
396
418
|
setIsHover(true);
|
|
397
419
|
},
|
|
398
|
-
onMouseMove: setIndex,
|
|
420
|
+
onMouseMove: !control ? setIndex : null,
|
|
399
421
|
onMouseLeave: function onMouseLeave(e) {
|
|
400
422
|
setIsHover(false);
|
|
401
423
|
setIndex(e);
|
|
@@ -441,8 +463,9 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
441
463
|
}, config, {
|
|
442
464
|
key: index
|
|
443
465
|
}));
|
|
444
|
-
}), showTooltip && !control && /*#__PURE__*/_react["default"].createElement(_.Indicator, (0, _extends2["default"])({}, indicator, {
|
|
445
|
-
manual: manual
|
|
466
|
+
}), showTooltip && !control && zIndex == "bottom" && /*#__PURE__*/_react["default"].createElement(_.Indicator, (0, _extends2["default"])({}, indicator, {
|
|
467
|
+
manual: manual,
|
|
468
|
+
auto: auto
|
|
446
469
|
}, indicatorAttr)), /*#__PURE__*/_react["default"].createElement("foreignObject", {
|
|
447
470
|
style: {
|
|
448
471
|
width: bodyWidth,
|
|
@@ -458,7 +481,7 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
458
481
|
position: "absolute",
|
|
459
482
|
transform: isVertical ? "translate(".concat(marginRight, "px,").concat(isIOS ? marginTop : 0, "px)") : "translate(".concat(isIOS ? marginLeft : 0, "px,").concat(marginTop, "px)")
|
|
460
483
|
}
|
|
461
|
-
}, /*#__PURE__*/_react["default"].createElement("g", null, control && ctlIndicatorList.map(function (item, index) {
|
|
484
|
+
}, /*#__PURE__*/_react["default"].createElement("g", null, control && zIndex == "bottom" && ctlIndicatorList.map(function (item, index) {
|
|
462
485
|
var x = axisX.scaler(item.tick);
|
|
463
486
|
return /*#__PURE__*/_react["default"].createElement(_.Indicator, (0, _extends2["default"])({
|
|
464
487
|
key: index
|
|
@@ -484,7 +507,8 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
484
507
|
curXLabel: curXLabel,
|
|
485
508
|
selectStyle: selectStyle,
|
|
486
509
|
xAxis: axisX,
|
|
487
|
-
yAxis: yAxis
|
|
510
|
+
yAxis: yAxis,
|
|
511
|
+
auto: auto
|
|
488
512
|
// 控制图部分,主要是为了,当鼠标悬浮在指示器上时,显示对应的tooltip
|
|
489
513
|
,
|
|
490
514
|
isControlChart: !!control,
|
|
@@ -507,6 +531,32 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
507
531
|
yAxis: yAxis,
|
|
508
532
|
triggerClick: onInteraction
|
|
509
533
|
}));
|
|
534
|
+
}), /*#__PURE__*/_react["default"].createElement("g", null, control && zIndex != "bottom" && ctlIndicatorList.map(function (item, index) {
|
|
535
|
+
var x = axisX.scaler(item.tick);
|
|
536
|
+
return /*#__PURE__*/_react["default"].createElement(_.Indicator, (0, _extends2["default"])({
|
|
537
|
+
key: index
|
|
538
|
+
}, indicator, {
|
|
539
|
+
height: yLineRange,
|
|
540
|
+
width: indicatorWidth,
|
|
541
|
+
x: x - indicatorWidth / 2,
|
|
542
|
+
isControlChart: !!control,
|
|
543
|
+
xName: item.tick,
|
|
544
|
+
setCtlTip: setCtlTip,
|
|
545
|
+
ctlIndicatorList: ctlIndicatorList,
|
|
546
|
+
manual: manual
|
|
547
|
+
}));
|
|
548
|
+
}))), showCtl && !!control && /*#__PURE__*/_react["default"].createElement(_.Tooltip, (0, _extends2["default"])({
|
|
549
|
+
isVertical: isVertical
|
|
550
|
+
}, tooltip, {
|
|
551
|
+
data: controlChartTooltipData,
|
|
552
|
+
x: ctlX - marginLeft - (axisX.controlEnd + axisX.start / cPercent - chartWidth) * curControlPercent.current,
|
|
553
|
+
marginLeft: marginLeft,
|
|
554
|
+
marginTop: marginTop,
|
|
555
|
+
tickName: ctlXName,
|
|
556
|
+
series: series,
|
|
557
|
+
width: width,
|
|
558
|
+
height: height,
|
|
559
|
+
manual: manual
|
|
510
560
|
}))), baseLineData && baseLineData.length > 0 && baseLineData.map(function (item, index) {
|
|
511
561
|
var yOrZ = baseLineConfig[index].line.yOrZ;
|
|
512
562
|
var yAxis = axes.get(yOrZ);
|
|
@@ -521,7 +571,10 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
521
571
|
axisX: axisX,
|
|
522
572
|
data: item
|
|
523
573
|
});
|
|
524
|
-
})
|
|
574
|
+
}), showTooltip && !control && zIndex != "bottom" && /*#__PURE__*/_react["default"].createElement(_.Indicator, (0, _extends2["default"])({}, indicator, {
|
|
575
|
+
manual: manual,
|
|
576
|
+
auto: auto
|
|
577
|
+
}, indicatorAttr))), control && /*#__PURE__*/_react["default"].createElement(_.Control, {
|
|
525
578
|
ref: controlEl,
|
|
526
579
|
actions: {
|
|
527
580
|
setX: setControlTranslate,
|
|
@@ -551,18 +604,6 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
551
604
|
width: width,
|
|
552
605
|
height: height,
|
|
553
606
|
manual: manual
|
|
554
|
-
})), showCtl && !!control && /*#__PURE__*/_react["default"].createElement(_.Tooltip, (0, _extends2["default"])({
|
|
555
|
-
isVertical: isVertical
|
|
556
|
-
}, tooltip, {
|
|
557
|
-
data: controlChartTooltipData,
|
|
558
|
-
x: ctlX - (axisX.controlEnd + axisX.start / cPercent - chartWidth) * curControlPercent.current,
|
|
559
|
-
marginLeft: marginLeft,
|
|
560
|
-
marginTop: marginTop,
|
|
561
|
-
tickName: ctlXName,
|
|
562
|
-
series: series,
|
|
563
|
-
width: width,
|
|
564
|
-
height: height,
|
|
565
|
-
manual: manual
|
|
566
607
|
})), brush && /*#__PURE__*/_react["default"].createElement(_.Brush, {
|
|
567
608
|
config: brush,
|
|
568
609
|
width: width
|
|
@@ -251,7 +251,8 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(
|
|
|
251
251
|
}, config, {
|
|
252
252
|
bandLength: bandLength,
|
|
253
253
|
xAxis: xAxis,
|
|
254
|
-
yAxis: cloneYAxis
|
|
254
|
+
yAxis: cloneYAxis,
|
|
255
|
+
triggerClick: function triggerClick() {}
|
|
255
256
|
}));
|
|
256
257
|
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
257
258
|
ref: ref,
|
|
@@ -25,7 +25,8 @@ var _default = exports["default"] = function _default(_ref) {
|
|
|
25
25
|
xName = _ref$xName === void 0 ? null : _ref$xName,
|
|
26
26
|
ctlIndicatorList = _ref.ctlIndicatorList,
|
|
27
27
|
setCtlTip = _ref.setCtlTip,
|
|
28
|
-
manual = _ref.manual
|
|
28
|
+
manual = _ref.manual,
|
|
29
|
+
auto = _ref.auto;
|
|
29
30
|
var isShow = true;
|
|
30
31
|
if (isControlChart && ctlIndicatorList) {
|
|
31
32
|
isShow = ctlIndicatorList.find(function (item) {
|
|
@@ -57,7 +58,7 @@ var _default = exports["default"] = function _default(_ref) {
|
|
|
57
58
|
}
|
|
58
59
|
},
|
|
59
60
|
onMouseLeave: function onMouseLeave() {
|
|
60
|
-
if (isControlChart) {
|
|
61
|
+
if (isControlChart && !auto) {
|
|
61
62
|
setCtlTip(function (pre) {
|
|
62
63
|
return {
|
|
63
64
|
show: false,
|
package/lib/components/Label.js
CHANGED
|
@@ -96,8 +96,11 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
96
96
|
label = _ref3.label;
|
|
97
97
|
var showIcon = icon && icon.show;
|
|
98
98
|
var showLabel = label && label.show;
|
|
99
|
-
var
|
|
100
|
-
|
|
99
|
+
var _ref4 = label || {},
|
|
100
|
+
_ref4$position = _ref4.position,
|
|
101
|
+
_position = _ref4$position === void 0 ? "outerStart" : _ref4$position,
|
|
102
|
+
_ref4$reverse = _ref4.reverse,
|
|
103
|
+
reverse = _ref4$reverse === void 0 ? true : _ref4$reverse;
|
|
101
104
|
if (isClipAxis) {
|
|
102
105
|
if (end > +clipValue) {
|
|
103
106
|
y1 = yScaler[1](start);
|
|
@@ -158,28 +161,28 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
158
161
|
}, attr)));
|
|
159
162
|
}));
|
|
160
163
|
});
|
|
161
|
-
var Label = function Label(
|
|
162
|
-
var x =
|
|
163
|
-
y =
|
|
164
|
-
value =
|
|
165
|
-
|
|
166
|
-
font =
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
translateX =
|
|
170
|
-
|
|
171
|
-
translateY =
|
|
172
|
-
|
|
173
|
-
content =
|
|
174
|
-
suffixFont =
|
|
175
|
-
|
|
176
|
-
suffixX =
|
|
177
|
-
suffixY =
|
|
178
|
-
|
|
179
|
-
textAnchor =
|
|
180
|
-
|
|
181
|
-
dominantBaseline =
|
|
182
|
-
reverse =
|
|
164
|
+
var Label = function Label(_ref5) {
|
|
165
|
+
var x = _ref5.x,
|
|
166
|
+
y = _ref5.y,
|
|
167
|
+
value = _ref5.value,
|
|
168
|
+
_ref5$config = _ref5.config,
|
|
169
|
+
font = _ref5$config.font,
|
|
170
|
+
_ref5$config$translat = _ref5$config.translate,
|
|
171
|
+
_ref5$config$translat2 = _ref5$config$translat.x,
|
|
172
|
+
translateX = _ref5$config$translat2 === void 0 ? 0 : _ref5$config$translat2,
|
|
173
|
+
_ref5$config$translat3 = _ref5$config$translat.y,
|
|
174
|
+
translateY = _ref5$config$translat3 === void 0 ? 0 : _ref5$config$translat3,
|
|
175
|
+
_ref5$config$suffix = _ref5$config.suffix,
|
|
176
|
+
content = _ref5$config$suffix.content,
|
|
177
|
+
suffixFont = _ref5$config$suffix.font,
|
|
178
|
+
_ref5$config$suffix$t = _ref5$config$suffix.translate,
|
|
179
|
+
suffixX = _ref5$config$suffix$t.x,
|
|
180
|
+
suffixY = _ref5$config$suffix$t.y,
|
|
181
|
+
_ref5$textAnchor = _ref5.textAnchor,
|
|
182
|
+
textAnchor = _ref5$textAnchor === void 0 ? "middle" : _ref5$textAnchor,
|
|
183
|
+
_ref5$dominantBaselin = _ref5.dominantBaseline,
|
|
184
|
+
dominantBaseline = _ref5$dominantBaselin === void 0 ? "middle" : _ref5$dominantBaselin,
|
|
185
|
+
reverse = _ref5.reverse;
|
|
183
186
|
return /*#__PURE__*/React.createElement("text", {
|
|
184
187
|
x: x,
|
|
185
188
|
y: y,
|
|
@@ -196,19 +199,19 @@ var Label = function Label(_ref4) {
|
|
|
196
199
|
style: _objectSpread({}, (0, _utils.getFontStyle)(suffixFont, "svg"))
|
|
197
200
|
}, content));
|
|
198
201
|
};
|
|
199
|
-
var Icon = function Icon(
|
|
200
|
-
var cx =
|
|
201
|
-
cy =
|
|
202
|
-
|
|
203
|
-
mode =
|
|
204
|
-
inner =
|
|
205
|
-
outer =
|
|
206
|
-
color =
|
|
207
|
-
radius =
|
|
208
|
-
image =
|
|
209
|
-
|
|
210
|
-
width =
|
|
211
|
-
height =
|
|
202
|
+
var Icon = function Icon(_ref6) {
|
|
203
|
+
var cx = _ref6.cx,
|
|
204
|
+
cy = _ref6.cy,
|
|
205
|
+
_ref6$config = _ref6.config,
|
|
206
|
+
mode = _ref6$config.mode,
|
|
207
|
+
inner = _ref6$config.inner,
|
|
208
|
+
outer = _ref6$config.outer,
|
|
209
|
+
color = _ref6$config.color,
|
|
210
|
+
radius = _ref6$config.radius,
|
|
211
|
+
image = _ref6$config.image,
|
|
212
|
+
_ref6$config$size = _ref6$config.size,
|
|
213
|
+
width = _ref6$config$size.width,
|
|
214
|
+
height = _ref6$config$size.height;
|
|
212
215
|
return mode == "single" ? /*#__PURE__*/React.createElement(Circle, {
|
|
213
216
|
cx: cx,
|
|
214
217
|
cy: cy,
|
|
@@ -228,11 +231,11 @@ var Icon = function Icon(_ref5) {
|
|
|
228
231
|
xlinkHref: window.appConfig.ASSETS_URL + image
|
|
229
232
|
}));
|
|
230
233
|
};
|
|
231
|
-
var Circle = function Circle(
|
|
232
|
-
var cx =
|
|
233
|
-
cy =
|
|
234
|
-
color =
|
|
235
|
-
radius =
|
|
234
|
+
var Circle = function Circle(_ref7) {
|
|
235
|
+
var cx = _ref7.cx,
|
|
236
|
+
cy = _ref7.cy,
|
|
237
|
+
color = _ref7.color,
|
|
238
|
+
radius = _ref7.radius;
|
|
236
239
|
return /*#__PURE__*/React.createElement("circle", {
|
|
237
240
|
cx: cx,
|
|
238
241
|
cy: cy,
|
|
@@ -241,15 +244,15 @@ var Circle = function Circle(_ref6) {
|
|
|
241
244
|
stroke: "none"
|
|
242
245
|
});
|
|
243
246
|
};
|
|
244
|
-
var getVerticalLabel = function getVerticalLabel(
|
|
245
|
-
var
|
|
246
|
-
position =
|
|
247
|
-
width =
|
|
248
|
-
y =
|
|
249
|
-
y1 =
|
|
250
|
-
y2 =
|
|
251
|
-
|
|
252
|
-
reverse =
|
|
247
|
+
var getVerticalLabel = function getVerticalLabel(_ref8) {
|
|
248
|
+
var _ref8$position = _ref8.position,
|
|
249
|
+
position = _ref8$position === void 0 ? "outerStart" : _ref8$position,
|
|
250
|
+
width = _ref8.width,
|
|
251
|
+
y = _ref8.y,
|
|
252
|
+
y1 = _ref8.y1,
|
|
253
|
+
y2 = _ref8.y2,
|
|
254
|
+
_ref8$reverse = _ref8.reverse,
|
|
255
|
+
reverse = _ref8$reverse === void 0 ? true : _ref8$reverse;
|
|
253
256
|
var needReverse = reverse && y < 0;
|
|
254
257
|
switch (position) {
|
|
255
258
|
case "start":
|
|
@@ -279,15 +282,15 @@ var getVerticalLabel = function getVerticalLabel(_ref7) {
|
|
|
279
282
|
};
|
|
280
283
|
}
|
|
281
284
|
};
|
|
282
|
-
var getHorizontalLabel = function getHorizontalLabel(
|
|
283
|
-
var
|
|
284
|
-
position =
|
|
285
|
-
height =
|
|
286
|
-
y =
|
|
287
|
-
y1 =
|
|
288
|
-
y2 =
|
|
289
|
-
|
|
290
|
-
reverse =
|
|
285
|
+
var getHorizontalLabel = function getHorizontalLabel(_ref9) {
|
|
286
|
+
var _ref9$position = _ref9.position,
|
|
287
|
+
position = _ref9$position === void 0 ? "outerStart" : _ref9$position,
|
|
288
|
+
height = _ref9.height,
|
|
289
|
+
y = _ref9.y,
|
|
290
|
+
y1 = _ref9.y1,
|
|
291
|
+
y2 = _ref9.y2,
|
|
292
|
+
_ref9$reverse = _ref9.reverse,
|
|
293
|
+
reverse = _ref9$reverse === void 0 ? true : _ref9$reverse;
|
|
291
294
|
var needReverse = reverse && y < 0;
|
|
292
295
|
switch (position) {
|
|
293
296
|
case "start":
|
package/lib/hooks/useTooltip.js
CHANGED
|
@@ -37,7 +37,7 @@ var _default = exports["default"] = function _default(_ref) {
|
|
|
37
37
|
interval = _ref$config2$interval === void 0 ? 0 : _ref$config2$interval,
|
|
38
38
|
manual = _ref$config2.manual,
|
|
39
39
|
active = _ref.active;
|
|
40
|
-
var _useState = (0, _react.useState)(
|
|
40
|
+
var _useState = (0, _react.useState)(-1),
|
|
41
41
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
42
42
|
currentIndex = _useState2[0],
|
|
43
43
|
setCurrentIndex = _useState2[1];
|
|
@@ -72,7 +72,7 @@ var _default = exports["default"] = function _default(_ref) {
|
|
|
72
72
|
} else {
|
|
73
73
|
// 鼠标划出后,如果开启了自动轮播,就不需要让提示框消失了
|
|
74
74
|
if (!auto) {
|
|
75
|
-
setCurrentIndex(
|
|
75
|
+
setCurrentIndex(-1);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -82,8 +82,7 @@ var _default = exports["default"] = function _default(_ref) {
|
|
|
82
82
|
// if (!!on) setCurrentIndex(0);
|
|
83
83
|
var intervalHandler = on ? setInterval(function () {
|
|
84
84
|
setCurrentIndex(function (index) {
|
|
85
|
-
var
|
|
86
|
-
var currentIndex = tmp + 1;
|
|
85
|
+
var currentIndex = index + 1;
|
|
87
86
|
if (currentIndex >= tickLength) {
|
|
88
87
|
return 0;
|
|
89
88
|
}
|
|
@@ -94,7 +93,7 @@ var _default = exports["default"] = function _default(_ref) {
|
|
|
94
93
|
intervalHandler && clearInterval(intervalHandler);
|
|
95
94
|
};
|
|
96
95
|
}, [auto, tickLength, interval, isHover, active]);
|
|
97
|
-
var name = currentIndex ===
|
|
96
|
+
var name = currentIndex === -1 ? null : axisX.allTicks[currentIndex];
|
|
98
97
|
return {
|
|
99
98
|
name: name,
|
|
100
99
|
x: axisX.scaler(name),
|
package/lib/utils/index.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.band = band;
|
|
8
|
-
exports.sortPie = exports.seriesYOrZ = exports.resetStacks = exports.reduceConfig = exports.mathR = exports.isValidHttpUrl = exports.identity = exports.getTranslate3d = exports.getTranslate2d = exports.getTicksOfAxis = exports.getTickCoord = exports.getStacks = exports.getSeriesInfo = exports.getMousePos = exports.getMargin = exports.getIcon = exports.getGridCoord = exports.getFontStyle = exports.getDomPath = exports.getDataWithPercent = exports.getCurrentStack = exports.getColorList = exports.getChildren = exports.getBreakWord = exports.getBandwidth = exports.getBandSeriesStepAndWidth = exports.getBandBackground = exports.formatFont = exports.filterChildren = exports.dateFormat = exports.dataYOrZ = void 0;
|
|
8
|
+
exports.sortPie = exports.seriesYOrZ = exports.resetStacks = exports.reduceConfig = exports.mathR = exports.isValidHttpUrl = exports.identity = exports.getTranslate3d = exports.getTranslate2d = exports.getTicksOfAxis = exports.getTickCoord = exports.getStacks = exports.getSeriesInfo = exports.getMultiColorStr = exports.getMousePos = exports.getMargin = exports.getIcon = exports.getGridCoord = exports.getFontStyle = exports.getDomPath = exports.getDataWithPercent = exports.getCurrentStack = exports.getColorList = exports.getChildren = exports.getBreakWord = exports.getBandwidth = exports.getBandSeriesStepAndWidth = exports.getBandBackground = exports.formatFont = exports.filterChildren = exports.dateFormat = exports.dataYOrZ = void 0;
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
@@ -99,6 +99,22 @@ var getColorList = exports.getColorList = function getColorList(_ref3) {
|
|
|
99
99
|
};
|
|
100
100
|
});
|
|
101
101
|
};
|
|
102
|
+
var getMultiColorStr = exports.getMultiColorStr = function getMultiColorStr(colors) {
|
|
103
|
+
var stops = colors.stops,
|
|
104
|
+
angle = colors.angle;
|
|
105
|
+
var result = 'linear-gradient(' + angle + 'deg, ';
|
|
106
|
+
var stops_ = JSON.parse(JSON.stringify(stops));
|
|
107
|
+
stops_.sort(function (a, b) {
|
|
108
|
+
return a.offset - b.offset;
|
|
109
|
+
});
|
|
110
|
+
for (var i = 0; i < stops_.length; i++) {
|
|
111
|
+
var _stops_$i = stops_[i],
|
|
112
|
+
color = _stops_$i.color,
|
|
113
|
+
offset = _stops_$i.offset;
|
|
114
|
+
result += "".concat(color, " ").concat(offset, "%,");
|
|
115
|
+
}
|
|
116
|
+
return result.slice(0, -1) + ")";
|
|
117
|
+
};
|
|
102
118
|
var getIcon = exports.getIcon = function getIcon(type, icon) {
|
|
103
119
|
var lineType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "solid";
|
|
104
120
|
switch (type) {
|
package/package.json
CHANGED
package/src/components/Band.tsx
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import React, { memo, Fragment } from "react";
|
|
5
5
|
import { min, max } from "d3v7";
|
|
6
|
-
import { getBandBackground, getSeriesInfo } from "../utils";
|
|
6
|
+
import { getBandBackground, getMultiColorStr, getSeriesInfo } from "../utils";
|
|
7
7
|
|
|
8
8
|
const getHighlightData = (data: Array<DataWithBoundType>, extent: string) => {
|
|
9
9
|
switch (extent) {
|
|
@@ -97,6 +97,7 @@ export default memo(
|
|
|
97
97
|
curXLabel,
|
|
98
98
|
selectStyle,
|
|
99
99
|
bandLength = 0,
|
|
100
|
+
auto = false,
|
|
100
101
|
data,
|
|
101
102
|
xAxis: { scaler: normalScaler, step:normalStep, controlStep, direction, controlDragScaler },
|
|
102
103
|
yAxis: { scaler: yScaler, isClipAxis, clipValue, reverse },
|
|
@@ -157,7 +158,11 @@ export default memo(
|
|
|
157
158
|
opacity,
|
|
158
159
|
headDecorate
|
|
159
160
|
} = x==curXLabel?selectConfig:other;
|
|
160
|
-
const
|
|
161
|
+
const { borderColor:{
|
|
162
|
+
type="pure", pure="transparent", linear
|
|
163
|
+
}, borderWidth=0 } = border || {};
|
|
164
|
+
const borderStr = `${pure} solid ${borderWidth}px`;
|
|
165
|
+
const borderImageSource = getMultiColorStr(linear);
|
|
161
166
|
const positionX = xScaler(x) - step / 2 + seriesStart + index * seriesStep;
|
|
162
167
|
|
|
163
168
|
let showHead, headType, headUrl, headVideo, headWidth, headHeight, headTranslate;
|
|
@@ -217,7 +222,7 @@ export default memo(
|
|
|
217
222
|
}
|
|
218
223
|
}}
|
|
219
224
|
onMouseLeave={() => {
|
|
220
|
-
if(isControlChart){
|
|
225
|
+
if(isControlChart && !auto){
|
|
221
226
|
setCtlTip((pre:any)=>({
|
|
222
227
|
show:false,
|
|
223
228
|
x:undefined,
|
|
@@ -296,7 +301,7 @@ export default memo(
|
|
|
296
301
|
positive: y > 0,
|
|
297
302
|
seriesWidth,
|
|
298
303
|
}),
|
|
299
|
-
...(isVertical
|
|
304
|
+
...type=="pure" && (isVertical
|
|
300
305
|
? {
|
|
301
306
|
borderTop: borderStr,
|
|
302
307
|
borderRight: borderStr,
|
|
@@ -307,6 +312,12 @@ export default memo(
|
|
|
307
312
|
borderRight: borderStr,
|
|
308
313
|
borderLeft: borderStr,
|
|
309
314
|
}),
|
|
315
|
+
...type=="linear" && {
|
|
316
|
+
borderImageSource,
|
|
317
|
+
borderImageSlice:1,
|
|
318
|
+
borderWidth:isVertical?`${borderWidth}px ${borderWidth}px ${borderWidth}px 0`:`${borderWidth}px ${borderWidth}px 0 ${borderWidth}px`,
|
|
319
|
+
borderStyle:"solid"
|
|
320
|
+
}
|
|
310
321
|
}}
|
|
311
322
|
/>
|
|
312
323
|
</foreignObject>
|
|
@@ -78,6 +78,7 @@ const Chart = memo(
|
|
|
78
78
|
onEmit,
|
|
79
79
|
} = context;
|
|
80
80
|
const defaultSelected = selectStyle?selectStyle.defaultSelected:"";
|
|
81
|
+
const { zIndex="bottom" } = indicator;
|
|
81
82
|
const xLineRange = chartWidth;
|
|
82
83
|
let yLineRange = chartHeight;
|
|
83
84
|
//获取控制条相关的参数
|
|
@@ -131,7 +132,7 @@ const Chart = memo(
|
|
|
131
132
|
}
|
|
132
133
|
document.addEventListener(`setCurrent_${id}`,handleAction,false);
|
|
133
134
|
return ()=>{
|
|
134
|
-
document.removeEventListener(`
|
|
135
|
+
document.removeEventListener(`setCurrent_${id}`,handleAction);
|
|
135
136
|
}
|
|
136
137
|
},[]);
|
|
137
138
|
useEffect(()=>{
|
|
@@ -363,8 +364,24 @@ const Chart = memo(
|
|
|
363
364
|
const { show:showCtl, xName:ctlXName, x:ctlX, indicatorList:ctlIndicatorList } = ctlTip;
|
|
364
365
|
const controlChartTooltipData = ctlXName && originData.filter((d) => d.x === ctlXName);
|
|
365
366
|
const bodyWidth = isVertical?xLineRange + 100 + marginRight + marginLeft:xLineRange,
|
|
366
|
-
|
|
367
|
+
bodyHeight = isVertical?yLineRange:yLineRange + marginTop + marginBottom;
|
|
368
|
+
|
|
369
|
+
useEffect(()=>{
|
|
370
|
+
setCtlTip(pre=>{
|
|
371
|
+
return {
|
|
372
|
+
show:!!tickName, x:tooltipX, xName:tickName,
|
|
373
|
+
indicatorList:pre.indicatorList.map((item)=>{
|
|
374
|
+
if (item.tick === tickName) {
|
|
375
|
+
return { ...item, isShow:true };
|
|
376
|
+
} else {
|
|
377
|
+
return { ...item, isShow:false };
|
|
378
|
+
}
|
|
379
|
+
})
|
|
380
|
+
}
|
|
381
|
+
})
|
|
382
|
+
},[tooltipX, tickName]);
|
|
367
383
|
|
|
384
|
+
|
|
368
385
|
return (
|
|
369
386
|
<>
|
|
370
387
|
<ChartContainer
|
|
@@ -376,7 +393,7 @@ const Chart = memo(
|
|
|
376
393
|
onMouseEnter={() => {
|
|
377
394
|
setIsHover(true);
|
|
378
395
|
}}
|
|
379
|
-
onMouseMove={setIndex}
|
|
396
|
+
onMouseMove={!control?setIndex:null}
|
|
380
397
|
onMouseLeave={(e) => {
|
|
381
398
|
setIsHover(false);
|
|
382
399
|
setIndex(e);
|
|
@@ -426,8 +443,9 @@ const Chart = memo(
|
|
|
426
443
|
/>
|
|
427
444
|
);
|
|
428
445
|
})}
|
|
429
|
-
{
|
|
430
|
-
|
|
446
|
+
{/* 非控制图下的指示器 */}
|
|
447
|
+
{showTooltip && !control && zIndex=="bottom" && (
|
|
448
|
+
<Indicator {...indicator} manual= {manual} auto={auto} {...indicatorAttr} />
|
|
431
449
|
)}
|
|
432
450
|
<foreignObject
|
|
433
451
|
style={
|
|
@@ -452,7 +470,7 @@ const Chart = memo(
|
|
|
452
470
|
>
|
|
453
471
|
{/* 控制图指示器部分 */}
|
|
454
472
|
<g>
|
|
455
|
-
{control &&
|
|
473
|
+
{control && zIndex=="bottom" &&
|
|
456
474
|
ctlIndicatorList.map((item, index) => {
|
|
457
475
|
const x = axisX.scaler(item.tick);
|
|
458
476
|
return (
|
|
@@ -487,6 +505,7 @@ const Chart = memo(
|
|
|
487
505
|
selectStyle={selectStyle}
|
|
488
506
|
xAxis={axisX}
|
|
489
507
|
yAxis={yAxis}
|
|
508
|
+
auto={auto}
|
|
490
509
|
// 控制图部分,主要是为了,当鼠标悬浮在指示器上时,显示对应的tooltip
|
|
491
510
|
isControlChart={!!control}
|
|
492
511
|
indicatorWidth={indicatorWidth}
|
|
@@ -496,7 +515,7 @@ const Chart = memo(
|
|
|
496
515
|
)
|
|
497
516
|
);
|
|
498
517
|
})}
|
|
499
|
-
|
|
518
|
+
{/* 图表数值标签 */}
|
|
500
519
|
{series.map(({ Component, yOrZ, ...config }, index) => {
|
|
501
520
|
const yAxis = axes.get(yOrZ);
|
|
502
521
|
return (
|
|
@@ -514,7 +533,45 @@ const Chart = memo(
|
|
|
514
533
|
)
|
|
515
534
|
);
|
|
516
535
|
})}
|
|
536
|
+
<g>
|
|
537
|
+
{control && zIndex!="bottom" &&
|
|
538
|
+
ctlIndicatorList.map((item, index) => {
|
|
539
|
+
const x = axisX.scaler(item.tick);
|
|
540
|
+
return (
|
|
541
|
+
<Indicator
|
|
542
|
+
key={index}
|
|
543
|
+
{...indicator}
|
|
544
|
+
{...{
|
|
545
|
+
height: yLineRange,
|
|
546
|
+
width: indicatorWidth,
|
|
547
|
+
x: x - indicatorWidth / 2,
|
|
548
|
+
}}
|
|
549
|
+
isControlChart={!!control}
|
|
550
|
+
xName={item.tick}
|
|
551
|
+
setCtlTip={setCtlTip}
|
|
552
|
+
ctlIndicatorList={ctlIndicatorList}
|
|
553
|
+
manual= {manual}
|
|
554
|
+
/>
|
|
555
|
+
);
|
|
556
|
+
})}
|
|
557
|
+
</g>
|
|
517
558
|
</svg>
|
|
559
|
+
{/* 控制图下的提示框 */}
|
|
560
|
+
{showCtl && !!control && (
|
|
561
|
+
<Tooltip
|
|
562
|
+
isVertical={isVertical}
|
|
563
|
+
{...tooltip}
|
|
564
|
+
data={controlChartTooltipData}
|
|
565
|
+
x={ ctlX - marginLeft -(axisX.controlEnd + axisX.start/cPercent - chartWidth) * curControlPercent.current}
|
|
566
|
+
marginLeft={marginLeft}
|
|
567
|
+
marginTop={marginTop}
|
|
568
|
+
tickName={ctlXName}
|
|
569
|
+
series={series}
|
|
570
|
+
width={width}
|
|
571
|
+
height={height}
|
|
572
|
+
manual= {manual}
|
|
573
|
+
/>
|
|
574
|
+
)}
|
|
518
575
|
</foreignObject>
|
|
519
576
|
{baseLineData &&
|
|
520
577
|
baseLineData.length > 0 &&
|
|
@@ -539,6 +596,10 @@ const Chart = memo(
|
|
|
539
596
|
)
|
|
540
597
|
);
|
|
541
598
|
})}
|
|
599
|
+
{/* 非控制图下的指示器 */}
|
|
600
|
+
{showTooltip && !control && zIndex!="bottom" && (
|
|
601
|
+
<Indicator {...indicator} manual= {manual} auto={auto} {...indicatorAttr} />
|
|
602
|
+
)}
|
|
542
603
|
</ChartContainer>
|
|
543
604
|
{/* 控制条逻辑 */}
|
|
544
605
|
{control && (
|
|
@@ -560,6 +621,7 @@ const Chart = memo(
|
|
|
560
621
|
></Control>
|
|
561
622
|
)}
|
|
562
623
|
<Legend {...legend} filterData={filterData} series={series} />
|
|
624
|
+
{/* 非控制图下的提示框 */}
|
|
563
625
|
{showTooltip && !control && (
|
|
564
626
|
<Tooltip
|
|
565
627
|
isVertical={isVertical}
|
|
@@ -575,21 +637,6 @@ const Chart = memo(
|
|
|
575
637
|
manual= {manual}
|
|
576
638
|
/>
|
|
577
639
|
)}
|
|
578
|
-
{showCtl && !!control && (
|
|
579
|
-
<Tooltip
|
|
580
|
-
isVertical={isVertical}
|
|
581
|
-
{...tooltip}
|
|
582
|
-
data={controlChartTooltipData}
|
|
583
|
-
x={ ctlX -(axisX.controlEnd + axisX.start/cPercent - chartWidth) * curControlPercent.current}
|
|
584
|
-
marginLeft={marginLeft}
|
|
585
|
-
marginTop={marginTop}
|
|
586
|
-
tickName={ctlXName}
|
|
587
|
-
series={series}
|
|
588
|
-
width={width}
|
|
589
|
-
height={height}
|
|
590
|
-
manual= {manual}
|
|
591
|
-
/>
|
|
592
|
-
)}
|
|
593
640
|
{brush && <Brush config={brush} width={width} />}
|
|
594
641
|
</>
|
|
595
642
|
);
|
|
@@ -12,7 +12,8 @@ export default ({
|
|
|
12
12
|
xName = null,
|
|
13
13
|
ctlIndicatorList,
|
|
14
14
|
setCtlTip,
|
|
15
|
-
manual
|
|
15
|
+
manual,
|
|
16
|
+
auto
|
|
16
17
|
}) => {
|
|
17
18
|
let isShow = true;
|
|
18
19
|
if (isControlChart && ctlIndicatorList) {
|
|
@@ -40,7 +41,7 @@ export default ({
|
|
|
40
41
|
}
|
|
41
42
|
}}
|
|
42
43
|
onMouseLeave={() => {
|
|
43
|
-
if (isControlChart) {
|
|
44
|
+
if (isControlChart && !auto) {
|
|
44
45
|
setCtlTip((pre)=>({
|
|
45
46
|
show:false,
|
|
46
47
|
x:undefined,
|
package/src/components/Label.js
CHANGED
|
@@ -57,7 +57,7 @@ export default memo(
|
|
|
57
57
|
const { icon, label } = x==curXLabel?selectConfig:other;
|
|
58
58
|
const showIcon = icon && icon.show;
|
|
59
59
|
const showLabel = label && label.show;
|
|
60
|
-
const { position:_position, reverse } = label;
|
|
60
|
+
const { position:_position="outerStart", reverse=true } = label || {};
|
|
61
61
|
if (isClipAxis) {
|
|
62
62
|
if (end > +clipValue) {
|
|
63
63
|
y1 = yScaler[1](start);
|
package/src/hooks/useTooltip.ts
CHANGED
|
@@ -37,7 +37,7 @@ export default ({
|
|
|
37
37
|
config: { auto, interval = 0, manual } = {},
|
|
38
38
|
active
|
|
39
39
|
}: Props) => {
|
|
40
|
-
const [currentIndex, setCurrentIndex] = useState<number
|
|
40
|
+
const [currentIndex, setCurrentIndex] = useState<number>(-1);
|
|
41
41
|
const tickLength = axisX.allTicks.length;
|
|
42
42
|
const setIndex = useCallback(
|
|
43
43
|
(e: any) => {
|
|
@@ -68,7 +68,7 @@ export default ({
|
|
|
68
68
|
} else {
|
|
69
69
|
// 鼠标划出后,如果开启了自动轮播,就不需要让提示框消失了
|
|
70
70
|
if (!auto) {
|
|
71
|
-
setCurrentIndex(
|
|
71
|
+
setCurrentIndex(-1);
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -81,8 +81,7 @@ export default ({
|
|
|
81
81
|
const intervalHandler = on
|
|
82
82
|
? setInterval(() => {
|
|
83
83
|
setCurrentIndex((index) => {
|
|
84
|
-
const
|
|
85
|
-
const currentIndex = tmp + 1;
|
|
84
|
+
const currentIndex = index + 1;
|
|
86
85
|
if (currentIndex >= tickLength) {
|
|
87
86
|
return 0;
|
|
88
87
|
}
|
|
@@ -94,7 +93,7 @@ export default ({
|
|
|
94
93
|
intervalHandler && clearInterval(intervalHandler);
|
|
95
94
|
};
|
|
96
95
|
}, [auto, tickLength, interval, isHover, active]);
|
|
97
|
-
const name = currentIndex ===
|
|
96
|
+
const name = currentIndex === -1 ? null : axisX.allTicks[currentIndex];
|
|
98
97
|
|
|
99
98
|
return {
|
|
100
99
|
name,
|
package/src/utils/index.js
CHANGED
|
@@ -76,6 +76,17 @@ const getColorList = ({ type, pure, linear: { stops, angle, opacity } }) => {
|
|
|
76
76
|
}
|
|
77
77
|
return stops.map(({ color, offset }) => ({ color, offset: offset / 100 }));
|
|
78
78
|
};
|
|
79
|
+
const getMultiColorStr = (colors)=>{
|
|
80
|
+
const { stops, angle } = colors;
|
|
81
|
+
let result = 'linear-gradient(' + angle + 'deg, ';
|
|
82
|
+
const stops_ = JSON.parse(JSON.stringify(stops));
|
|
83
|
+
stops_.sort((a,b)=>a.offset-b.offset);
|
|
84
|
+
for(let i=0;i<stops_.length;i++){
|
|
85
|
+
const { color, offset } = stops_[i];
|
|
86
|
+
result += `${color} ${offset}%,`;
|
|
87
|
+
}
|
|
88
|
+
return result.slice(0,-1)+")";
|
|
89
|
+
}
|
|
79
90
|
const getIcon = (type, icon, lineType="solid") => {
|
|
80
91
|
switch (type) {
|
|
81
92
|
case 'area':
|
|
@@ -780,6 +791,7 @@ export {
|
|
|
780
791
|
band,
|
|
781
792
|
getIcon,
|
|
782
793
|
getColorList,
|
|
794
|
+
getMultiColorStr,
|
|
783
795
|
getStacks,
|
|
784
796
|
dataYOrZ,
|
|
785
797
|
seriesYOrZ,
|