@easyv/charts 1.9.13 → 1.9.15
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/Background.js +1 -1
- package/lib/components/Band.js +6 -4
- package/lib/components/CartesianChart.js +3 -2
- package/lib/components/StereoBar.js +23 -18
- package/package.json +1 -1
- package/src/components/Background.tsx +4 -4
- package/src/components/Band.tsx +10 -4
- package/src/components/CartesianChart.js +4 -2
- package/src/components/Control.jsx +278 -230
- package/src/components/StereoBar.tsx +49 -34
|
@@ -23,7 +23,7 @@ var _default = exports["default"] = function _default(_ref) {
|
|
|
23
23
|
paddingInner = _ref$config.seriesIntervalWidth,
|
|
24
24
|
paddingOuter = _ref$config.paddingInner,
|
|
25
25
|
length = _ref.length;
|
|
26
|
-
var isVertical = direction ===
|
|
26
|
+
var isVertical = direction === "vertical";
|
|
27
27
|
var _getSeriesInfo = (0, _utils.getSeriesInfo)({
|
|
28
28
|
step: step,
|
|
29
29
|
bandLength: bandLength,
|
package/lib/components/Band.js
CHANGED
|
@@ -57,7 +57,7 @@ var getAttr = function getAttr(_ref) {
|
|
|
57
57
|
var len = length ? length : 0.1; //柱子长度
|
|
58
58
|
if (isVertical) {
|
|
59
59
|
return {
|
|
60
|
-
width: Math.min(Math.max(0, len), maxWidth),
|
|
60
|
+
width: maxWidth ? Math.min(Math.max(0, len), maxWidth) : Math.max(0, len),
|
|
61
61
|
height: Math.max(0, seriesWidth),
|
|
62
62
|
x: y,
|
|
63
63
|
y: x,
|
|
@@ -70,9 +70,9 @@ var getAttr = function getAttr(_ref) {
|
|
|
70
70
|
};
|
|
71
71
|
} else {
|
|
72
72
|
return {
|
|
73
|
-
x: seriesWidth > maxWidth ? x + (seriesWidth - maxWidth) / 2 : x,
|
|
73
|
+
x: maxWidth ? seriesWidth > maxWidth ? x + (seriesWidth - maxWidth) / 2 : x : x,
|
|
74
74
|
y: y,
|
|
75
|
-
width: Math.min(seriesWidth, maxWidth),
|
|
75
|
+
width: maxWidth ? Math.min(seriesWidth, maxWidth) : seriesWidth,
|
|
76
76
|
height: len,
|
|
77
77
|
bgAttr: {
|
|
78
78
|
x: x,
|
|
@@ -96,7 +96,8 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
96
96
|
isControlChart = _ref3$isControlChart === void 0 ? false : _ref3$isControlChart,
|
|
97
97
|
setCtlTip = _ref3.setCtlTip,
|
|
98
98
|
isXRepeat = _ref3.isXRepeat,
|
|
99
|
-
|
|
99
|
+
maxWidth1 = _ref3.maxWidth,
|
|
100
|
+
config = _ref3.config,
|
|
100
101
|
_ref3$config = _ref3.config,
|
|
101
102
|
_ref3$config$pattern = _ref3$config.pattern,
|
|
102
103
|
pattern = _ref3$config$pattern === void 0 ? {} : _ref3$config$pattern,
|
|
@@ -127,6 +128,7 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
127
128
|
isClipAxis = _ref3$yAxis.isClipAxis,
|
|
128
129
|
clipValue = _ref3$yAxis.clipValue,
|
|
129
130
|
reverse = _ref3$yAxis.reverse;
|
|
131
|
+
var maxWidth = maxWidth1 ? maxWidth1 : config.maxWidth;
|
|
130
132
|
if (!data.length) return null;
|
|
131
133
|
var selectConfig = other;
|
|
132
134
|
if (selectStyle) {
|
|
@@ -33,6 +33,7 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
33
33
|
_ref$config = _ref.config,
|
|
34
34
|
axesConfig = _ref$config.axes,
|
|
35
35
|
background = _ref$config.background,
|
|
36
|
+
chart = _ref$config.chart,
|
|
36
37
|
_ref$config$chart = _ref$config.chart,
|
|
37
38
|
_ref$config$chart$mar = _ref$config$chart.margin,
|
|
38
39
|
marginLeft = _ref$config$chart$mar.marginLeft,
|
|
@@ -42,7 +43,7 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
42
43
|
animation = _ref$config$chart.animation,
|
|
43
44
|
legend = _ref$config$chart.legend,
|
|
44
45
|
selectStyle = _ref$config$chart.selectStyle,
|
|
45
|
-
|
|
46
|
+
bar = _ref$config$chart.bar,
|
|
46
47
|
series = _ref$config.series,
|
|
47
48
|
bandLength = _ref$config.bandLength,
|
|
48
49
|
tooltip = _ref$config.tooltip,
|
|
@@ -627,7 +628,7 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
627
628
|
triggerEvents: onInteraction,
|
|
628
629
|
setCtlTip: setCtlTip,
|
|
629
630
|
isXRepeat: isXRepeat,
|
|
630
|
-
maxWidth: maxWidth
|
|
631
|
+
maxWidth: bar ? bar.maxWidth : 0
|
|
631
632
|
}));
|
|
632
633
|
}), series.map(function (_ref3, index) {
|
|
633
634
|
var Component = _ref3.Component,
|
|
@@ -21,22 +21,22 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
21
21
|
*/
|
|
22
22
|
var getHighlightData = function getHighlightData(data, extent) {
|
|
23
23
|
switch (extent) {
|
|
24
|
-
case
|
|
24
|
+
case "min":
|
|
25
25
|
var minData = (0, _d3v.min)(data, function (d) {
|
|
26
26
|
return d.data.y;
|
|
27
27
|
});
|
|
28
28
|
return data.map(function (item) {
|
|
29
29
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
30
|
-
flag: minData == item.data.y ?
|
|
30
|
+
flag: minData == item.data.y ? "min" : ""
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
|
-
case
|
|
33
|
+
case "max":
|
|
34
34
|
var maxData = (0, _d3v.max)(data, function (d) {
|
|
35
35
|
return d.data.y;
|
|
36
36
|
});
|
|
37
37
|
return data.map(function (item) {
|
|
38
38
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
39
|
-
flag: maxData == item.data.y ?
|
|
39
|
+
flag: maxData == item.data.y ? "max" : ""
|
|
40
40
|
});
|
|
41
41
|
});
|
|
42
42
|
default:
|
|
@@ -48,17 +48,18 @@ var getAttr = function getAttr(_ref) {
|
|
|
48
48
|
seriesWidth = _ref.seriesWidth,
|
|
49
49
|
length = _ref.length,
|
|
50
50
|
x = _ref.x,
|
|
51
|
-
y = _ref.y
|
|
51
|
+
y = _ref.y,
|
|
52
|
+
maxWidth = _ref.maxWidth;
|
|
52
53
|
if (isVertical) return {
|
|
53
|
-
width: length,
|
|
54
|
+
width: maxWidth ? Math.min(Math.max(0, length), maxWidth) : Math.max(0, length),
|
|
54
55
|
height: seriesWidth,
|
|
55
56
|
x: y,
|
|
56
57
|
y: x
|
|
57
58
|
};
|
|
58
59
|
return {
|
|
59
|
-
x: x,
|
|
60
|
+
x: maxWidth ? seriesWidth > maxWidth ? x + (seriesWidth - maxWidth) / 2 : x : x,
|
|
60
61
|
y: y,
|
|
61
|
-
width: seriesWidth,
|
|
62
|
+
width: maxWidth ? Math.min(seriesWidth, maxWidth) : seriesWidth,
|
|
62
63
|
height: length
|
|
63
64
|
};
|
|
64
65
|
};
|
|
@@ -66,10 +67,12 @@ var getBorderRadius = function getBorderRadius(_ref2) {
|
|
|
66
67
|
var isVertical = _ref2.isVertical,
|
|
67
68
|
positive = _ref2.positive,
|
|
68
69
|
seriesWidth = _ref2.seriesWidth;
|
|
69
|
-
return isVertical ? positive ?
|
|
70
|
+
return isVertical ? positive ? "0px " + seriesWidth + "px " + seriesWidth + "px 0" : seriesWidth + "px 0 0 " + seriesWidth + "px" : positive ? seriesWidth / 2 + "px " + seriesWidth / 2 + "px 0 0" : "0 0 " + seriesWidth / 2 + "px " + seriesWidth / 2 + "px";
|
|
70
71
|
};
|
|
71
72
|
var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref3) {
|
|
72
73
|
var triggerClick = _ref3.triggerClick,
|
|
74
|
+
maxWidth1 = _ref3.maxWidth,
|
|
75
|
+
config = _ref3.config,
|
|
73
76
|
_ref3$config = _ref3.config,
|
|
74
77
|
_ref3$config$pattern = _ref3$config.pattern,
|
|
75
78
|
pattern = _ref3$config$pattern === void 0 ? {} : _ref3$config$pattern,
|
|
@@ -93,6 +96,7 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
93
96
|
direction = _ref3$xAxis.direction,
|
|
94
97
|
yScaler = _ref3.yAxis.scaler,
|
|
95
98
|
name = _ref3.name;
|
|
99
|
+
var maxWidth = maxWidth1 ? maxWidth1 : config.maxWidth;
|
|
96
100
|
if (!data.length) return null;
|
|
97
101
|
var _getSeriesInfo = (0, _utils.getSeriesInfo)({
|
|
98
102
|
step: step,
|
|
@@ -104,9 +108,9 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
104
108
|
seriesStep = _getSeriesInfo.seriesStep,
|
|
105
109
|
seriesStart = _getSeriesInfo.seriesStart;
|
|
106
110
|
var _data = showHighlight ? getHighlightData(data, extent) : data;
|
|
107
|
-
var isVertical = direction ===
|
|
108
|
-
var highlightColor = parseMultiColorToSVG(highlightFill,
|
|
109
|
-
var color = parseMultiColorToSVG(fill,
|
|
111
|
+
var isVertical = direction === "vertical";
|
|
112
|
+
var highlightColor = parseMultiColorToSVG(highlightFill, "highlight_gradient_" + id + "_" + name);
|
|
113
|
+
var color = parseMultiColorToSVG(fill, "gradient_" + id + "_" + name);
|
|
110
114
|
return /*#__PURE__*/_react["default"].createElement("g", {
|
|
111
115
|
className: "__easyv-band"
|
|
112
116
|
}, /*#__PURE__*/_react["default"].createElement("defs", null, /*#__PURE__*/_react["default"].createElement("filter", {
|
|
@@ -152,7 +156,8 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
152
156
|
x: positionX,
|
|
153
157
|
y: positionY,
|
|
154
158
|
length: Math.abs(y1 - y2),
|
|
155
|
-
seriesWidth: seriesWidth
|
|
159
|
+
seriesWidth: seriesWidth,
|
|
160
|
+
maxWidth: maxWidth
|
|
156
161
|
});
|
|
157
162
|
return /*#__PURE__*/_react["default"].createElement("g", {
|
|
158
163
|
key: i,
|
|
@@ -195,7 +200,7 @@ var Column3DSkin = function Column3DSkin(props) {
|
|
|
195
200
|
fill: color.fill,
|
|
196
201
|
style: {
|
|
197
202
|
transformOrigin: "".concat(x + width / 2, "px ").concat(y + height / 2, "px"),
|
|
198
|
-
transform:
|
|
203
|
+
transform: "skew(0deg, -45deg)"
|
|
199
204
|
}
|
|
200
205
|
}), /*#__PURE__*/_react["default"].createElement("rect", {
|
|
201
206
|
width: width / 2,
|
|
@@ -227,7 +232,7 @@ function deg2rad(deg) {
|
|
|
227
232
|
return deg / AngleTransfromRatio;
|
|
228
233
|
}
|
|
229
234
|
function deepCopy(obj) {
|
|
230
|
-
if ((0, _typeof2["default"])(obj) ==
|
|
235
|
+
if ((0, _typeof2["default"])(obj) == "object") {
|
|
231
236
|
var o;
|
|
232
237
|
if (Array.isArray(obj)) {
|
|
233
238
|
o = [];
|
|
@@ -247,7 +252,7 @@ function deepCopy(obj) {
|
|
|
247
252
|
}
|
|
248
253
|
}
|
|
249
254
|
function parseMultiColorToSVG(config, id) {
|
|
250
|
-
if (config.type ==
|
|
255
|
+
if (config.type == "linear") {
|
|
251
256
|
var _config$linear = config.linear,
|
|
252
257
|
stops = _config$linear.stops,
|
|
253
258
|
opacity = _config$linear.opacity;
|
|
@@ -265,14 +270,14 @@ function parseMultiColorToSVG(config, id) {
|
|
|
265
270
|
}); //必须排序才能渲染出来
|
|
266
271
|
return {
|
|
267
272
|
fill: "url(#".concat(id, ")"),
|
|
268
|
-
def: /*#__PURE__*/_react["default"].createElement(
|
|
273
|
+
def: /*#__PURE__*/_react["default"].createElement("linearGradient", {
|
|
269
274
|
id: id,
|
|
270
275
|
x2: start[0],
|
|
271
276
|
y2: start[1],
|
|
272
277
|
x1: end[0],
|
|
273
278
|
y1: end[1]
|
|
274
279
|
}, _stops.map(function (e) {
|
|
275
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
280
|
+
return /*#__PURE__*/_react["default"].createElement("stop", {
|
|
276
281
|
key: e.offset,
|
|
277
282
|
offset: e.offset / 100,
|
|
278
283
|
stopColor: e.color,
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 轴类图背景
|
|
3
3
|
*/
|
|
4
|
-
import React from
|
|
5
|
-
import { getSeriesInfo } from
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { getSeriesInfo } from "../utils";
|
|
6
6
|
|
|
7
7
|
export default ({
|
|
8
8
|
axis: { ticks, scaler, step, direction },
|
|
@@ -28,7 +28,7 @@ export default ({
|
|
|
28
28
|
};
|
|
29
29
|
length: number;
|
|
30
30
|
}) => {
|
|
31
|
-
const isVertical: boolean = direction ===
|
|
31
|
+
const isVertical: boolean = direction === "vertical";
|
|
32
32
|
|
|
33
33
|
const { width: bandwidth } = getSeriesInfo({
|
|
34
34
|
step,
|
|
@@ -54,7 +54,7 @@ export default ({
|
|
|
54
54
|
x={isVertical ? 0 : scaler(tick) - bandwidth / 2}
|
|
55
55
|
y={isVertical ? scaler(tick) - bandwidth / 2 : 0}
|
|
56
56
|
fill={background}
|
|
57
|
-
stroke=
|
|
57
|
+
stroke="none"
|
|
58
58
|
/>
|
|
59
59
|
);
|
|
60
60
|
});
|
package/src/components/Band.tsx
CHANGED
|
@@ -42,7 +42,7 @@ const getAttr = ({
|
|
|
42
42
|
const len = length ? length : 0.1; //柱子长度
|
|
43
43
|
if (isVertical) {
|
|
44
44
|
return {
|
|
45
|
-
width: Math.min(Math.max(0, len), maxWidth),
|
|
45
|
+
width: maxWidth ? Math.min(Math.max(0, len), maxWidth) : Math.max(0, len),
|
|
46
46
|
height: Math.max(0, seriesWidth),
|
|
47
47
|
x: y,
|
|
48
48
|
y: x,
|
|
@@ -55,9 +55,13 @@ const getAttr = ({
|
|
|
55
55
|
};
|
|
56
56
|
} else {
|
|
57
57
|
return {
|
|
58
|
-
x:
|
|
58
|
+
x: maxWidth
|
|
59
|
+
? seriesWidth > maxWidth
|
|
60
|
+
? x + (seriesWidth - maxWidth) / 2
|
|
61
|
+
: x
|
|
62
|
+
: x,
|
|
59
63
|
y,
|
|
60
|
-
width: Math.min(seriesWidth, maxWidth),
|
|
64
|
+
width: maxWidth ? Math.min(seriesWidth, maxWidth) : seriesWidth,
|
|
61
65
|
height: len,
|
|
62
66
|
bgAttr: {
|
|
63
67
|
x,
|
|
@@ -95,7 +99,8 @@ export default memo(
|
|
|
95
99
|
isControlChart = false,
|
|
96
100
|
setCtlTip,
|
|
97
101
|
isXRepeat,
|
|
98
|
-
maxWidth,
|
|
102
|
+
maxWidth: maxWidth1,
|
|
103
|
+
config,
|
|
99
104
|
config: {
|
|
100
105
|
pattern = {},
|
|
101
106
|
seriesIntervalWidth: paddingInner = 0,
|
|
@@ -117,6 +122,7 @@ export default memo(
|
|
|
117
122
|
},
|
|
118
123
|
yAxis: { scaler: yScaler, isClipAxis, clipValue, reverse },
|
|
119
124
|
}: any) => {
|
|
125
|
+
const maxWidth = maxWidth1 ? maxWidth1 : config.maxWidth;
|
|
120
126
|
if (!data.length) return null;
|
|
121
127
|
let selectConfig = other;
|
|
122
128
|
if (selectStyle) {
|
|
@@ -39,12 +39,14 @@ const Chart = memo(
|
|
|
39
39
|
config: {
|
|
40
40
|
axes: axesConfig,
|
|
41
41
|
background,
|
|
42
|
+
chart,
|
|
42
43
|
chart: {
|
|
43
44
|
margin: { marginLeft, marginTop, marginRight, marginBottom },
|
|
44
45
|
animation,
|
|
45
46
|
legend,
|
|
46
47
|
selectStyle,
|
|
47
|
-
bar
|
|
48
|
+
bar,
|
|
49
|
+
// bar: { maxWidth = 0 },
|
|
48
50
|
},
|
|
49
51
|
series,
|
|
50
52
|
bandLength,
|
|
@@ -639,7 +641,7 @@ const Chart = memo(
|
|
|
639
641
|
triggerEvents={onInteraction}
|
|
640
642
|
setCtlTip={setCtlTip}
|
|
641
643
|
isXRepeat={isXRepeat}
|
|
642
|
-
maxWidth={maxWidth}
|
|
644
|
+
maxWidth={bar ? bar.maxWidth : 0}
|
|
643
645
|
/>
|
|
644
646
|
)
|
|
645
647
|
);
|
|
@@ -3,240 +3,288 @@ import { chartContext } from "../context";
|
|
|
3
3
|
import { scaleLinear } from "d3-scale";
|
|
4
4
|
import { mathR } from "../utils";
|
|
5
5
|
|
|
6
|
-
export default memo(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
cursor:"col-resize",
|
|
39
|
-
background:"rgb(2, 176, 249)",
|
|
40
|
-
WebkitBackgroundClip:"content-box",
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
//左手柄的鼠标按下逻辑
|
|
44
|
-
const leftDown=()=>{
|
|
45
|
-
const transform = ref.current.style.transform;
|
|
46
|
-
let initX = 0;
|
|
47
|
-
let rawTranslateX = parseFloat(transform?transform.match(/\d+\.*\d*/)[0]:0);
|
|
48
|
-
const rightX = rawTranslateX+cBarWidth;
|
|
49
|
-
const move=(e)=>{
|
|
50
|
-
const { movementX:ex } = e;
|
|
51
|
-
const movementX = ex * scale.current[0];
|
|
52
|
-
initX = mathR(initX+movementX,[-rawTranslateX, rightX-rawTranslateX]);
|
|
53
|
-
setControlWidth((pre)=>{
|
|
54
|
-
const { cWidth, cBarWidth } = pre;
|
|
55
|
-
const nextBarWidth = mathR(cBarWidth-movementX,[1,rightX]);
|
|
56
|
-
return {
|
|
57
|
-
...pre,
|
|
58
|
-
cBarWidth:nextBarWidth,
|
|
59
|
-
cPercent:nextBarWidth/cWidth,
|
|
60
|
-
cBarX:initX+rawTranslateX
|
|
61
|
-
}
|
|
62
|
-
}, true);
|
|
63
|
-
}
|
|
64
|
-
const up=()=>{
|
|
65
|
-
document.removeEventListener("mousemove",move);
|
|
66
|
-
document.removeEventListener("mouseup",up);
|
|
67
|
-
}
|
|
68
|
-
document.addEventListener("mousemove",move);
|
|
69
|
-
document.addEventListener("mouseup",up);
|
|
70
|
-
}
|
|
71
|
-
//左手手柄的移动端适配
|
|
72
|
-
const leftTouchStart = (e)=>{
|
|
73
|
-
const transform = ref.current.style.transform;
|
|
74
|
-
let rawTranslateX = parseFloat(transform?transform.match(/\d+\.*\d*/)[0]:0);
|
|
75
|
-
let initX = 0;
|
|
76
|
-
const rightX = rawTranslateX+cBarWidth;
|
|
77
|
-
let startX = e.touches[0].clientX;
|
|
78
|
-
let currentX = 0;
|
|
79
|
-
let movementX = 0;
|
|
80
|
-
const move = (e)=>{
|
|
81
|
-
e.preventDefault();
|
|
82
|
-
currentX = e.touches[0].clientX;
|
|
83
|
-
movementX = currentX - startX;
|
|
84
|
-
startX = currentX;
|
|
85
|
-
initX = mathR(initX+movementX,[-rawTranslateX, rightX-rawTranslateX]);
|
|
86
|
-
setControlWidth((pre)=>{
|
|
87
|
-
const { cWidth, cBarWidth } = pre;
|
|
88
|
-
const nextBarWidth = mathR(cBarWidth-movementX,[1,rightX]);
|
|
89
|
-
return {
|
|
90
|
-
...pre,
|
|
91
|
-
cBarWidth:nextBarWidth,
|
|
92
|
-
cPercent:nextBarWidth/cWidth,
|
|
93
|
-
cBarX:initX+rawTranslateX
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
const up = (e) => {
|
|
98
|
-
document.removeEventListener("touchmove", move);
|
|
99
|
-
document.removeEventListener("touchend", up);
|
|
6
|
+
export default memo(
|
|
7
|
+
forwardRef((props, ref) => {
|
|
8
|
+
const {
|
|
9
|
+
actions: { setX, setWorking, setControlWidth },
|
|
10
|
+
props: {
|
|
11
|
+
control: {
|
|
12
|
+
thumbnail,
|
|
13
|
+
height,
|
|
14
|
+
color,
|
|
15
|
+
gap,
|
|
16
|
+
drag: { color: dragColor },
|
|
17
|
+
margin: { left },
|
|
18
|
+
},
|
|
19
|
+
controlInfo: { cWidth, cBarWidth },
|
|
20
|
+
axes,
|
|
21
|
+
series,
|
|
22
|
+
top,
|
|
23
|
+
bandLength,
|
|
24
|
+
},
|
|
25
|
+
} = props;
|
|
26
|
+
const context = useContext(chartContext);
|
|
27
|
+
const scale = context.scale;
|
|
28
|
+
const xAxis = axes.get("x");
|
|
29
|
+
const barRef = useRef();
|
|
30
|
+
|
|
31
|
+
const barStyle = {
|
|
32
|
+
position: "absolute",
|
|
33
|
+
top: 0,
|
|
34
|
+
width: cBarWidth,
|
|
35
|
+
display: "flex",
|
|
36
|
+
justifyContent: "space-between",
|
|
37
|
+
background: dragColor,
|
|
100
38
|
};
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const down=()=>{
|
|
106
|
-
const transform = ref.current.style.transform;
|
|
107
|
-
let movementX = 0;
|
|
108
|
-
let rawTranslateX = parseFloat(transform?transform.match(/\d+\.*\d*/)[0]:0);
|
|
109
|
-
const mouseMoveHandle = (e) => {
|
|
110
|
-
//当前位移的距离
|
|
111
|
-
movementX += e.movementX * scale.current[0];
|
|
112
|
-
setX(movementX + rawTranslateX,true);
|
|
39
|
+
const dragStyle = {
|
|
40
|
+
height,
|
|
41
|
+
flex: 1,
|
|
42
|
+
cursor: "move",
|
|
113
43
|
};
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
44
|
+
const controllerStyle = {
|
|
45
|
+
position: "relative",
|
|
46
|
+
width: 12,
|
|
47
|
+
height,
|
|
48
|
+
padding: "0 5px",
|
|
49
|
+
cursor: "col-resize",
|
|
50
|
+
background: "rgb(2, 176, 249)",
|
|
51
|
+
WebkitBackgroundClip: "content-box",
|
|
118
52
|
};
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
53
|
+
|
|
54
|
+
//左手柄的鼠标按下逻辑
|
|
55
|
+
const leftDown = () => {
|
|
56
|
+
const transform = ref.current.style.transform;
|
|
57
|
+
let initX = 0;
|
|
58
|
+
let rawTranslateX = parseFloat(
|
|
59
|
+
transform ? transform.match(/\d+\.*\d*/)[0] : 0
|
|
60
|
+
);
|
|
61
|
+
const rightX = rawTranslateX + cBarWidth;
|
|
62
|
+
const move = (e) => {
|
|
63
|
+
const { movementX: ex } = e;
|
|
64
|
+
const movementX = ex * scale.current[0];
|
|
65
|
+
initX = mathR(initX + movementX, [
|
|
66
|
+
-rawTranslateX,
|
|
67
|
+
rightX - rawTranslateX,
|
|
68
|
+
]);
|
|
69
|
+
setControlWidth((pre) => {
|
|
70
|
+
const { cWidth, cBarWidth } = pre;
|
|
71
|
+
const nextBarWidth = mathR(cBarWidth - movementX, [1, rightX]);
|
|
72
|
+
return {
|
|
73
|
+
...pre,
|
|
74
|
+
cBarWidth: nextBarWidth,
|
|
75
|
+
cPercent: nextBarWidth / cWidth,
|
|
76
|
+
cBarX: initX + rawTranslateX,
|
|
77
|
+
};
|
|
78
|
+
}, true);
|
|
79
|
+
};
|
|
80
|
+
const up = () => {
|
|
81
|
+
document.removeEventListener("mousemove", move);
|
|
82
|
+
document.removeEventListener("mouseup", up);
|
|
83
|
+
};
|
|
84
|
+
document.addEventListener("mousemove", move);
|
|
85
|
+
document.addEventListener("mouseup", up);
|
|
141
86
|
};
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
87
|
+
//左手手柄的移动端适配
|
|
88
|
+
const leftTouchStart = (e) => {
|
|
89
|
+
const transform = ref.current.style.transform;
|
|
90
|
+
let rawTranslateX = parseFloat(
|
|
91
|
+
transform ? transform.match(/\d+\.*\d*/)[0] : 0
|
|
92
|
+
);
|
|
93
|
+
let initX = 0;
|
|
94
|
+
const rightX = rawTranslateX + cBarWidth;
|
|
95
|
+
let startX = e.touches[0].clientX;
|
|
96
|
+
let currentX = 0;
|
|
97
|
+
let movementX = 0;
|
|
98
|
+
const move = (e) => {
|
|
99
|
+
e.preventDefault();
|
|
100
|
+
currentX = e.touches[0].clientX;
|
|
101
|
+
movementX = currentX - startX;
|
|
102
|
+
startX = currentX;
|
|
103
|
+
initX = mathR(initX + movementX, [
|
|
104
|
+
-rawTranslateX,
|
|
105
|
+
rightX - rawTranslateX,
|
|
106
|
+
]);
|
|
107
|
+
setControlWidth((pre) => {
|
|
108
|
+
const { cWidth, cBarWidth } = pre;
|
|
109
|
+
const nextBarWidth = mathR(cBarWidth - movementX, [1, rightX]);
|
|
110
|
+
return {
|
|
111
|
+
...pre,
|
|
112
|
+
cBarWidth: nextBarWidth,
|
|
113
|
+
cPercent: nextBarWidth / cWidth,
|
|
114
|
+
cBarX: initX + rawTranslateX,
|
|
115
|
+
};
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
const up = (e) => {
|
|
119
|
+
document.removeEventListener("touchmove", move);
|
|
120
|
+
document.removeEventListener("touchend", up);
|
|
121
|
+
};
|
|
122
|
+
document.addEventListener("touchmove", move, { passive: false });
|
|
123
|
+
document.addEventListener("touchend", up);
|
|
124
|
+
};
|
|
125
|
+
//滑块的鼠标按下操作
|
|
126
|
+
const down = () => {
|
|
127
|
+
const transform = ref.current.style.transform;
|
|
128
|
+
let movementX = 0;
|
|
129
|
+
let rawTranslateX = parseFloat(
|
|
130
|
+
transform ? transform.match(/\d+\.*\d*/)[0] : 0
|
|
131
|
+
);
|
|
132
|
+
const mouseMoveHandle = (e) => {
|
|
133
|
+
//当前位移的距离
|
|
134
|
+
movementX += e.movementX * scale.current[0];
|
|
135
|
+
setX(movementX + rawTranslateX, true);
|
|
136
|
+
};
|
|
137
|
+
const mouseUpHandle = (e) => {
|
|
138
|
+
setWorking(false);
|
|
139
|
+
document.removeEventListener("mousemove", mouseMoveHandle);
|
|
140
|
+
document.removeEventListener("mouseup", mouseUpHandle);
|
|
141
|
+
};
|
|
142
|
+
document.addEventListener("mousemove", mouseMoveHandle);
|
|
143
|
+
document.addEventListener("mouseup", mouseUpHandle);
|
|
144
|
+
setWorking(true);
|
|
145
|
+
};
|
|
146
|
+
//移动端适配
|
|
147
|
+
const touchStart = (e) => {
|
|
148
|
+
const transform = ref.current.style.transform;
|
|
149
|
+
let startX = e.touches[0].clientX;
|
|
150
|
+
let currentX = 0;
|
|
151
|
+
let movementX = 0;
|
|
152
|
+
let rawTranslateX = parseFloat(
|
|
153
|
+
transform ? transform.match(/\d+\.*\d*/)[0] : 0
|
|
154
|
+
);
|
|
155
|
+
const mouseMoveHandle = (e) => {
|
|
156
|
+
e.preventDefault();
|
|
157
|
+
currentX = e.touches[0].clientX;
|
|
158
|
+
movementX += currentX - startX;
|
|
159
|
+
startX = currentX;
|
|
160
|
+
setX(movementX + rawTranslateX, true);
|
|
161
|
+
};
|
|
162
|
+
const mouseUpHandle = (e) => {
|
|
163
|
+
setWorking(false);
|
|
164
|
+
document.removeEventListener("touchmove", mouseMoveHandle);
|
|
165
|
+
document.removeEventListener("touchend", mouseUpHandle);
|
|
166
|
+
};
|
|
167
|
+
document.addEventListener("touchmove", mouseMoveHandle, {
|
|
168
|
+
passive: false,
|
|
192
169
|
});
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
170
|
+
document.addEventListener("touchend", mouseUpHandle);
|
|
171
|
+
setWorking(true);
|
|
172
|
+
};
|
|
173
|
+
//右手柄的鼠标按下逻辑
|
|
174
|
+
const rightDown = () => {
|
|
175
|
+
const transform = ref.current.style.transform;
|
|
176
|
+
let rawTranslateX = parseFloat(
|
|
177
|
+
transform ? transform.match(/\d+\.*\d*/)[0] : 0
|
|
178
|
+
);
|
|
179
|
+
const move = (e) => {
|
|
180
|
+
const { movementX: ex } = e;
|
|
181
|
+
const movementX = ex * scale.current[0];
|
|
182
|
+
setControlWidth((pre) => {
|
|
183
|
+
const { cWidth, cBarWidth } = pre;
|
|
184
|
+
const maxWidth = cWidth - rawTranslateX;
|
|
185
|
+
const nextBarWidth = mathR(cBarWidth + movementX, [1, maxWidth]);
|
|
186
|
+
return {
|
|
187
|
+
...pre,
|
|
188
|
+
cBarWidth: nextBarWidth,
|
|
189
|
+
cPercent: nextBarWidth / cWidth,
|
|
190
|
+
};
|
|
191
|
+
});
|
|
192
|
+
};
|
|
193
|
+
const up = () => {
|
|
194
|
+
document.removeEventListener("mousemove", move);
|
|
195
|
+
document.removeEventListener("mouseup", up);
|
|
196
|
+
};
|
|
197
|
+
document.addEventListener("mousemove", move);
|
|
198
|
+
document.addEventListener("mouseup", up);
|
|
197
199
|
};
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
200
|
+
//右手手柄的移动端适配
|
|
201
|
+
const rightTouchStart = (e) => {
|
|
202
|
+
const transform = ref.current.style.transform;
|
|
203
|
+
let startX = e.touches[0].clientX;
|
|
204
|
+
let currentX = 0;
|
|
205
|
+
let movementX = 0;
|
|
206
|
+
let rawTranslateX = parseFloat(
|
|
207
|
+
transform ? transform.match(/\d+\.*\d*/)[0] : 0
|
|
208
|
+
);
|
|
209
|
+
const move = (e) => {
|
|
210
|
+
e.preventDefault();
|
|
211
|
+
currentX = e.touches[0].clientX;
|
|
212
|
+
movementX = currentX - startX;
|
|
213
|
+
startX = currentX;
|
|
214
|
+
setControlWidth((pre) => {
|
|
215
|
+
const { cWidth, cBarWidth } = pre;
|
|
216
|
+
const maxWidth = cWidth - rawTranslateX;
|
|
217
|
+
const nextBarWidth = mathR(cBarWidth + movementX, [1, maxWidth]);
|
|
218
|
+
return {
|
|
219
|
+
...pre,
|
|
220
|
+
cBarWidth: nextBarWidth,
|
|
221
|
+
cPercent: nextBarWidth / cWidth,
|
|
222
|
+
};
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
const up = (e) => {
|
|
226
|
+
document.removeEventListener("touchmove", move);
|
|
227
|
+
document.removeEventListener("touchend", up);
|
|
228
|
+
};
|
|
229
|
+
document.addEventListener("touchmove", move, { passive: false });
|
|
230
|
+
document.addEventListener("touchend", up);
|
|
231
|
+
};
|
|
232
|
+
return (
|
|
233
|
+
<div
|
|
234
|
+
style={{
|
|
235
|
+
width: cWidth,
|
|
236
|
+
height: height,
|
|
237
|
+
backgroundColor: color,
|
|
238
|
+
transform: `translate(${left}px,${top - height + gap}px)`,
|
|
239
|
+
}}
|
|
240
|
+
>
|
|
241
|
+
<svg
|
|
242
|
+
width="100%"
|
|
243
|
+
height="100%"
|
|
244
|
+
style={{ display: thumbnail ? "block" : "none" }}
|
|
245
|
+
>
|
|
246
|
+
{series.map(({ Component, yOrZ, ...config }, index) => {
|
|
247
|
+
const yAxis = axes.get(yOrZ);
|
|
248
|
+
const cloneYAxis = JSON.parse(JSON.stringify(yAxis));
|
|
249
|
+
//todo range
|
|
250
|
+
cloneYAxis.scaler = scaleLinear()
|
|
251
|
+
.domain(yAxis.domain)
|
|
252
|
+
.range([height, 0]);
|
|
253
|
+
return (
|
|
254
|
+
yAxis &&
|
|
255
|
+
Component && (
|
|
256
|
+
<Component
|
|
257
|
+
key={index}
|
|
258
|
+
{...config}
|
|
259
|
+
bandLength={bandLength}
|
|
260
|
+
xAxis={xAxis}
|
|
261
|
+
yAxis={cloneYAxis}
|
|
262
|
+
triggerClick={() => {}}
|
|
263
|
+
/>
|
|
264
|
+
)
|
|
265
|
+
);
|
|
266
|
+
})}
|
|
267
|
+
</svg>
|
|
268
|
+
{/* 控制条 */}
|
|
269
|
+
<div ref={ref} style={barStyle}>
|
|
270
|
+
<div
|
|
271
|
+
style={{ ...controllerStyle, transform: "translateX(-6px)" }}
|
|
272
|
+
onMouseDown={leftDown}
|
|
273
|
+
onTouchStart={leftTouchStart}
|
|
274
|
+
></div>
|
|
275
|
+
<div
|
|
276
|
+
style={dragStyle}
|
|
277
|
+
onMouseDown={down}
|
|
278
|
+
onTouchStart={touchStart}
|
|
279
|
+
ref={barRef}
|
|
280
|
+
></div>
|
|
281
|
+
<div
|
|
282
|
+
style={{ ...controllerStyle, transform: `translateX(6px)` }}
|
|
283
|
+
onMouseDown={rightDown}
|
|
284
|
+
onTouchStart={rightTouchStart}
|
|
285
|
+
></div>
|
|
286
|
+
</div>
|
|
238
287
|
</div>
|
|
239
|
-
|
|
240
|
-
)
|
|
241
|
-
|
|
242
|
-
|
|
288
|
+
);
|
|
289
|
+
})
|
|
290
|
+
);
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 立体柱状图的柱子
|
|
3
3
|
*/
|
|
4
|
-
import React, { memo } from
|
|
5
|
-
import { min, max } from
|
|
6
|
-
import { getSeriesInfo } from
|
|
4
|
+
import React, { memo } from "react";
|
|
5
|
+
import { min, max } from "d3v7";
|
|
6
|
+
import { getSeriesInfo } from "../utils";
|
|
7
7
|
|
|
8
8
|
const getHighlightData = (data: Array<DataWithBoundType>, extent: string) => {
|
|
9
9
|
switch (extent) {
|
|
10
|
-
case
|
|
10
|
+
case "min":
|
|
11
11
|
const minData = min(data, (d: DataWithBoundType) => d.data.y);
|
|
12
12
|
return data.map((item) => ({
|
|
13
13
|
...item,
|
|
14
|
-
flag: minData == item.data.y ?
|
|
14
|
+
flag: minData == item.data.y ? "min" : "",
|
|
15
15
|
}));
|
|
16
|
-
case
|
|
16
|
+
case "max":
|
|
17
17
|
const maxData = max(data, (d: DataWithBoundType) => d.data.y);
|
|
18
18
|
return data.map((item) => ({
|
|
19
19
|
...item,
|
|
20
|
-
flag: maxData == item.data.y ?
|
|
20
|
+
flag: maxData == item.data.y ? "max" : "",
|
|
21
21
|
}));
|
|
22
22
|
default:
|
|
23
23
|
return data;
|
|
@@ -30,18 +30,32 @@ const getAttr = ({
|
|
|
30
30
|
length,
|
|
31
31
|
x,
|
|
32
32
|
y,
|
|
33
|
+
maxWidth,
|
|
33
34
|
}: {
|
|
34
35
|
isVertical: boolean;
|
|
35
36
|
seriesWidth: number;
|
|
36
37
|
length: number;
|
|
37
38
|
x: number;
|
|
38
39
|
y: number;
|
|
40
|
+
maxWidth: number;
|
|
39
41
|
}) => {
|
|
40
|
-
if (isVertical)
|
|
42
|
+
if (isVertical)
|
|
43
|
+
return {
|
|
44
|
+
width: maxWidth
|
|
45
|
+
? Math.min(Math.max(0, length), maxWidth)
|
|
46
|
+
: Math.max(0, length),
|
|
47
|
+
height: seriesWidth,
|
|
48
|
+
x: y,
|
|
49
|
+
y: x,
|
|
50
|
+
};
|
|
41
51
|
return {
|
|
42
|
-
x
|
|
52
|
+
x: maxWidth
|
|
53
|
+
? seriesWidth > maxWidth
|
|
54
|
+
? x + (seriesWidth - maxWidth) / 2
|
|
55
|
+
: x
|
|
56
|
+
: x,
|
|
43
57
|
y,
|
|
44
|
-
width: seriesWidth,
|
|
58
|
+
width: maxWidth ? Math.min(seriesWidth, maxWidth) : seriesWidth,
|
|
45
59
|
height: length,
|
|
46
60
|
};
|
|
47
61
|
};
|
|
@@ -57,16 +71,18 @@ const getBorderRadius = ({
|
|
|
57
71
|
}) => {
|
|
58
72
|
return isVertical
|
|
59
73
|
? positive
|
|
60
|
-
?
|
|
61
|
-
: seriesWidth +
|
|
74
|
+
? "0px " + seriesWidth + "px " + seriesWidth + "px 0"
|
|
75
|
+
: seriesWidth + "px 0 0 " + seriesWidth + "px"
|
|
62
76
|
: positive
|
|
63
|
-
? seriesWidth / 2 +
|
|
64
|
-
:
|
|
77
|
+
? seriesWidth / 2 + "px " + seriesWidth / 2 + "px 0 0"
|
|
78
|
+
: "0 0 " + seriesWidth / 2 + "px " + seriesWidth / 2 + "px";
|
|
65
79
|
};
|
|
66
80
|
|
|
67
81
|
export default memo(
|
|
68
82
|
({
|
|
69
83
|
triggerClick,
|
|
84
|
+
maxWidth: maxWidth1,
|
|
85
|
+
config,
|
|
70
86
|
config: {
|
|
71
87
|
pattern = {},
|
|
72
88
|
seriesIntervalWidth: paddingInner = 0,
|
|
@@ -80,8 +96,9 @@ export default memo(
|
|
|
80
96
|
data,
|
|
81
97
|
xAxis: { scaler: xScaler, step, direction },
|
|
82
98
|
yAxis: { scaler: yScaler },
|
|
83
|
-
name
|
|
99
|
+
name,
|
|
84
100
|
}: any) => {
|
|
101
|
+
const maxWidth = maxWidth1 ? maxWidth1 : config.maxWidth;
|
|
85
102
|
if (!data.length) return null;
|
|
86
103
|
const { seriesWidth, seriesStep, seriesStart } = getSeriesInfo({
|
|
87
104
|
step,
|
|
@@ -91,31 +108,28 @@ export default memo(
|
|
|
91
108
|
});
|
|
92
109
|
const _data = showHighlight ? getHighlightData(data, extent) : data;
|
|
93
110
|
|
|
94
|
-
const isVertical = direction ===
|
|
111
|
+
const isVertical = direction === "vertical";
|
|
95
112
|
|
|
96
113
|
const highlightColor = parseMultiColorToSVG(
|
|
97
114
|
highlightFill,
|
|
98
|
-
|
|
99
|
-
);
|
|
100
|
-
const color = parseMultiColorToSVG(
|
|
101
|
-
fill,
|
|
102
|
-
'gradient_' + id + '_' + name
|
|
115
|
+
"highlight_gradient_" + id + "_" + name
|
|
103
116
|
);
|
|
117
|
+
const color = parseMultiColorToSVG(fill, "gradient_" + id + "_" + name);
|
|
104
118
|
return (
|
|
105
|
-
<g className=
|
|
119
|
+
<g className="__easyv-band">
|
|
106
120
|
<defs>
|
|
107
121
|
<filter id={`filter_front`}>
|
|
108
122
|
<feComponentTransfer>
|
|
109
|
-
<feFuncR type=
|
|
110
|
-
<feFuncG type=
|
|
111
|
-
<feFuncB type=
|
|
123
|
+
<feFuncR type="linear" slope="0.5" />
|
|
124
|
+
<feFuncG type="linear" slope="0.5" />
|
|
125
|
+
<feFuncB type="linear" slope="0.5" />
|
|
112
126
|
</feComponentTransfer>
|
|
113
127
|
</filter>
|
|
114
128
|
<filter id={`filter_side`}>
|
|
115
129
|
<feComponentTransfer>
|
|
116
|
-
<feFuncR type=
|
|
117
|
-
<feFuncG type=
|
|
118
|
-
<feFuncB type=
|
|
130
|
+
<feFuncR type="linear" slope="0.7" />
|
|
131
|
+
<feFuncG type="linear" slope="0.7" />
|
|
132
|
+
<feFuncB type="linear" slope="0.7" />
|
|
119
133
|
</feComponentTransfer>
|
|
120
134
|
</filter>
|
|
121
135
|
{highlightColor.def}
|
|
@@ -146,6 +160,7 @@ export default memo(
|
|
|
146
160
|
y: positionY,
|
|
147
161
|
length: Math.abs(y1 - y2),
|
|
148
162
|
seriesWidth,
|
|
163
|
+
maxWidth,
|
|
149
164
|
});
|
|
150
165
|
|
|
151
166
|
return (
|
|
@@ -175,7 +190,7 @@ const Column3DSkin = function (props: any) {
|
|
|
175
190
|
transform: `skew(0deg, 23deg)`,
|
|
176
191
|
transformOrigin: `${x + width / 2}px ${y + height / 2}px`,
|
|
177
192
|
opacity: opacity,
|
|
178
|
-
cursor:"pointer"
|
|
193
|
+
cursor: "pointer",
|
|
179
194
|
}}
|
|
180
195
|
>
|
|
181
196
|
{color.defs}
|
|
@@ -197,7 +212,7 @@ const Column3DSkin = function (props: any) {
|
|
|
197
212
|
fill={color.fill}
|
|
198
213
|
style={{
|
|
199
214
|
transformOrigin: `${x + width / 2}px ${y + height / 2}px`,
|
|
200
|
-
transform:
|
|
215
|
+
transform: "skew(0deg, -45deg)",
|
|
201
216
|
}}
|
|
202
217
|
></rect>
|
|
203
218
|
{/* 顶部 */}
|
|
@@ -233,7 +248,7 @@ function deg2rad(deg: any) {
|
|
|
233
248
|
return deg / AngleTransfromRatio;
|
|
234
249
|
}
|
|
235
250
|
function deepCopy(obj: any): any {
|
|
236
|
-
if (typeof obj ==
|
|
251
|
+
if (typeof obj == "object") {
|
|
237
252
|
let o: any;
|
|
238
253
|
if (Array.isArray(obj)) {
|
|
239
254
|
o = [];
|
|
@@ -252,7 +267,7 @@ function deepCopy(obj: any): any {
|
|
|
252
267
|
}
|
|
253
268
|
}
|
|
254
269
|
function parseMultiColorToSVG(config: any, id: any) {
|
|
255
|
-
if (config.type ==
|
|
270
|
+
if (config.type == "linear") {
|
|
256
271
|
const { stops, opacity } = config.linear;
|
|
257
272
|
let start = [0, 0.5],
|
|
258
273
|
end = [1, 0.5];
|
|
@@ -267,7 +282,7 @@ function parseMultiColorToSVG(config: any, id: any) {
|
|
|
267
282
|
return {
|
|
268
283
|
fill: `url(#${id})`,
|
|
269
284
|
def: React.createElement(
|
|
270
|
-
|
|
285
|
+
"linearGradient",
|
|
271
286
|
{
|
|
272
287
|
id,
|
|
273
288
|
x2: start[0],
|
|
@@ -276,7 +291,7 @@ function parseMultiColorToSVG(config: any, id: any) {
|
|
|
276
291
|
y1: end[1],
|
|
277
292
|
},
|
|
278
293
|
_stops.map((e: any) => {
|
|
279
|
-
return React.createElement(
|
|
294
|
+
return React.createElement("stop", {
|
|
280
295
|
key: e.offset,
|
|
281
296
|
offset: e.offset / 100,
|
|
282
297
|
stopColor: e.color,
|