@easyv/charts 1.4.38 → 1.4.39
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/Axis.js +10 -8
- package/lib/components/Band.js +32 -29
- package/lib/components/Control.js +10 -2
- package/package.json +1 -1
- package/src/components/Axis.tsx +8 -10
- package/src/components/Band.tsx +24 -21
- package/src/components/Control.jsx +13 -1
package/lib/components/Axis.js
CHANGED
|
@@ -54,7 +54,7 @@ var defaultFormatter = function defaultFormatter(d, _ref) {
|
|
|
54
54
|
return d + suffix;
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
var getAxesPath = function getAxesPath(orientation, _ref2) {
|
|
57
|
+
var getAxesPath = function getAxesPath(orientation, _ref2, cHeight) {
|
|
58
58
|
var width = _ref2.width,
|
|
59
59
|
height = _ref2.height;
|
|
60
60
|
|
|
@@ -65,7 +65,7 @@ var getAxesPath = function getAxesPath(orientation, _ref2) {
|
|
|
65
65
|
|
|
66
66
|
case "left":
|
|
67
67
|
case "right":
|
|
68
|
-
return "M0, -0.5V" + (height + 0.5);
|
|
68
|
+
return "M0, -0.5V" + (height + 0.5 - cHeight);
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
71
|
/**
|
|
@@ -119,14 +119,13 @@ var AxisLine = function AxisLine(_ref3) {
|
|
|
119
119
|
show = _ref3$config.show,
|
|
120
120
|
color = _ref3$config.color,
|
|
121
121
|
lineWidth = _ref3$config.lineWidth,
|
|
122
|
+
cHeight = _ref3$config.cHeight,
|
|
122
123
|
_ref3$isClipAxis = _ref3.isClipAxis,
|
|
123
124
|
isClipAxis = _ref3$isClipAxis === void 0 ? false : _ref3$isClipAxis,
|
|
124
125
|
_ref3$clipAxisRange = _ref3.clipAxisRange,
|
|
125
126
|
clipAxisRange = _ref3$clipAxisRange === void 0 ? [] : _ref3$clipAxisRange;
|
|
126
127
|
if (!show) return null;
|
|
127
128
|
var context = (0, _react.useContext)(_context.chartContext);
|
|
128
|
-
var width = context.width,
|
|
129
|
-
height = context.height;
|
|
130
129
|
|
|
131
130
|
if (isClipAxis) {
|
|
132
131
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, clipAxisRange.map(function (range, index) {
|
|
@@ -139,7 +138,7 @@ var AxisLine = function AxisLine(_ref3) {
|
|
|
139
138
|
}));
|
|
140
139
|
} else {
|
|
141
140
|
return /*#__PURE__*/_react["default"].createElement("path", {
|
|
142
|
-
d: getAxesPath(orientation, context),
|
|
141
|
+
d: getAxesPath(orientation, context, cHeight),
|
|
143
142
|
stroke: color,
|
|
144
143
|
strokeWidth: lineWidth
|
|
145
144
|
});
|
|
@@ -262,7 +261,6 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
262
261
|
tickLine = _ref6$config.tickLine,
|
|
263
262
|
gridLine = _ref6$config.gridLine,
|
|
264
263
|
unit = _ref6$config.unit,
|
|
265
|
-
config = _ref6.config,
|
|
266
264
|
positions = _ref6.positions,
|
|
267
265
|
xLineRange = _ref6.xLineRange,
|
|
268
266
|
range = _ref6.range,
|
|
@@ -373,7 +371,9 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
373
371
|
transform: "translate(" + x + ", " + y + ")"
|
|
374
372
|
}, /*#__PURE__*/_react["default"].createElement(AxisLine, {
|
|
375
373
|
orientation: orientation,
|
|
376
|
-
config: axisLine,
|
|
374
|
+
config: _objectSpread(_objectSpread({}, axisLine), {}, {
|
|
375
|
+
cHeight: cHeight
|
|
376
|
+
}),
|
|
377
377
|
range: range
|
|
378
378
|
}), tickLine && ticks.map(function (tick, index) {
|
|
379
379
|
var coordinate = scaler(tick);
|
|
@@ -402,7 +402,9 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
402
402
|
transform: "translate(" + x + ", " + y + ")"
|
|
403
403
|
}, /*#__PURE__*/_react["default"].createElement(AxisLine, {
|
|
404
404
|
orientation: orientation,
|
|
405
|
-
config: axisLine,
|
|
405
|
+
config: _objectSpread(_objectSpread({}, axisLine), {}, {
|
|
406
|
+
cHeight: cHeight
|
|
407
|
+
}),
|
|
406
408
|
isClipAxis: isClipAxis,
|
|
407
409
|
clipAxisRange: clipAxisRange
|
|
408
410
|
}), tickLine && drawAxisTickLine()))), /*#__PURE__*/_react["default"].createElement("svg", {
|
package/lib/components/Band.js
CHANGED
|
@@ -205,43 +205,46 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref3) {
|
|
|
205
205
|
style: {
|
|
206
206
|
overflow: "visible",
|
|
207
207
|
position: "relative",
|
|
208
|
-
pointerEvents: isControlChart ? "auto" : "none",
|
|
209
208
|
cursor: "pointer"
|
|
210
209
|
}
|
|
211
210
|
}, attr, {
|
|
212
211
|
onClick: triggerClick //enter和leave事件,用于控制图的提示框
|
|
213
212
|
,
|
|
214
213
|
onMouseEnter: function onMouseEnter() {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
214
|
+
if (isControlChart) {
|
|
215
|
+
setCtlTip(function (pre) {
|
|
216
|
+
return {
|
|
217
|
+
show: true,
|
|
218
|
+
x: xScaler(x),
|
|
219
|
+
xName: data.x,
|
|
220
|
+
indicatorList: pre.indicatorList.map(function (item) {
|
|
221
|
+
if (item.tick === data.x) {
|
|
222
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
223
|
+
isShow: true
|
|
224
|
+
});
|
|
225
|
+
} else {
|
|
226
|
+
return item;
|
|
227
|
+
}
|
|
228
|
+
})
|
|
229
|
+
};
|
|
230
|
+
});
|
|
231
|
+
}
|
|
231
232
|
},
|
|
232
233
|
onMouseLeave: function onMouseLeave() {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
234
|
+
if (isControlChart) {
|
|
235
|
+
setCtlTip(function (pre) {
|
|
236
|
+
return {
|
|
237
|
+
show: false,
|
|
238
|
+
x: undefined,
|
|
239
|
+
xName: undefined,
|
|
240
|
+
indicatorList: pre.indicatorList.map(function (item) {
|
|
241
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
242
|
+
isShow: false
|
|
243
|
+
});
|
|
244
|
+
})
|
|
245
|
+
};
|
|
246
|
+
});
|
|
247
|
+
}
|
|
245
248
|
},
|
|
246
249
|
"data-data": JSON.stringify(data)
|
|
247
250
|
}), headUrl && showHead && /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -67,7 +67,7 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
67
67
|
cursor: "col-resize",
|
|
68
68
|
background: "rgb(2, 176, 249)",
|
|
69
69
|
WebkitBackgroundClip: "content-box"
|
|
70
|
-
};
|
|
70
|
+
}; //滑块的鼠标按下操作
|
|
71
71
|
|
|
72
72
|
var down = function down() {
|
|
73
73
|
var transform = ref.current.style.transform;
|
|
@@ -89,7 +89,15 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
89
89
|
document.addEventListener("mousemove", mouseMoveHandle);
|
|
90
90
|
document.addEventListener("mouseup", mouseUpHandle);
|
|
91
91
|
setWorking(true);
|
|
92
|
-
};
|
|
92
|
+
}; // //右手柄的鼠标按下逻辑
|
|
93
|
+
// const rightDown=()=>{
|
|
94
|
+
// const move=(e)=>{
|
|
95
|
+
// }
|
|
96
|
+
// const up=()=>{
|
|
97
|
+
// }
|
|
98
|
+
// document.addEventListener()
|
|
99
|
+
// }
|
|
100
|
+
|
|
93
101
|
|
|
94
102
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
95
103
|
style: {
|
package/package.json
CHANGED
package/src/components/Axis.tsx
CHANGED
|
@@ -36,15 +36,16 @@ const defaultFormatter: (
|
|
|
36
36
|
|
|
37
37
|
const getAxesPath: (
|
|
38
38
|
orientation: Orientation,
|
|
39
|
-
{ width, height }: Context
|
|
40
|
-
|
|
39
|
+
{ width, height }: Context,
|
|
40
|
+
cHeight:number
|
|
41
|
+
) => string = (orientation, { width, height }, cHeight) => {
|
|
41
42
|
switch (orientation) {
|
|
42
43
|
case "top":
|
|
43
44
|
case "bottom":
|
|
44
45
|
return "M-0.5, 0H" + width;
|
|
45
46
|
case "left":
|
|
46
47
|
case "right":
|
|
47
|
-
return "M0, -0.5V" + (height + 0.5);
|
|
48
|
+
return "M0, -0.5V" + (height + 0.5 - cHeight);
|
|
48
49
|
}
|
|
49
50
|
};
|
|
50
51
|
/**
|
|
@@ -99,13 +100,12 @@ const AxisLine: ({
|
|
|
99
100
|
clipAxisRange,
|
|
100
101
|
}: any) => ReactComponentElement<ComponentType> | null = ({
|
|
101
102
|
orientation = defaultOrientation,
|
|
102
|
-
config: { show, color, lineWidth },
|
|
103
|
+
config: { show, color, lineWidth, cHeight },
|
|
103
104
|
isClipAxis = false,
|
|
104
105
|
clipAxisRange = [],
|
|
105
106
|
}) => {
|
|
106
107
|
if (!show) return null;
|
|
107
108
|
const context: Context = useContext(chartContext);
|
|
108
|
-
const { width, height } = context;
|
|
109
109
|
if (isClipAxis) {
|
|
110
110
|
return (
|
|
111
111
|
<>
|
|
@@ -124,7 +124,7 @@ const AxisLine: ({
|
|
|
124
124
|
} else {
|
|
125
125
|
return (
|
|
126
126
|
<path
|
|
127
|
-
d={getAxesPath(orientation, context)}
|
|
127
|
+
d={getAxesPath(orientation, context, cHeight)}
|
|
128
128
|
stroke={color}
|
|
129
129
|
strokeWidth={lineWidth}
|
|
130
130
|
/>
|
|
@@ -263,7 +263,6 @@ export default memo(
|
|
|
263
263
|
rotate,
|
|
264
264
|
triggerClick,
|
|
265
265
|
config: { on, label, axisLine, tickLine, gridLine, unit },
|
|
266
|
-
config,
|
|
267
266
|
positions,
|
|
268
267
|
xLineRange,
|
|
269
268
|
range,
|
|
@@ -398,7 +397,6 @@ export default memo(
|
|
|
398
397
|
return <>{draw(ticks, scaler)}</>;
|
|
399
398
|
}
|
|
400
399
|
}
|
|
401
|
-
|
|
402
400
|
return (
|
|
403
401
|
<g>
|
|
404
402
|
{/* 绘制轴线和刻度 */}
|
|
@@ -413,7 +411,7 @@ export default memo(
|
|
|
413
411
|
>
|
|
414
412
|
<AxisLine
|
|
415
413
|
orientation={orientation}
|
|
416
|
-
config={axisLine}
|
|
414
|
+
config={{...axisLine,cHeight}}
|
|
417
415
|
range={range}
|
|
418
416
|
/>
|
|
419
417
|
{tickLine &&
|
|
@@ -457,7 +455,7 @@ export default memo(
|
|
|
457
455
|
<g transform={"translate(" + x + ", " + y + ")"}>
|
|
458
456
|
<AxisLine
|
|
459
457
|
orientation={orientation}
|
|
460
|
-
config={axisLine}
|
|
458
|
+
config={{...axisLine,cHeight}}
|
|
461
459
|
isClipAxis={isClipAxis}
|
|
462
460
|
clipAxisRange={clipAxisRange}
|
|
463
461
|
/>
|
package/src/components/Band.tsx
CHANGED
|
@@ -169,35 +169,38 @@ export default memo(
|
|
|
169
169
|
style={{
|
|
170
170
|
overflow: "visible",
|
|
171
171
|
position: "relative",
|
|
172
|
-
pointerEvents:isControlChart?"auto":"none",
|
|
173
172
|
cursor: "pointer",
|
|
174
173
|
}}
|
|
175
174
|
{...attr}
|
|
176
175
|
onClick={triggerClick}
|
|
177
176
|
//enter和leave事件,用于控制图的提示框
|
|
178
177
|
onMouseEnter={() => {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
178
|
+
if(isControlChart){
|
|
179
|
+
setCtlTip((pre:any)=>({
|
|
180
|
+
show:true,
|
|
181
|
+
x:xScaler(x),
|
|
182
|
+
xName:data.x,
|
|
183
|
+
indicatorList:pre.indicatorList.map((item:any)=>{
|
|
184
|
+
if (item.tick === data.x) {
|
|
185
|
+
return { ...item, isShow: true };
|
|
186
|
+
} else {
|
|
187
|
+
return item;
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
}))
|
|
191
|
+
}
|
|
191
192
|
}}
|
|
192
193
|
onMouseLeave={() => {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
194
|
+
if(isControlChart){
|
|
195
|
+
setCtlTip((pre:any)=>({
|
|
196
|
+
show:false,
|
|
197
|
+
x:undefined,
|
|
198
|
+
xName:undefined,
|
|
199
|
+
indicatorList:pre.indicatorList.map((item:any)=>{
|
|
200
|
+
return { ...item, isShow:false }
|
|
201
|
+
})
|
|
202
|
+
}))
|
|
203
|
+
}
|
|
201
204
|
}}
|
|
202
205
|
data-data={JSON.stringify(data)}
|
|
203
206
|
>
|
|
@@ -34,6 +34,7 @@ export default memo(forwardRef((props, ref) => {
|
|
|
34
34
|
background:"rgb(2, 176, 249)",
|
|
35
35
|
WebkitBackgroundClip:"content-box",
|
|
36
36
|
}
|
|
37
|
+
//滑块的鼠标按下操作
|
|
37
38
|
const down=()=>{
|
|
38
39
|
const transform = ref.current.style.transform;
|
|
39
40
|
let movementX = 0;
|
|
@@ -52,6 +53,17 @@ export default memo(forwardRef((props, ref) => {
|
|
|
52
53
|
document.addEventListener("mouseup", mouseUpHandle);
|
|
53
54
|
setWorking(true);
|
|
54
55
|
}
|
|
56
|
+
// //右手柄的鼠标按下逻辑
|
|
57
|
+
// const rightDown=()=>{
|
|
58
|
+
|
|
59
|
+
// const move=(e)=>{
|
|
60
|
+
|
|
61
|
+
// }
|
|
62
|
+
// const up=()=>{
|
|
63
|
+
|
|
64
|
+
// }
|
|
65
|
+
// document.addEventListener()
|
|
66
|
+
// }
|
|
55
67
|
return (
|
|
56
68
|
<div
|
|
57
69
|
style={{
|
|
@@ -87,7 +99,7 @@ export default memo(forwardRef((props, ref) => {
|
|
|
87
99
|
<div ref={ref} style={barStyle}>
|
|
88
100
|
{/* <div style={{...controllerStyle,transform:"translateX(-6px)"}}></div> */}
|
|
89
101
|
<div style={dragStyle} onMouseDown={down} ref={barRef}></div>
|
|
90
|
-
{/* <div style={{...controllerStyle,transform:`translateX(6px)`}}></div> */}
|
|
102
|
+
{/* <div style={{...controllerStyle,transform:`translateX(6px)`}} onMouseDown={rightDown}></div> */}
|
|
91
103
|
</div>
|
|
92
104
|
</div>
|
|
93
105
|
);
|