@easyv/charts 1.9.19 → 1.9.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/Axis.js
CHANGED
|
@@ -264,7 +264,7 @@ var Label = function Label(_ref5) {
|
|
|
264
264
|
// y={y}
|
|
265
265
|
,
|
|
266
266
|
style: {
|
|
267
|
-
overflow: "
|
|
267
|
+
overflow: "hidden"
|
|
268
268
|
}
|
|
269
269
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
270
270
|
className: className,
|
|
@@ -334,14 +334,20 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(
|
|
|
334
334
|
clipAxisRange = _ref6.clipAxisRange,
|
|
335
335
|
controlInfo = _ref6.controlInfo,
|
|
336
336
|
rawTicks = _ref6.rawTicks,
|
|
337
|
-
paddingOuter = _ref6.paddingOuter
|
|
337
|
+
paddingOuter = _ref6.paddingOuter,
|
|
338
|
+
controlEnd = _ref6.controlEnd,
|
|
339
|
+
start = _ref6.start;
|
|
338
340
|
var _useContext = (0, _react.useContext)(_context.chartContext),
|
|
339
341
|
width = _useContext.width,
|
|
340
342
|
height = _useContext.height,
|
|
341
343
|
isIOS = _useContext.isIOS;
|
|
342
344
|
var cHeight = controlInfo.cHeight,
|
|
343
345
|
isC = controlInfo.isC,
|
|
344
|
-
cPercent = controlInfo.cPercent
|
|
346
|
+
cPercent = controlInfo.cPercent,
|
|
347
|
+
cBarX = controlInfo.cBarX,
|
|
348
|
+
cWidth = controlInfo.cWidth,
|
|
349
|
+
cBarWidth = controlInfo.cBarWidth;
|
|
350
|
+
var clipPathIdRef = (0, _react.useRef)("axis-clip-".concat(orientation, "-").concat(axisType, "-").concat(Math.random().toString(36).substr(2, 9)));
|
|
345
351
|
var x = orientation == "right" ? width : 0;
|
|
346
352
|
var y = orientation == "bottom" ? height - cHeight : 0;
|
|
347
353
|
var LabelWidth = 1;
|
|
@@ -444,6 +450,13 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(
|
|
|
444
450
|
}
|
|
445
451
|
}
|
|
446
452
|
function drawLabel() {
|
|
453
|
+
// 在 drawLabel 内部重新计算 translateX,确保使用最新的 controlInfo
|
|
454
|
+
var labelTranslateX = 0;
|
|
455
|
+
if (isC && isIOS && axisType === "x" && controlEnd !== undefined && start !== undefined) {
|
|
456
|
+
var percent = cBarX / (cWidth - cBarWidth);
|
|
457
|
+
var validPercent = isNaN(percent) ? 1 : percent;
|
|
458
|
+
labelTranslateX = -(controlEnd + start / cPercent - width) * validPercent;
|
|
459
|
+
}
|
|
447
460
|
var draw = function draw(ticks, scaler) {
|
|
448
461
|
return ticks.map(function (tick, index) {
|
|
449
462
|
var coordinate = scaler(tick);
|
|
@@ -464,7 +477,7 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(
|
|
|
464
477
|
coordinate: coordinate,
|
|
465
478
|
iosTrans: {
|
|
466
479
|
isIOS: isIOS,
|
|
467
|
-
x: marginLeft + x,
|
|
480
|
+
x: marginLeft + x + (isIOS && isC && axisType === "x" ? labelTranslateX : 0),
|
|
468
481
|
y: marginTop + y
|
|
469
482
|
},
|
|
470
483
|
config: label,
|
|
@@ -537,10 +550,20 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(
|
|
|
537
550
|
}), tickLine && drawAxisTickLine()))), /*#__PURE__*/_react["default"].createElement("svg", {
|
|
538
551
|
width: width,
|
|
539
552
|
style: {
|
|
540
|
-
overflow:
|
|
553
|
+
overflow: "hidden"
|
|
541
554
|
}
|
|
542
|
-
}, /*#__PURE__*/_react["default"].createElement("
|
|
543
|
-
|
|
555
|
+
}, axisType === "x" && isC || isIOS && axisType === "x" ? /*#__PURE__*/_react["default"].createElement("defs", null, /*#__PURE__*/_react["default"].createElement("clipPath", {
|
|
556
|
+
id: clipPathIdRef.current,
|
|
557
|
+
clipPathUnits: "userSpaceOnUse"
|
|
558
|
+
}, /*#__PURE__*/_react["default"].createElement("rect", {
|
|
559
|
+
x: "0",
|
|
560
|
+
y: "0",
|
|
561
|
+
width: xLineRange,
|
|
562
|
+
height: height + 200,
|
|
563
|
+
fill: "transparent"
|
|
564
|
+
}))) : null, /*#__PURE__*/_react["default"].createElement("g", {
|
|
565
|
+
transform: "translate(" + x + ", " + y + ")",
|
|
566
|
+
clipPath: axisType === "x" && isC || isIOS && axisType === "x" ? "url(#".concat(clipPathIdRef.current, ")") : undefined
|
|
544
567
|
}, /*#__PURE__*/_react["default"].createElement("g", {
|
|
545
568
|
ref: ref
|
|
546
569
|
}, label && gridLine && drawLabel(), isC && /*#__PURE__*/_react["default"].createElement(AxisLine, {
|
|
@@ -127,6 +127,10 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
127
127
|
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
128
128
|
controlInfo = _useState6[0],
|
|
129
129
|
setControlInfo = _useState6[1];
|
|
130
|
+
var _useState7 = (0, _react.useState)(0),
|
|
131
|
+
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
|
132
|
+
clipX = _useState8[0],
|
|
133
|
+
setClipX = _useState8[1];
|
|
130
134
|
var cWidth = controlInfo.cWidth,
|
|
131
135
|
cHeight = controlInfo.cHeight,
|
|
132
136
|
cBarWidth = controlInfo.cBarWidth,
|
|
@@ -166,10 +170,10 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
166
170
|
})
|
|
167
171
|
};
|
|
168
172
|
};
|
|
169
|
-
var
|
|
170
|
-
|
|
171
|
-
ctlTip =
|
|
172
|
-
setCtlTip =
|
|
173
|
+
var _useState9 = (0, _react.useState)(initCtlTip),
|
|
174
|
+
_useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
|
|
175
|
+
ctlTip = _useState10[0],
|
|
176
|
+
setCtlTip = _useState10[1]; //控制图的提示框
|
|
173
177
|
|
|
174
178
|
(0, _react.useEffect)(function () {
|
|
175
179
|
var handleAction = function handleAction(e) {
|
|
@@ -352,7 +356,10 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
352
356
|
percent = isNaN(percent) ? 1 : percent;
|
|
353
357
|
var translateX = -(controlEnd + start / cPercent - chartWidth) * percent;
|
|
354
358
|
curControlPercent.current = percent;
|
|
355
|
-
|
|
359
|
+
setClipX(-translateX);
|
|
360
|
+
var _isVertical = axisX.direction === "vertical";
|
|
361
|
+
var coreOffset = _isVertical ? marginRight : isIOS ? marginLeft : 0;
|
|
362
|
+
seriesEl.current.style.transform = "translate(".concat(translateX + coreOffset, "px,").concat(marginTop, "px)");
|
|
356
363
|
axisElList.current[2].style.transform = "translate(".concat(translateX, "px,", 0, "px)");
|
|
357
364
|
}
|
|
358
365
|
}, [controlInfo]);
|
|
@@ -589,9 +596,20 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
589
596
|
ref: seriesEl,
|
|
590
597
|
style: {
|
|
591
598
|
overflow: "visible",
|
|
599
|
+
// 保留原有样式,clipPath会接管裁剪
|
|
592
600
|
position: "absolute",
|
|
593
601
|
transform: isVertical ? "translate(".concat(marginRight, "px,").concat(isIOS ? marginTop : 0, "px)") : "translate(".concat(isIOS ? marginLeft : 0, "px,").concat(marginTop, "px)")
|
|
594
602
|
}
|
|
603
|
+
}, /*#__PURE__*/_react["default"].createElement("defs", null, /*#__PURE__*/_react["default"].createElement("clipPath", {
|
|
604
|
+
id: "chart-clip-".concat(id)
|
|
605
|
+
}, /*#__PURE__*/_react["default"].createElement("rect", {
|
|
606
|
+
x: clipX,
|
|
607
|
+
y: "0",
|
|
608
|
+
width: xLineRange,
|
|
609
|
+
height: yLineRange,
|
|
610
|
+
fill: "transparent"
|
|
611
|
+
}))), /*#__PURE__*/_react["default"].createElement("g", {
|
|
612
|
+
clipPath: "url(#chart-clip-".concat(id, ")")
|
|
595
613
|
}, /*#__PURE__*/_react["default"].createElement("g", null, control && zIndex == "bottom" && ctlIndicatorList.map(function (item, index) {
|
|
596
614
|
var x = axisX.scaler(item.tick);
|
|
597
615
|
return /*#__PURE__*/_react["default"].createElement(_.Indicator, (0, _extends2["default"])({
|
|
@@ -662,7 +680,7 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
662
680
|
ctlIndicatorList: ctlIndicatorList,
|
|
663
681
|
manual: manual
|
|
664
682
|
}));
|
|
665
|
-
}))), showCtl && !!control && /*#__PURE__*/_react["default"].createElement(_.Tooltip, (0, _extends2["default"])({
|
|
683
|
+
})))), showCtl && !!control && /*#__PURE__*/_react["default"].createElement(_.Tooltip, (0, _extends2["default"])({
|
|
666
684
|
isVertical: isVertical
|
|
667
685
|
}, tooltip, {
|
|
668
686
|
data: controlChartTooltipData,
|
package/package.json
CHANGED
package/src/components/Axis.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import React, {
|
|
|
9
9
|
CSSProperties,
|
|
10
10
|
MouseEventHandler,
|
|
11
11
|
forwardRef,
|
|
12
|
+
useRef,
|
|
12
13
|
} from "react";
|
|
13
14
|
import { getTickCoord, getGridCoord, getFontStyle } from "../utils";
|
|
14
15
|
import { chartContext } from "../context";
|
|
@@ -307,7 +308,7 @@ const Label: (
|
|
|
307
308
|
height="100%"
|
|
308
309
|
// x={x}
|
|
309
310
|
// y={y}
|
|
310
|
-
style={{ overflow: "
|
|
311
|
+
style={{ overflow: "hidden" }}
|
|
311
312
|
>
|
|
312
313
|
<div
|
|
313
314
|
className={className}
|
|
@@ -388,13 +389,22 @@ export default memo(
|
|
|
388
389
|
controlInfo,
|
|
389
390
|
rawTicks,
|
|
390
391
|
paddingOuter,
|
|
392
|
+
// 从展开的 config 中获取控制图相关属性
|
|
393
|
+
controlEnd,
|
|
394
|
+
start,
|
|
391
395
|
}: any,
|
|
392
396
|
ref
|
|
393
397
|
) => {
|
|
394
398
|
const { width, height, isIOS } = useContext(chartContext);
|
|
395
|
-
const { cHeight, isC, cPercent } = controlInfo;
|
|
399
|
+
const { cHeight, isC, cPercent, cBarX, cWidth, cBarWidth } = controlInfo;
|
|
400
|
+
const clipPathIdRef = useRef(
|
|
401
|
+
`axis-clip-${orientation}-${axisType}-${Math.random()
|
|
402
|
+
.toString(36)
|
|
403
|
+
.substr(2, 9)}`
|
|
404
|
+
);
|
|
396
405
|
const x = orientation == "right" ? width : 0;
|
|
397
406
|
const y = orientation == "bottom" ? height - cHeight : 0;
|
|
407
|
+
|
|
398
408
|
let LabelWidth = 1;
|
|
399
409
|
if (label.labelNum == "Fixed") {
|
|
400
410
|
LabelWidth = label.appearance.width;
|
|
@@ -543,6 +553,21 @@ export default memo(
|
|
|
543
553
|
}
|
|
544
554
|
}
|
|
545
555
|
function drawLabel() {
|
|
556
|
+
// 在 drawLabel 内部重新计算 translateX,确保使用最新的 controlInfo
|
|
557
|
+
let labelTranslateX = 0;
|
|
558
|
+
if (
|
|
559
|
+
isC &&
|
|
560
|
+
isIOS &&
|
|
561
|
+
axisType === "x" &&
|
|
562
|
+
controlEnd !== undefined &&
|
|
563
|
+
start !== undefined
|
|
564
|
+
) {
|
|
565
|
+
const percent = cBarX / (cWidth - cBarWidth);
|
|
566
|
+
const validPercent = isNaN(percent) ? 1 : percent;
|
|
567
|
+
labelTranslateX =
|
|
568
|
+
-(controlEnd + start / cPercent - width) * validPercent;
|
|
569
|
+
}
|
|
570
|
+
|
|
546
571
|
const draw = (ticks: any, scaler: any) => {
|
|
547
572
|
return ticks.map((tick: string, index: number) => {
|
|
548
573
|
const coordinate = scaler(tick);
|
|
@@ -571,7 +596,16 @@ export default memo(
|
|
|
571
596
|
className="__easyv-label"
|
|
572
597
|
orientation={orientation}
|
|
573
598
|
coordinate={coordinate}
|
|
574
|
-
iosTrans={{
|
|
599
|
+
iosTrans={{
|
|
600
|
+
isIOS,
|
|
601
|
+
x:
|
|
602
|
+
marginLeft +
|
|
603
|
+
x +
|
|
604
|
+
(isIOS && isC && axisType === "x"
|
|
605
|
+
? labelTranslateX
|
|
606
|
+
: 0),
|
|
607
|
+
y: marginTop + y,
|
|
608
|
+
}}
|
|
575
609
|
config={label}
|
|
576
610
|
label={tick}
|
|
577
611
|
tickSize={_tickSize}
|
|
@@ -680,10 +714,34 @@ export default memo(
|
|
|
680
714
|
<svg
|
|
681
715
|
width={width}
|
|
682
716
|
style={{
|
|
683
|
-
overflow:
|
|
717
|
+
overflow: "hidden",
|
|
684
718
|
}}
|
|
685
719
|
>
|
|
686
|
-
|
|
720
|
+
{/* 定义裁剪路径:用于iOS端超出隐藏 */}
|
|
721
|
+
{(axisType === "x" && isC) || (isIOS && axisType === "x") ? (
|
|
722
|
+
<defs>
|
|
723
|
+
<clipPath
|
|
724
|
+
id={clipPathIdRef.current}
|
|
725
|
+
clipPathUnits="userSpaceOnUse"
|
|
726
|
+
>
|
|
727
|
+
<rect
|
|
728
|
+
x="0"
|
|
729
|
+
y="0"
|
|
730
|
+
width={xLineRange}
|
|
731
|
+
height={height + 200}
|
|
732
|
+
fill="transparent"
|
|
733
|
+
/>
|
|
734
|
+
</clipPath>
|
|
735
|
+
</defs>
|
|
736
|
+
) : null}
|
|
737
|
+
<g
|
|
738
|
+
transform={"translate(" + x + ", " + y + ")"}
|
|
739
|
+
clipPath={
|
|
740
|
+
(axisType === "x" && isC) || (isIOS && axisType === "x")
|
|
741
|
+
? `url(#${clipPathIdRef.current})`
|
|
742
|
+
: undefined
|
|
743
|
+
}
|
|
744
|
+
>
|
|
687
745
|
{/* 用于控制图 */}
|
|
688
746
|
<g ref={ref as any}>
|
|
689
747
|
{label && gridLine && drawLabel()}
|
|
@@ -115,6 +115,7 @@ const Chart = memo(
|
|
|
115
115
|
cPercent: dragPercent,
|
|
116
116
|
cBarX: controlX,
|
|
117
117
|
});
|
|
118
|
+
const [clipX, setClipX] = useState(0);
|
|
118
119
|
const { cWidth, cHeight, cBarWidth, cPercent, cBarX } = controlInfo;
|
|
119
120
|
|
|
120
121
|
yLineRange -= cHeight;
|
|
@@ -344,7 +345,12 @@ const Chart = memo(
|
|
|
344
345
|
const translateX =
|
|
345
346
|
-(controlEnd + start / cPercent - chartWidth) * percent;
|
|
346
347
|
curControlPercent.current = percent;
|
|
347
|
-
|
|
348
|
+
setClipX(-translateX);
|
|
349
|
+
const isVertical = axisX.direction === "vertical";
|
|
350
|
+
const coreOffset = isVertical ? marginRight : isIOS ? marginLeft : 0;
|
|
351
|
+
seriesEl.current.style.transform = `translate(${
|
|
352
|
+
translateX + coreOffset
|
|
353
|
+
}px,${marginTop}px)`;
|
|
348
354
|
axisElList.current[2].style.transform = `translate(${translateX}px,${0}px)`;
|
|
349
355
|
}
|
|
350
356
|
}, [controlInfo]);
|
|
@@ -588,107 +594,124 @@ const Chart = memo(
|
|
|
588
594
|
height="100%"
|
|
589
595
|
ref={seriesEl}
|
|
590
596
|
style={{
|
|
591
|
-
overflow: "visible",
|
|
597
|
+
overflow: "visible", // 保留原有样式,clipPath会接管裁剪
|
|
592
598
|
position: "absolute",
|
|
593
599
|
transform: isVertical
|
|
594
600
|
? `translate(${marginRight}px,${isIOS ? marginTop : 0}px)`
|
|
595
601
|
: `translate(${isIOS ? marginLeft : 0}px,${marginTop}px)`,
|
|
596
602
|
}}
|
|
597
603
|
>
|
|
598
|
-
{/*
|
|
599
|
-
<
|
|
600
|
-
{
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
604
|
+
{/* 定义裁剪路径:只显示指定宽高的区域 */}
|
|
605
|
+
<defs>
|
|
606
|
+
<clipPath id={`chart-clip-${id}`}>
|
|
607
|
+
<rect
|
|
608
|
+
x={clipX}
|
|
609
|
+
y="0"
|
|
610
|
+
width={xLineRange}
|
|
611
|
+
height={yLineRange}
|
|
612
|
+
fill="transparent"
|
|
613
|
+
/>
|
|
614
|
+
</clipPath>
|
|
615
|
+
</defs>
|
|
616
|
+
|
|
617
|
+
{/* 关键修改2:将所有图表内容包裹在g标签中,并应用clipPath */}
|
|
618
|
+
{/* <g> */}
|
|
619
|
+
<g clipPath={`url(#chart-clip-${id})`}>
|
|
620
|
+
{/* 控制图指示器部分 */}
|
|
621
|
+
<g>
|
|
622
|
+
{control &&
|
|
623
|
+
zIndex == "bottom" &&
|
|
624
|
+
ctlIndicatorList.map((item, index) => {
|
|
625
|
+
const x = axisX.scaler(item.tick);
|
|
626
|
+
return (
|
|
627
|
+
<Indicator
|
|
628
|
+
key={index}
|
|
629
|
+
{...indicator}
|
|
630
|
+
{...{
|
|
631
|
+
height: yLineRange,
|
|
632
|
+
width: indicatorWidth,
|
|
633
|
+
x: x - indicatorWidth / 2,
|
|
634
|
+
}}
|
|
635
|
+
isControlChart={!!control}
|
|
636
|
+
xName={item.tick}
|
|
637
|
+
setCtlTip={setCtlTip}
|
|
638
|
+
ctlIndicatorList={ctlIndicatorList}
|
|
639
|
+
manual={true}
|
|
640
|
+
/>
|
|
641
|
+
);
|
|
642
|
+
})}
|
|
643
|
+
</g>
|
|
644
|
+
{/**绘制图表主体 */}
|
|
645
|
+
{series.map(({ Component, yOrZ, ...config }, index) => {
|
|
646
|
+
const yAxis = axes.get(yOrZ);
|
|
647
|
+
const isXRepeat = hasDuplicateX(series); //x项有重复项判断
|
|
648
|
+
return (
|
|
649
|
+
yAxis &&
|
|
650
|
+
Component && (
|
|
651
|
+
<Component
|
|
606
652
|
key={index}
|
|
607
|
-
{...
|
|
608
|
-
{
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
}
|
|
653
|
+
{...config}
|
|
654
|
+
bandLength={bandLength}
|
|
655
|
+
curXLabel={curXLabel}
|
|
656
|
+
selectStyle={selectStyle}
|
|
657
|
+
xAxis={axisX}
|
|
658
|
+
yAxis={yAxis}
|
|
659
|
+
auto={auto}
|
|
660
|
+
// 控制图部分,主要是为了,当鼠标悬浮在指示器上时,显示对应的tooltip
|
|
613
661
|
isControlChart={!!control}
|
|
614
|
-
|
|
662
|
+
indicatorWidth={indicatorWidth}
|
|
663
|
+
triggerEvents={onInteraction}
|
|
615
664
|
setCtlTip={setCtlTip}
|
|
616
|
-
|
|
617
|
-
|
|
665
|
+
isXRepeat={isXRepeat}
|
|
666
|
+
maxWidth={bar ? bar.maxWidth : 0}
|
|
618
667
|
/>
|
|
619
|
-
)
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
key={index}
|
|
631
|
-
{...config}
|
|
632
|
-
bandLength={bandLength}
|
|
633
|
-
curXLabel={curXLabel}
|
|
634
|
-
selectStyle={selectStyle}
|
|
635
|
-
xAxis={axisX}
|
|
636
|
-
yAxis={yAxis}
|
|
637
|
-
auto={auto}
|
|
638
|
-
// 控制图部分,主要是为了,当鼠标悬浮在指示器上时,显示对应的tooltip
|
|
639
|
-
isControlChart={!!control}
|
|
640
|
-
indicatorWidth={indicatorWidth}
|
|
641
|
-
triggerEvents={onInteraction}
|
|
642
|
-
setCtlTip={setCtlTip}
|
|
643
|
-
isXRepeat={isXRepeat}
|
|
644
|
-
maxWidth={bar ? bar.maxWidth : 0}
|
|
645
|
-
/>
|
|
646
|
-
)
|
|
647
|
-
);
|
|
648
|
-
})}
|
|
649
|
-
{/* 图表数值标签 */}
|
|
650
|
-
{series.map(({ Component, yOrZ, ...config }, index) => {
|
|
651
|
-
const yAxis = axes.get(yOrZ);
|
|
652
|
-
const isXRepeat = hasDuplicateX(series); //x项有重复项判断
|
|
653
|
-
return (
|
|
654
|
-
yAxis && (
|
|
655
|
-
<Label
|
|
656
|
-
isXRepeat={isXRepeat}
|
|
657
|
-
key={index}
|
|
658
|
-
{...config}
|
|
659
|
-
curXLabel={curXLabel}
|
|
660
|
-
selectStyle={selectStyle}
|
|
661
|
-
bandLength={bandLength}
|
|
662
|
-
xAxis={axisX}
|
|
663
|
-
yAxis={yAxis}
|
|
664
|
-
triggerEvents={onInteraction}
|
|
665
|
-
isControlChart={!!control}
|
|
666
|
-
/>
|
|
667
|
-
)
|
|
668
|
-
);
|
|
669
|
-
})}
|
|
670
|
-
<g>
|
|
671
|
-
{control &&
|
|
672
|
-
zIndex != "bottom" &&
|
|
673
|
-
ctlIndicatorList.map((item, index) => {
|
|
674
|
-
const x = axisX.scaler(item.tick);
|
|
675
|
-
return (
|
|
676
|
-
<Indicator
|
|
668
|
+
)
|
|
669
|
+
);
|
|
670
|
+
})}
|
|
671
|
+
{/* 图表数值标签 */}
|
|
672
|
+
{series.map(({ Component, yOrZ, ...config }, index) => {
|
|
673
|
+
const yAxis = axes.get(yOrZ);
|
|
674
|
+
const isXRepeat = hasDuplicateX(series); //x项有重复项判断
|
|
675
|
+
return (
|
|
676
|
+
yAxis && (
|
|
677
|
+
<Label
|
|
678
|
+
isXRepeat={isXRepeat}
|
|
677
679
|
key={index}
|
|
678
|
-
{...
|
|
679
|
-
{
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
}
|
|
680
|
+
{...config}
|
|
681
|
+
curXLabel={curXLabel}
|
|
682
|
+
selectStyle={selectStyle}
|
|
683
|
+
bandLength={bandLength}
|
|
684
|
+
xAxis={axisX}
|
|
685
|
+
yAxis={yAxis}
|
|
686
|
+
triggerEvents={onInteraction}
|
|
684
687
|
isControlChart={!!control}
|
|
685
|
-
xName={item.tick}
|
|
686
|
-
setCtlTip={setCtlTip}
|
|
687
|
-
ctlIndicatorList={ctlIndicatorList}
|
|
688
|
-
manual={manual}
|
|
689
688
|
/>
|
|
690
|
-
)
|
|
691
|
-
|
|
689
|
+
)
|
|
690
|
+
);
|
|
691
|
+
})}
|
|
692
|
+
<g>
|
|
693
|
+
{control &&
|
|
694
|
+
zIndex != "bottom" &&
|
|
695
|
+
ctlIndicatorList.map((item, index) => {
|
|
696
|
+
const x = axisX.scaler(item.tick);
|
|
697
|
+
return (
|
|
698
|
+
<Indicator
|
|
699
|
+
key={index}
|
|
700
|
+
{...indicator}
|
|
701
|
+
{...{
|
|
702
|
+
height: yLineRange,
|
|
703
|
+
width: indicatorWidth,
|
|
704
|
+
x: x - indicatorWidth / 2,
|
|
705
|
+
}}
|
|
706
|
+
isControlChart={!!control}
|
|
707
|
+
xName={item.tick}
|
|
708
|
+
setCtlTip={setCtlTip}
|
|
709
|
+
ctlIndicatorList={ctlIndicatorList}
|
|
710
|
+
manual={manual}
|
|
711
|
+
/>
|
|
712
|
+
);
|
|
713
|
+
})}
|
|
714
|
+
</g>
|
|
692
715
|
</g>
|
|
693
716
|
</svg>
|
|
694
717
|
{/* 控制图下的提示框 */}
|