@easyv/charts 1.4.34 → 1.4.36
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 +7 -7
- package/lib/components/Band.js +28 -26
- package/lib/components/CartesianChart.js +208 -175
- package/lib/components/Control.js +78 -30
- package/lib/components/Indicator.js +30 -34
- package/lib/components/Label.js +1 -41
- package/lib/hooks/useAxes.js +43 -12
- package/lib/hooks/useCarouselAxisX.js +15 -16
- package/lib/hooks/useFilterData.js +21 -1
- package/package.json +1 -1
- package/src/components/Axis.tsx +6 -7
- package/src/components/Band.tsx +27 -34
- package/src/components/CartesianChart.js +186 -196
- package/src/components/Control.jsx +87 -43
- package/src/components/Indicator.js +17 -20
- package/src/components/Label.js +1 -34
- package/src/components/Tooltip.js +0 -1
- package/src/hooks/useAxes.js +34 -16
- package/src/hooks/useCarouselAxisX.js +14 -18
- package/src/hooks/useFilterData.js +7 -1
package/lib/components/Axis.js
CHANGED
|
@@ -271,9 +271,7 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
271
271
|
isClipAxis = _ref6$isClipAxis === void 0 ? false : _ref6$isClipAxis,
|
|
272
272
|
yLineRange = _ref6.yLineRange,
|
|
273
273
|
clipAxisRange = _ref6.clipAxisRange,
|
|
274
|
-
|
|
275
|
-
controlConfig = _ref6.controlConfig,
|
|
276
|
-
controlEnd = _ref6.controlEnd,
|
|
274
|
+
controlInfo = _ref6.controlInfo,
|
|
277
275
|
rawTicks = _ref6.rawTicks;
|
|
278
276
|
if (!(on && ticks.length > 0)) return null;
|
|
279
277
|
|
|
@@ -281,8 +279,10 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
281
279
|
width = _useContext.width,
|
|
282
280
|
height = _useContext.height;
|
|
283
281
|
|
|
282
|
+
var cHeight = controlInfo.cHeight,
|
|
283
|
+
isC = controlInfo.isC;
|
|
284
284
|
var x = orientation == "right" ? width : 0;
|
|
285
|
-
var y = orientation == "bottom" ? height : 0;
|
|
285
|
+
var y = orientation == "bottom" ? height - cHeight : 0;
|
|
286
286
|
|
|
287
287
|
function drawAxisTickLine() {
|
|
288
288
|
var draw = function draw(ticks, scaler) {
|
|
@@ -335,7 +335,7 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
335
335
|
});
|
|
336
336
|
var x1 = gridCoord.x1;
|
|
337
337
|
var y1 = gridCoord.y1;
|
|
338
|
-
return (!(orientation == "bottom" && (x1 < 0 || x1 > xLineRange) || y1 < 0 || y1 > yLineRange) ||
|
|
338
|
+
return (!(orientation == "bottom" && (x1 < 0 || x1 > xLineRange) || y1 < 0 || y1 > yLineRange) || isC) && /*#__PURE__*/_react["default"].createElement("g", {
|
|
339
339
|
key: index
|
|
340
340
|
}, label && /*#__PURE__*/_react["default"].createElement(Label, {
|
|
341
341
|
className: "__easyv-label",
|
|
@@ -358,7 +358,7 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
358
358
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, ticks.map(function (ticks, index) {
|
|
359
359
|
return draw(ticks, scaler[index]);
|
|
360
360
|
}));
|
|
361
|
-
} else if (
|
|
361
|
+
} else if (isC && orientation == "bottom") {
|
|
362
362
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, draw(rawTicks, scaler));
|
|
363
363
|
} else {
|
|
364
364
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, draw(ticks, scaler));
|
|
@@ -408,7 +408,7 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
408
408
|
}), tickLine && drawAxisTickLine()))), /*#__PURE__*/_react["default"].createElement("svg", {
|
|
409
409
|
width: width,
|
|
410
410
|
style: {
|
|
411
|
-
overflow: axisType === "x" &&
|
|
411
|
+
overflow: axisType === "x" && isC ? "hidden" : "visible"
|
|
412
412
|
}
|
|
413
413
|
}, /*#__PURE__*/_react["default"].createElement("g", {
|
|
414
414
|
transform: "translate(" + x + ", " + y + ")"
|
package/lib/components/Band.js
CHANGED
|
@@ -86,12 +86,9 @@ var getBorderRadius = function getBorderRadius(_ref2) {
|
|
|
86
86
|
var _default = /*#__PURE__*/(0, _react.memo)(function (_ref3) {
|
|
87
87
|
var triggerClick = _ref3.triggerClick,
|
|
88
88
|
indicatorWidth = _ref3.indicatorWidth,
|
|
89
|
-
setControlChartTooltipShow = _ref3.setControlChartTooltipShow,
|
|
90
|
-
setControlChartTooltipX = _ref3.setControlChartTooltipX,
|
|
91
|
-
setControlChartTooltipXName = _ref3.setControlChartTooltipXName,
|
|
92
89
|
_ref3$isControlChart = _ref3.isControlChart,
|
|
93
90
|
isControlChart = _ref3$isControlChart === void 0 ? false : _ref3$isControlChart,
|
|
94
|
-
|
|
91
|
+
setCtlTip = _ref3.setCtlTip,
|
|
95
92
|
_ref3$config = _ref3.config,
|
|
96
93
|
_ref3$config$pattern = _ref3$config.pattern,
|
|
97
94
|
pattern = _ref3$config$pattern === void 0 ? {} : _ref3$config$pattern,
|
|
@@ -115,15 +112,18 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref3) {
|
|
|
115
112
|
bandLength = _ref3$bandLength === void 0 ? 0 : _ref3$bandLength,
|
|
116
113
|
data = _ref3.data,
|
|
117
114
|
_ref3$xAxis = _ref3.xAxis,
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
normalScaler = _ref3$xAxis.scaler,
|
|
116
|
+
normalStep = _ref3$xAxis.step,
|
|
117
|
+
controlStep = _ref3$xAxis.controlStep,
|
|
120
118
|
direction = _ref3$xAxis.direction,
|
|
121
|
-
|
|
119
|
+
controlDragScaler = _ref3$xAxis.controlDragScaler,
|
|
122
120
|
_ref3$yAxis = _ref3.yAxis,
|
|
123
121
|
yScaler = _ref3$yAxis.scaler,
|
|
124
122
|
isClipAxis = _ref3$yAxis.isClipAxis,
|
|
125
123
|
clipValue = _ref3$yAxis.clipValue;
|
|
126
124
|
if (!data.length) return null;
|
|
125
|
+
var step = isControlChart ? controlStep : normalStep;
|
|
126
|
+
var xScaler = isControlChart ? controlDragScaler : normalScaler;
|
|
127
127
|
|
|
128
128
|
var _getSeriesInfo = (0, _utils.getSeriesInfo)({
|
|
129
129
|
step: step,
|
|
@@ -205,15 +205,19 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref3) {
|
|
|
205
205
|
style: {
|
|
206
206
|
overflow: "visible",
|
|
207
207
|
position: "relative",
|
|
208
|
+
pointerEvents: isControlChart ? "auto" : "none",
|
|
208
209
|
cursor: "pointer"
|
|
209
210
|
}
|
|
210
211
|
}, attr, {
|
|
211
212
|
onClick: triggerClick //enter和leave事件,用于控制图的提示框
|
|
212
213
|
,
|
|
213
214
|
onMouseEnter: function onMouseEnter() {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
setCtlTip(function (pre) {
|
|
216
|
+
return {
|
|
217
|
+
show: true,
|
|
218
|
+
x: xScaler(x),
|
|
219
|
+
xName: data.x,
|
|
220
|
+
indicatorList: pre.indicatorList.map(function (item) {
|
|
217
221
|
if (item.tick === data.x) {
|
|
218
222
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
219
223
|
isShow: true
|
|
@@ -221,32 +225,30 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref3) {
|
|
|
221
225
|
} else {
|
|
222
226
|
return item;
|
|
223
227
|
}
|
|
224
|
-
})
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
setControlChartTooltipX(xScaler(x) - indicatorWidth / 2);
|
|
228
|
-
setControlChartTooltipXName(data.x);
|
|
229
|
-
}
|
|
228
|
+
})
|
|
229
|
+
};
|
|
230
|
+
});
|
|
230
231
|
},
|
|
231
232
|
onMouseLeave: function onMouseLeave() {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
233
|
+
setCtlTip(function (pre) {
|
|
234
|
+
return {
|
|
235
|
+
show: false,
|
|
236
|
+
x: undefined,
|
|
237
|
+
xName: undefined,
|
|
238
|
+
indicatorList: pre.indicatorList.map(function (item) {
|
|
235
239
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
236
240
|
isShow: false
|
|
237
241
|
});
|
|
238
|
-
})
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
setControlChartTooltipXName(undefined);
|
|
242
|
-
setControlChartTooltipX(undefined);
|
|
243
|
-
}
|
|
242
|
+
})
|
|
243
|
+
};
|
|
244
|
+
});
|
|
244
245
|
},
|
|
245
246
|
"data-data": JSON.stringify(data)
|
|
246
247
|
}), headUrl && showHead && /*#__PURE__*/_react["default"].createElement("div", {
|
|
247
248
|
style: {
|
|
248
249
|
position: "absolute",
|
|
249
|
-
background: "url(".concat(
|
|
250
|
+
background: "url(".concat( //@ts-ignore
|
|
251
|
+
window.appConfig.ASSETS_URL + headUrl, ") 0 0/100% 100%"),
|
|
250
252
|
width: headWidth,
|
|
251
253
|
height: headHeight,
|
|
252
254
|
left: isVertical ? "100%" : "50%",
|