@easyv/charts 1.5.0 → 1.5.2
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.
|
@@ -269,13 +269,16 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
269
269
|
(0, _react.useLayoutEffect)(function () {
|
|
270
270
|
var controlEnd = axisX.controlEnd,
|
|
271
271
|
start = axisX.start;
|
|
272
|
-
controlEl.current.style.transform = "translate(".concat(cBarX, "px,0)"); //计算出当前位移的百分比
|
|
273
272
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
273
|
+
if (controlEl.current) {
|
|
274
|
+
controlEl.current.style.transform = "translate(".concat(cBarX, "px,0)"); //计算出当前位移的百分比
|
|
275
|
+
|
|
276
|
+
var percent = cBarX / (cWidth - cBarWidth);
|
|
277
|
+
var translateX = -(controlEnd + start / cPercent - chartWidth) * percent;
|
|
278
|
+
curControlPercent.current = percent;
|
|
279
|
+
seriesEl.current.style.transform = "translate(".concat(translateX, "px,").concat(marginTop, "px)");
|
|
280
|
+
axisElList.current[2].style.transform = "translate(".concat(translateX, "px,", 0, "px)");
|
|
281
|
+
}
|
|
279
282
|
}, [controlInfo]); //控制条轮播动画
|
|
280
283
|
|
|
281
284
|
(0, _react.useEffect)(function () {
|
|
@@ -376,7 +379,7 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
376
379
|
cancelAnimationFrame(controlTimer.current);
|
|
377
380
|
};
|
|
378
381
|
}
|
|
379
|
-
}, [JSON.stringify(animation), control,
|
|
382
|
+
}, [JSON.stringify(animation), control, cWidth, cHeight, cBarWidth, cPercent]); //初始化控制图提示框状态的函数
|
|
380
383
|
|
|
381
384
|
var initCtlTip = function initCtlTip() {
|
|
382
385
|
return {
|
package/package.json
CHANGED
|
@@ -232,14 +232,16 @@ const Chart = memo(
|
|
|
232
232
|
//cBarX变化后,修改图表的偏移值
|
|
233
233
|
useLayoutEffect(()=>{
|
|
234
234
|
const { controlEnd, start } = axisX;
|
|
235
|
-
controlEl.current
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
235
|
+
if(controlEl.current){
|
|
236
|
+
controlEl.current.style.transform = `translate(${cBarX}px,0)`;
|
|
237
|
+
//计算出当前位移的百分比
|
|
238
|
+
const percent = cBarX / (cWidth - cBarWidth);
|
|
239
|
+
const translateX = -(controlEnd + start/cPercent - chartWidth) * percent;
|
|
240
|
+
curControlPercent.current = percent;
|
|
241
|
+
seriesEl.current.style.transform = `translate(${translateX}px,${marginTop}px)`;
|
|
242
|
+
axisElList.current[2].style.transform = `translate(${translateX}px,${0}px)`;
|
|
243
|
+
}
|
|
244
|
+
},[controlInfo]);
|
|
243
245
|
//控制条轮播动画
|
|
244
246
|
useEffect(() => {
|
|
245
247
|
if (controlEl.current && control) {
|
|
@@ -317,7 +319,7 @@ const Chart = memo(
|
|
|
317
319
|
cancelAnimationFrame(controlTimer.current);
|
|
318
320
|
};
|
|
319
321
|
}
|
|
320
|
-
}, [JSON.stringify(animation), control,
|
|
322
|
+
}, [JSON.stringify(animation), control, cWidth, cHeight, cBarWidth, cPercent]);
|
|
321
323
|
//初始化控制图提示框状态的函数
|
|
322
324
|
const initCtlTip = ()=>{
|
|
323
325
|
return {
|