@easyv/charts 1.6.19 → 1.6.21
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 +53 -29
- package/lib/components/CartesianChart.js +9 -4
- package/lib/components/Indicator.js +4 -3
- package/lib/components/Tooltip.js +4 -3
- package/lib/hooks/useAxes.js +20 -16
- package/package.json +3 -3
- package/src/components/Band.tsx +139 -120
- package/src/components/CartesianChart.js +4 -1
- package/src/components/Chart.js +0 -1
- package/src/components/Indicator.js +4 -3
- package/src/components/Tooltip.js +3 -2
- package/src/hooks/useAxes.js +20 -16
package/lib/components/Band.js
CHANGED
|
@@ -13,7 +13,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
13
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _d3v = require("d3v7");
|
|
15
15
|
var _utils = require("../utils");
|
|
16
|
-
var _excluded = ["pattern", "seriesIntervalWidth", "paddingInner", "highlight"]
|
|
16
|
+
var _excluded = ["pattern", "seriesIntervalWidth", "paddingInner", "highlight"],
|
|
17
|
+
_excluded2 = ["bgAttr"];
|
|
17
18
|
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); }
|
|
18
19
|
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; }
|
|
19
20
|
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; }
|
|
@@ -50,18 +51,34 @@ var getAttr = function getAttr(_ref) {
|
|
|
50
51
|
length = _ref.length,
|
|
51
52
|
x = _ref.x,
|
|
52
53
|
y = _ref.y;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
54
|
+
var len = length ? length : 0.1; //柱子长度
|
|
55
|
+
if (isVertical) {
|
|
56
|
+
return {
|
|
57
|
+
width: len,
|
|
58
|
+
height: seriesWidth,
|
|
59
|
+
x: y,
|
|
60
|
+
y: x,
|
|
61
|
+
bgAttr: {
|
|
62
|
+
x: 0,
|
|
63
|
+
y: x,
|
|
64
|
+
width: len + x,
|
|
65
|
+
height: seriesWidth
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
} else {
|
|
69
|
+
return {
|
|
70
|
+
x: x,
|
|
71
|
+
y: y,
|
|
72
|
+
width: seriesWidth,
|
|
73
|
+
height: len,
|
|
74
|
+
bgAttr: {
|
|
75
|
+
x: x,
|
|
76
|
+
y: 0,
|
|
77
|
+
width: seriesWidth,
|
|
78
|
+
height: y + len
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
65
82
|
};
|
|
66
83
|
var getBorderRadius = function getBorderRadius(_ref2) {
|
|
67
84
|
var isVertical = _ref2.isVertical,
|
|
@@ -187,26 +204,27 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
187
204
|
};
|
|
188
205
|
if (isNaN(positionX)) return null;
|
|
189
206
|
var positionY = reverse ? y > 0 ? y1 : y2 : y < 0 ? y1 : y2;
|
|
190
|
-
var
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
207
|
+
var _getAttr = getAttr({
|
|
208
|
+
isVertical: isVertical,
|
|
209
|
+
x: positionX,
|
|
210
|
+
y: positionY,
|
|
211
|
+
length: Math.abs(y1 - y2),
|
|
212
|
+
seriesWidth: seriesWidth
|
|
213
|
+
}),
|
|
214
|
+
bgAttr = _getAttr.bgAttr,
|
|
215
|
+
attr = (0, _objectWithoutProperties2["default"])(_getAttr, _excluded2);
|
|
216
|
+
return /*#__PURE__*/_react["default"].createElement(_react.Fragment, {
|
|
217
|
+
key: i
|
|
218
|
+
}, /*#__PURE__*/_react["default"].createElement("foreignObject", (0, _extends2["default"])({
|
|
199
219
|
style: {
|
|
200
220
|
overflow: "visible",
|
|
201
221
|
position: "relative",
|
|
202
222
|
cursor: "pointer"
|
|
203
223
|
}
|
|
204
|
-
},
|
|
224
|
+
}, bgAttr, {
|
|
205
225
|
onClick: function onClick(e) {
|
|
206
226
|
return triggerClick(e, "setCurrent");
|
|
207
|
-
}
|
|
208
|
-
//enter和leave事件,用于控制图的提示框
|
|
209
|
-
,
|
|
227
|
+
},
|
|
210
228
|
onMouseEnter: function onMouseEnter() {
|
|
211
229
|
if (isControlChart) {
|
|
212
230
|
setCtlTip(function (pre) {
|
|
@@ -244,7 +262,13 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
244
262
|
}
|
|
245
263
|
},
|
|
246
264
|
"data-data": JSON.stringify(data)
|
|
247
|
-
}),
|
|
265
|
+
})), /*#__PURE__*/_react["default"].createElement("foreignObject", (0, _extends2["default"])({
|
|
266
|
+
style: {
|
|
267
|
+
overflow: "visible",
|
|
268
|
+
position: "relative",
|
|
269
|
+
pointerEvents: "none"
|
|
270
|
+
}
|
|
271
|
+
}, attr), (headUrl || headVideo) && showHead && (headType == "image" ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
248
272
|
style: {
|
|
249
273
|
position: "absolute",
|
|
250
274
|
background: "url(".concat(
|
|
@@ -283,7 +307,7 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
283
307
|
// position: "fixed",
|
|
284
308
|
clipPath: setClipPath(),
|
|
285
309
|
opacity: fillType == "pattern" ? opacity : 1,
|
|
286
|
-
background: fillType == "pattern" ? "50% 50% / ".concat(size.width, "px ").concat(size.height, "px repeat ") + "url(" +
|
|
310
|
+
background: fillType == "pattern" ? "".concat(isVertical ? y < 0 ? "100%" : "0%" : "50%", " ").concat(isVertical ? "50%" : y < 0 ? "0%" : "100%", " / ").concat(size.width, "px ").concat(size.height, "px repeat ") + "url(" +
|
|
287
311
|
//@ts-ignore
|
|
288
312
|
window.appConfig.ASSETS_URL + url + ")" : (0, _utils.getBandBackground)(pattern, extent === flag ? highlightFill : fill),
|
|
289
313
|
borderRadius: style == "square" ? "0 0 0 0" : getBorderRadius({
|
|
@@ -300,6 +324,6 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
300
324
|
borderRight: borderStr,
|
|
301
325
|
borderLeft: borderStr
|
|
302
326
|
})
|
|
303
|
-
}));
|
|
327
|
+
})));
|
|
304
328
|
}));
|
|
305
329
|
});
|
|
@@ -441,7 +441,9 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
441
441
|
}, config, {
|
|
442
442
|
key: index
|
|
443
443
|
}));
|
|
444
|
-
}), showTooltip && !control && /*#__PURE__*/_react["default"].createElement(_.Indicator, (0, _extends2["default"])({}, indicator,
|
|
444
|
+
}), showTooltip && !control && /*#__PURE__*/_react["default"].createElement(_.Indicator, (0, _extends2["default"])({}, indicator, {
|
|
445
|
+
manual: manual
|
|
446
|
+
}, indicatorAttr)), /*#__PURE__*/_react["default"].createElement("foreignObject", {
|
|
445
447
|
style: {
|
|
446
448
|
width: bodyWidth,
|
|
447
449
|
height: bodyHeight,
|
|
@@ -467,7 +469,8 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
467
469
|
isControlChart: !!control,
|
|
468
470
|
xName: item.tick,
|
|
469
471
|
setCtlTip: setCtlTip,
|
|
470
|
-
ctlIndicatorList: ctlIndicatorList
|
|
472
|
+
ctlIndicatorList: ctlIndicatorList,
|
|
473
|
+
manual: manual
|
|
471
474
|
}));
|
|
472
475
|
})), series.map(function (_ref2, index) {
|
|
473
476
|
var Component = _ref2.Component,
|
|
@@ -546,7 +549,8 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
546
549
|
tickName: tickName,
|
|
547
550
|
series: series,
|
|
548
551
|
width: width,
|
|
549
|
-
height: height
|
|
552
|
+
height: height,
|
|
553
|
+
manual: manual
|
|
550
554
|
})), showCtl && !!control && /*#__PURE__*/_react["default"].createElement(_.Tooltip, (0, _extends2["default"])({
|
|
551
555
|
isVertical: isVertical
|
|
552
556
|
}, tooltip, {
|
|
@@ -557,7 +561,8 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
557
561
|
tickName: ctlXName,
|
|
558
562
|
series: series,
|
|
559
563
|
width: width,
|
|
560
|
-
height: height
|
|
564
|
+
height: height,
|
|
565
|
+
manual: manual
|
|
561
566
|
})), brush && /*#__PURE__*/_react["default"].createElement(_.Brush, {
|
|
562
567
|
config: brush,
|
|
563
568
|
width: width
|
|
@@ -24,14 +24,15 @@ var _default = exports["default"] = function _default(_ref) {
|
|
|
24
24
|
_ref$xName = _ref.xName,
|
|
25
25
|
xName = _ref$xName === void 0 ? null : _ref$xName,
|
|
26
26
|
ctlIndicatorList = _ref.ctlIndicatorList,
|
|
27
|
-
setCtlTip = _ref.setCtlTip
|
|
27
|
+
setCtlTip = _ref.setCtlTip,
|
|
28
|
+
manual = _ref.manual;
|
|
28
29
|
var isShow = true;
|
|
29
30
|
if (isControlChart && ctlIndicatorList) {
|
|
30
31
|
isShow = ctlIndicatorList.find(function (item) {
|
|
31
32
|
return item.tick === xName;
|
|
32
33
|
}).isShow;
|
|
33
34
|
}
|
|
34
|
-
return /*#__PURE__*/React.createElement("rect", {
|
|
35
|
+
return manual ? /*#__PURE__*/React.createElement("rect", {
|
|
35
36
|
width: width,
|
|
36
37
|
height: height,
|
|
37
38
|
x: x,
|
|
@@ -74,5 +75,5 @@ var _default = exports["default"] = function _default(_ref) {
|
|
|
74
75
|
fill: isShow ? color : "transparent",
|
|
75
76
|
y: y,
|
|
76
77
|
stroke: "none"
|
|
77
|
-
});
|
|
78
|
+
}) : "";
|
|
78
79
|
};
|
|
@@ -48,7 +48,8 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
48
48
|
formatter = _ref.formatter,
|
|
49
49
|
isVertical = _ref.isVertical,
|
|
50
50
|
width = _ref.width,
|
|
51
|
-
height = _ref.height
|
|
51
|
+
height = _ref.height,
|
|
52
|
+
manual = _ref.manual;
|
|
52
53
|
var tipPosition = (0, _react.useMemo)(function () {
|
|
53
54
|
var translate3d = isVertical ? _objectSpread(_objectSpread({}, translateTip), {}, {
|
|
54
55
|
y: translateTip.y + position + marginTop
|
|
@@ -65,7 +66,7 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
65
66
|
}
|
|
66
67
|
return (0, _utils.getTranslate3d)(translate3d);
|
|
67
68
|
}, [width, height, marginLeft, marginTop, position, tipWidth, tipHeight, translateTip]);
|
|
68
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
return manual ? /*#__PURE__*/React.createElement("div", {
|
|
69
70
|
className: "__easyv-tooltip",
|
|
70
71
|
style: _objectSpread({
|
|
71
72
|
pointerEvents: 'none',
|
|
@@ -153,5 +154,5 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
153
154
|
transform: (0, _utils.getTranslate3d)(suffixTranslate)
|
|
154
155
|
})
|
|
155
156
|
}, tmp.get(s))));
|
|
156
|
-
}))));
|
|
157
|
+
})))) : "";
|
|
157
158
|
});
|
package/lib/hooks/useAxes.js
CHANGED
|
@@ -72,6 +72,9 @@ var getNewDomain = function getNewDomain(domain, mode, step) {
|
|
|
72
72
|
}
|
|
73
73
|
break;
|
|
74
74
|
}
|
|
75
|
+
if (newDomain[0] == newDomain[1]) {
|
|
76
|
+
newDomain[1] += 1;
|
|
77
|
+
}
|
|
75
78
|
return newDomain;
|
|
76
79
|
};
|
|
77
80
|
var getTickCount = function getTickCount(domain, count, decimal) {
|
|
@@ -344,22 +347,23 @@ var _default = exports["default"] = function _default(_ref) {
|
|
|
344
347
|
}
|
|
345
348
|
}
|
|
346
349
|
var _lengthWithoutPaddingOuter = _length - _paddingOuter2;
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
}
|
|
350
|
+
// 额外的X轴坐标轴,对应于数值0的位置
|
|
351
|
+
// if (type == "linear" && config.on) {
|
|
352
|
+
// const zeroPosition = scaler(0);
|
|
353
|
+
// if (!isNaN(zeroPosition)) {
|
|
354
|
+
// if (direction === "horizontal") {
|
|
355
|
+
// xAxisPositions.add(JSON.stringify({
|
|
356
|
+
// x: zeroPosition,
|
|
357
|
+
// y: 0,
|
|
358
|
+
// }));
|
|
359
|
+
// } else if (direction === "vertical") {
|
|
360
|
+
// xAxisPositions.add(JSON.stringify({
|
|
361
|
+
// x: 0,
|
|
362
|
+
// y: zeroPosition,
|
|
363
|
+
// }));
|
|
364
|
+
// }
|
|
365
|
+
// }
|
|
366
|
+
// }
|
|
363
367
|
var _step2 = _lengthWithoutPaddingOuter / allTicks.length;
|
|
364
368
|
var controlCfg = {
|
|
365
369
|
controlStep: 0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easyv/charts",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.21",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
"license": "ISC",
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@babel/cli": "^7.17.10",
|
|
15
|
-
"@babel/core": "^7.
|
|
15
|
+
"@babel/core": "^7.26.0",
|
|
16
16
|
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
17
17
|
"@babel/plugin-proposal-export-default-from": "^7.16.7",
|
|
18
18
|
"@babel/plugin-transform-runtime": "^7.17.10",
|
|
19
|
-
"@babel/preset-env": "^7.
|
|
19
|
+
"@babel/preset-env": "^7.26.0",
|
|
20
20
|
"@babel/preset-react": "^7.16.7",
|
|
21
21
|
"@babel/preset-typescript": "^7.16.7",
|
|
22
22
|
"@commitlint/cli": "^17.6.7",
|
package/src/components/Band.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* (柱状/条形)图柱子
|
|
3
3
|
*/
|
|
4
|
-
import React, { memo } from "react";
|
|
4
|
+
import React, { memo, Fragment } from "react";
|
|
5
5
|
import { min, max } from "d3v7";
|
|
6
6
|
import { getBandBackground, getSeriesInfo } from "../utils";
|
|
7
7
|
|
|
@@ -37,13 +37,29 @@ const getAttr = ({
|
|
|
37
37
|
x: number;
|
|
38
38
|
y: number;
|
|
39
39
|
}) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
x,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
const len = length?length:0.1; //柱子长度
|
|
41
|
+
if (isVertical){
|
|
42
|
+
return { width: len, height: seriesWidth, x: y, y: x, bgAttr:{
|
|
43
|
+
x:0,
|
|
44
|
+
y:x,
|
|
45
|
+
width: len+x,
|
|
46
|
+
height: seriesWidth,
|
|
47
|
+
} };
|
|
48
|
+
}else{
|
|
49
|
+
return {
|
|
50
|
+
x,
|
|
51
|
+
y,
|
|
52
|
+
width: seriesWidth,
|
|
53
|
+
height: len,
|
|
54
|
+
bgAttr:{
|
|
55
|
+
x,
|
|
56
|
+
y:0,
|
|
57
|
+
width: seriesWidth,
|
|
58
|
+
height: y+len,
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
47
63
|
};
|
|
48
64
|
|
|
49
65
|
const getBorderRadius = ({
|
|
@@ -103,7 +119,7 @@ export default memo(
|
|
|
103
119
|
});
|
|
104
120
|
const _data = showHighlight ? getHighlightData(data, extent) : data;
|
|
105
121
|
const isVertical = direction === "vertical";
|
|
106
|
-
|
|
122
|
+
|
|
107
123
|
return (
|
|
108
124
|
<g className="__easyv-band">
|
|
109
125
|
{_data.map(
|
|
@@ -172,7 +188,7 @@ export default memo(
|
|
|
172
188
|
const positionY = reverse?
|
|
173
189
|
y > 0 ? y1 : y2:
|
|
174
190
|
y < 0 ? y1 : y2;
|
|
175
|
-
const attr = getAttr({
|
|
191
|
+
const { bgAttr, ...attr } = getAttr({
|
|
176
192
|
isVertical,
|
|
177
193
|
x: positionX,
|
|
178
194
|
y: positionY,
|
|
@@ -180,119 +196,122 @@ export default memo(
|
|
|
180
196
|
seriesWidth,
|
|
181
197
|
});
|
|
182
198
|
return (
|
|
183
|
-
<
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
})
|
|
218
|
-
}))
|
|
219
|
-
}
|
|
220
|
-
}}
|
|
221
|
-
data-data={JSON.stringify(data)}
|
|
222
|
-
>
|
|
223
|
-
{(headUrl || headVideo) && showHead && (
|
|
224
|
-
headType=="image"?<div
|
|
225
|
-
style={{
|
|
226
|
-
position: "absolute",
|
|
227
|
-
background: `url(${
|
|
228
|
-
//@ts-ignore
|
|
229
|
-
window.appConfig.ASSETS_URL + headUrl
|
|
230
|
-
}) 0 0/100% 100%`,
|
|
231
|
-
width: headWidth,
|
|
232
|
-
height: headHeight,
|
|
233
|
-
left: isVertical ? "100%" : "50%",
|
|
234
|
-
top: isVertical ? "50%" : "0",
|
|
235
|
-
zIndex: 1,
|
|
236
|
-
transform: `translate(calc(-50% + ${headTranslate.x}px), calc(-50% + ${headTranslate.y}px))`,
|
|
237
|
-
}}
|
|
238
|
-
></div>:<video
|
|
239
|
-
width={headWidth} height={headHeight}
|
|
240
|
-
//@ts-ignore
|
|
241
|
-
src={window.appConfig.ASSETS_URL + headVideo}
|
|
242
|
-
// controls={true}
|
|
243
|
-
loop={true}
|
|
244
|
-
muted={true}
|
|
245
|
-
autoPlay={true}
|
|
246
|
-
style={{
|
|
247
|
-
position: "absolute",
|
|
248
|
-
left: isVertical ? "100%" : "50%",
|
|
249
|
-
top: isVertical ? "50%" : "0",
|
|
250
|
-
zIndex: 1,
|
|
251
|
-
transform: `translate(calc(-50% + ${headTranslate.x}px), calc(-50% + ${headTranslate.y}px))`,
|
|
252
|
-
}}
|
|
253
|
-
></video>
|
|
254
|
-
)}
|
|
255
|
-
<div
|
|
199
|
+
<Fragment key={i}>
|
|
200
|
+
<foreignObject style={{overflow: "visible",position: "relative",cursor: "pointer",}}
|
|
201
|
+
{...bgAttr}
|
|
202
|
+
onClick={e=>triggerClick(e,"setCurrent")}
|
|
203
|
+
onMouseEnter={() => {
|
|
204
|
+
if(isControlChart){
|
|
205
|
+
setCtlTip((pre:any)=>({
|
|
206
|
+
show:true,
|
|
207
|
+
x:xScaler(x),
|
|
208
|
+
xName:data.x,
|
|
209
|
+
indicatorList:pre.indicatorList.map((item:any)=>{
|
|
210
|
+
if (item.tick === data.x) {
|
|
211
|
+
return { ...item, isShow: true };
|
|
212
|
+
} else {
|
|
213
|
+
return item;
|
|
214
|
+
}
|
|
215
|
+
})
|
|
216
|
+
}))
|
|
217
|
+
}
|
|
218
|
+
}}
|
|
219
|
+
onMouseLeave={() => {
|
|
220
|
+
if(isControlChart){
|
|
221
|
+
setCtlTip((pre:any)=>({
|
|
222
|
+
show:false,
|
|
223
|
+
x:undefined,
|
|
224
|
+
xName:undefined,
|
|
225
|
+
indicatorList:pre.indicatorList.map((item:any)=>{
|
|
226
|
+
return { ...item, isShow:false }
|
|
227
|
+
})
|
|
228
|
+
}))
|
|
229
|
+
}
|
|
230
|
+
}}
|
|
231
|
+
data-data={JSON.stringify(data)}></foreignObject>
|
|
232
|
+
<foreignObject
|
|
256
233
|
style={{
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
234
|
+
overflow: "visible",
|
|
235
|
+
position: "relative",
|
|
236
|
+
pointerEvents:"none"
|
|
237
|
+
}}
|
|
238
|
+
{...attr}
|
|
239
|
+
>
|
|
240
|
+
{(headUrl || headVideo) && showHead && (
|
|
241
|
+
headType=="image"?<div
|
|
242
|
+
style={{
|
|
243
|
+
position: "absolute",
|
|
244
|
+
background: `url(${
|
|
267
245
|
//@ts-ignore
|
|
268
|
-
window.appConfig.ASSETS_URL +
|
|
269
|
-
|
|
270
|
-
:
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
246
|
+
window.appConfig.ASSETS_URL + headUrl
|
|
247
|
+
}) 0 0/100% 100%`,
|
|
248
|
+
width: headWidth,
|
|
249
|
+
height: headHeight,
|
|
250
|
+
left: isVertical ? "100%" : "50%",
|
|
251
|
+
top: isVertical ? "50%" : "0",
|
|
252
|
+
zIndex: 1,
|
|
253
|
+
transform: `translate(calc(-50% + ${headTranslate.x}px), calc(-50% + ${headTranslate.y}px))`,
|
|
254
|
+
}}
|
|
255
|
+
></div>:<video
|
|
256
|
+
width={headWidth} height={headHeight}
|
|
257
|
+
//@ts-ignore
|
|
258
|
+
src={window.appConfig.ASSETS_URL + headVideo}
|
|
259
|
+
// controls={true}
|
|
260
|
+
loop={true}
|
|
261
|
+
muted={true}
|
|
262
|
+
autoPlay={true}
|
|
263
|
+
style={{
|
|
264
|
+
position: "absolute",
|
|
265
|
+
left: isVertical ? "100%" : "50%",
|
|
266
|
+
top: isVertical ? "50%" : "0",
|
|
267
|
+
zIndex: 1,
|
|
268
|
+
transform: `translate(calc(-50% + ${headTranslate.x}px), calc(-50% + ${headTranslate.y}px))`,
|
|
269
|
+
}}
|
|
270
|
+
></video>
|
|
271
|
+
)}
|
|
272
|
+
<div
|
|
273
|
+
style={{
|
|
274
|
+
width: "100%",
|
|
275
|
+
height: "100%",
|
|
276
|
+
/** Safari Bug **/
|
|
277
|
+
// position: "fixed",
|
|
278
|
+
clipPath: setClipPath(),
|
|
279
|
+
opacity: fillType == "pattern" ? opacity : 1,
|
|
280
|
+
background:
|
|
281
|
+
fillType == "pattern"
|
|
282
|
+
? `${isVertical?y<0?"100%":"0%":"50%"} ${isVertical?"50%":y<0?"0%":"100%"} / ${size.width}px ${size.height}px repeat ` +
|
|
283
|
+
"url(" +
|
|
284
|
+
//@ts-ignore
|
|
285
|
+
window.appConfig.ASSETS_URL + url +
|
|
286
|
+
")"
|
|
287
|
+
: getBandBackground(
|
|
288
|
+
pattern,
|
|
289
|
+
extent === flag ? highlightFill : fill
|
|
290
|
+
),
|
|
291
|
+
borderRadius:
|
|
292
|
+
style == "square"
|
|
293
|
+
? "0 0 0 0"
|
|
294
|
+
: getBorderRadius({
|
|
295
|
+
isVertical,
|
|
296
|
+
positive: y > 0,
|
|
297
|
+
seriesWidth,
|
|
298
|
+
}),
|
|
299
|
+
...(isVertical
|
|
300
|
+
? {
|
|
301
|
+
borderTop: borderStr,
|
|
302
|
+
borderRight: borderStr,
|
|
303
|
+
borderBottom: borderStr,
|
|
304
|
+
}
|
|
305
|
+
: {
|
|
306
|
+
borderTop: borderStr,
|
|
307
|
+
borderRight: borderStr,
|
|
308
|
+
borderLeft: borderStr,
|
|
281
309
|
}),
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
: {
|
|
289
|
-
borderTop: borderStr,
|
|
290
|
-
borderRight: borderStr,
|
|
291
|
-
borderLeft: borderStr,
|
|
292
|
-
}),
|
|
293
|
-
}}
|
|
294
|
-
/>
|
|
295
|
-
</foreignObject>
|
|
310
|
+
}}
|
|
311
|
+
/>
|
|
312
|
+
</foreignObject>
|
|
313
|
+
</Fragment>
|
|
314
|
+
|
|
296
315
|
);
|
|
297
316
|
}
|
|
298
317
|
)}
|
|
@@ -427,7 +427,7 @@ const Chart = memo(
|
|
|
427
427
|
);
|
|
428
428
|
})}
|
|
429
429
|
{showTooltip && !control && (
|
|
430
|
-
<Indicator {...indicator} {...indicatorAttr} />
|
|
430
|
+
<Indicator {...indicator} manual= {manual} {...indicatorAttr} />
|
|
431
431
|
)}
|
|
432
432
|
<foreignObject
|
|
433
433
|
style={
|
|
@@ -468,6 +468,7 @@ const Chart = memo(
|
|
|
468
468
|
xName={item.tick}
|
|
469
469
|
setCtlTip={setCtlTip}
|
|
470
470
|
ctlIndicatorList={ctlIndicatorList}
|
|
471
|
+
manual= {manual}
|
|
471
472
|
/>
|
|
472
473
|
);
|
|
473
474
|
})}
|
|
@@ -571,6 +572,7 @@ const Chart = memo(
|
|
|
571
572
|
series={series}
|
|
572
573
|
width={width}
|
|
573
574
|
height={height}
|
|
575
|
+
manual= {manual}
|
|
574
576
|
/>
|
|
575
577
|
)}
|
|
576
578
|
{showCtl && !!control && (
|
|
@@ -585,6 +587,7 @@ const Chart = memo(
|
|
|
585
587
|
series={series}
|
|
586
588
|
width={width}
|
|
587
589
|
height={height}
|
|
590
|
+
manual= {manual}
|
|
588
591
|
/>
|
|
589
592
|
)}
|
|
590
593
|
{brush && <Brush config={brush} width={width} />}
|
package/src/components/Chart.js
CHANGED
|
@@ -11,7 +11,8 @@ export default ({
|
|
|
11
11
|
isControlChart = false,
|
|
12
12
|
xName = null,
|
|
13
13
|
ctlIndicatorList,
|
|
14
|
-
setCtlTip
|
|
14
|
+
setCtlTip,
|
|
15
|
+
manual
|
|
15
16
|
}) => {
|
|
16
17
|
let isShow = true;
|
|
17
18
|
if (isControlChart && ctlIndicatorList) {
|
|
@@ -19,7 +20,7 @@ export default ({
|
|
|
19
20
|
(item) => item.tick === xName
|
|
20
21
|
).isShow;
|
|
21
22
|
}
|
|
22
|
-
return (
|
|
23
|
+
return manual?(
|
|
23
24
|
<rect
|
|
24
25
|
width={width}
|
|
25
26
|
height={height}
|
|
@@ -54,5 +55,5 @@ export default ({
|
|
|
54
55
|
y={y}
|
|
55
56
|
stroke="none"
|
|
56
57
|
/>
|
|
57
|
-
);
|
|
58
|
+
):"";
|
|
58
59
|
};
|
|
@@ -32,6 +32,7 @@ export default memo(
|
|
|
32
32
|
isVertical,
|
|
33
33
|
width,
|
|
34
34
|
height,
|
|
35
|
+
manual
|
|
35
36
|
}) => {
|
|
36
37
|
const tipPosition = useMemo(() => {
|
|
37
38
|
const translate3d = isVertical
|
|
@@ -62,7 +63,7 @@ export default memo(
|
|
|
62
63
|
tipHeight,
|
|
63
64
|
translateTip,
|
|
64
65
|
]);
|
|
65
|
-
return (
|
|
66
|
+
return manual?(
|
|
66
67
|
<div
|
|
67
68
|
className='__easyv-tooltip'
|
|
68
69
|
style={{
|
|
@@ -175,6 +176,6 @@ export default memo(
|
|
|
175
176
|
</div>
|
|
176
177
|
)}
|
|
177
178
|
</div>
|
|
178
|
-
);
|
|
179
|
+
):"";
|
|
179
180
|
}
|
|
180
181
|
);
|
package/src/hooks/useAxes.js
CHANGED
|
@@ -63,6 +63,9 @@ const getNewDomain = (
|
|
|
63
63
|
}
|
|
64
64
|
break;
|
|
65
65
|
}
|
|
66
|
+
if(newDomain[0]==newDomain[1]){
|
|
67
|
+
newDomain[1]+=1;
|
|
68
|
+
}
|
|
66
69
|
return newDomain;
|
|
67
70
|
};
|
|
68
71
|
|
|
@@ -421,22 +424,23 @@ export default ({
|
|
|
421
424
|
}
|
|
422
425
|
}
|
|
423
426
|
const lengthWithoutPaddingOuter = length - _paddingOuter;
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
}
|
|
427
|
+
// 额外的X轴坐标轴,对应于数值0的位置
|
|
428
|
+
// if (type == "linear" && config.on) {
|
|
429
|
+
// const zeroPosition = scaler(0);
|
|
430
|
+
// if (!isNaN(zeroPosition)) {
|
|
431
|
+
// if (direction === "horizontal") {
|
|
432
|
+
// xAxisPositions.add(JSON.stringify({
|
|
433
|
+
// x: zeroPosition,
|
|
434
|
+
// y: 0,
|
|
435
|
+
// }));
|
|
436
|
+
// } else if (direction === "vertical") {
|
|
437
|
+
// xAxisPositions.add(JSON.stringify({
|
|
438
|
+
// x: 0,
|
|
439
|
+
// y: zeroPosition,
|
|
440
|
+
// }));
|
|
441
|
+
// }
|
|
442
|
+
// }
|
|
443
|
+
// }
|
|
440
444
|
let step = lengthWithoutPaddingOuter / allTicks.length;
|
|
441
445
|
const controlCfg = {
|
|
442
446
|
controlStep: 0,
|