@easyv/charts 1.10.11 → 1.10.13

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.
@@ -281,6 +281,7 @@ var Label = function Label(_ref5) {
281
281
  position: "relative",
282
282
  // 替换 absolute
283
283
  cursor: "pointer",
284
+ display: !adaptive ? "inline-block" : "block",
284
285
  transform: "translate(".concat(x + (isIOS ? iosX : 0), "px, ").concat(y + (isIOS ? iosY : 0), "px)") // 用 transform 定位
285
286
  })
286
287
  }, !adaptive ? /*#__PURE__*/_react["default"].createElement(_TextOverflow["default"], {
@@ -43,7 +43,7 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(
43
43
  onMouseMove: onMouseMove,
44
44
  ref: ref,
45
45
  style: _objectSpread({
46
- overflow: "hidden",
46
+ overflow: "visible",
47
47
  position: "absolute",
48
48
  width: width,
49
49
  height: height
@@ -605,10 +605,21 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
605
605
  },
606
606
  arcs: _arcs,
607
607
  judge: judgeData
608
- }))), tooltip && mousePos && mousePos.x != 0 && mousePos.y != 0 && tooltip.manual && /*#__PURE__*/_react["default"].createElement("div", {
608
+ }))), /*#__PURE__*/_react["default"].createElement(_.Legend, (0, _extends2["default"])({}, legend, {
609
+ height: chartHeight,
610
+ columnsSeries: columnsSeries,
611
+ data: data,
612
+ series: _arcs.map(function (arc) {
613
+ return _objectSpread(_objectSpread({}, arc), {}, {
614
+ percent: arc.percent.toFixed(legendPrecision)
615
+ });
616
+ }),
617
+ pieClick: onClick,
618
+ formatter: formatter,
619
+ judge: judgeData
620
+ })), tooltip && mousePos && mousePos.x != 0 && mousePos.y != 0 && tooltip.manual && /*#__PURE__*/_react["default"].createElement("div", {
609
621
  style: {
610
622
  position: "absolute",
611
- zIndex: 9999,
612
623
  pointerEvents: "none"
613
624
  }
614
625
  }, /*#__PURE__*/_react["default"].createElement(_PieTooltip.PieTooltip, {
@@ -621,18 +632,6 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
621
632
  y: maxRadius + marginTop
622
633
  },
623
634
  mousePos: mousePos
624
- })), /*#__PURE__*/_react["default"].createElement(_.Legend, (0, _extends2["default"])({}, legend, {
625
- height: chartHeight,
626
- columnsSeries: columnsSeries,
627
- data: data,
628
- series: _arcs.map(function (arc) {
629
- return _objectSpread(_objectSpread({}, arc), {}, {
630
- percent: arc.percent.toFixed(legendPrecision)
631
- });
632
- }),
633
- pieClick: onClick,
634
- formatter: formatter,
635
- judge: judgeData
636
635
  }))) : /*#__PURE__*/_react["default"].createElement("div", {
637
636
  ref: domRef
638
637
  }, /*#__PURE__*/_react["default"].createElement(_.ChartContainer, {
@@ -776,10 +775,21 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
776
775
  config: decorate,
777
776
  arcs: _arcs,
778
777
  radius: radius
779
- }), tooltip && mousePos && mousePos.x != 0 && mousePos.y != 0 && tooltip.manual && /*#__PURE__*/_react["default"].createElement("div", {
778
+ }), /*#__PURE__*/_react["default"].createElement(_.Legend, (0, _extends2["default"])({}, legend, {
779
+ height: chartHeight,
780
+ data: data,
781
+ columnsSeries: columnsSeries,
782
+ series: _arcs.map(function (arc) {
783
+ return _objectSpread(_objectSpread({}, arc), {}, {
784
+ percent: arc.percent.toFixed(legendPrecision)
785
+ });
786
+ }),
787
+ pieClick: onClick,
788
+ formatter: formatter,
789
+ judge: judgeData
790
+ })), tooltip && mousePos && mousePos.x != 0 && mousePos.y != 0 && tooltip.manual && /*#__PURE__*/_react["default"].createElement("div", {
780
791
  style: {
781
792
  position: "absolute",
782
- zIndex: 9999,
783
793
  pointerEvents: "none"
784
794
  }
785
795
  }, /*#__PURE__*/_react["default"].createElement(_PieTooltip.PieTooltip, {
@@ -792,18 +802,6 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
792
802
  y: maxRadius + marginTop
793
803
  },
794
804
  mousePos: mousePos
795
- })), /*#__PURE__*/_react["default"].createElement(_.Legend, (0, _extends2["default"])({}, legend, {
796
- height: chartHeight,
797
- data: data,
798
- columnsSeries: columnsSeries,
799
- series: _arcs.map(function (arc) {
800
- return _objectSpread(_objectSpread({}, arc), {}, {
801
- percent: arc.percent.toFixed(legendPrecision)
802
- });
803
- }),
804
- pieClick: onClick,
805
- formatter: formatter,
806
- judge: judgeData
807
805
  })));
808
806
  });
809
807
  var Current = function Current(_ref9) {
@@ -99,8 +99,7 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
99
99
  }, (0, _utils.getFontStyle)(font)), {}, {
100
100
  width: "fit-content",
101
101
  maxWidth: "none",
102
- overflow: "visible",
103
- zIndex: 9999
102
+ overflow: "visible"
104
103
  })
105
104
  }, formatter ? formatter({
106
105
  series: series,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyv/charts",
3
- "version": "1.10.11",
3
+ "version": "1.10.13",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -32,7 +32,7 @@ const getCanvasContext = (): CanvasRenderingContext2D => {
32
32
  export const calculateTextWidth = (
33
33
  text: string,
34
34
  fontConfig: any,
35
- isVertical: any
35
+ isVertical: any,
36
36
  ): number => {
37
37
  if (!text) return 0;
38
38
  const ctx = getCanvasContext();
@@ -82,14 +82,14 @@ const defaultOrientation = "bottom";
82
82
  const defaultTickSize = 6;
83
83
  const defaultFormatter: (
84
84
  d: string,
85
- { suffix }: { suffix: string }
85
+ { suffix }: { suffix: string },
86
86
  ) => string = (d, { suffix }) => d + suffix;
87
87
 
88
88
  const getAxesPath: (
89
89
  orientation: Orientation,
90
90
  { width, height }: Context,
91
91
  cHeight: number,
92
- cPercent: number
92
+ cPercent: number,
93
93
  ) => string = (orientation, { width, height }, cHeight, cPercent) => {
94
94
  switch (orientation) {
95
95
  case "top":
@@ -112,7 +112,7 @@ const getAxesPath: (
112
112
  */
113
113
  const getLayout: (
114
114
  orientation: Orientation,
115
- rotate: number
115
+ rotate: number,
116
116
  ) => {
117
117
  transform: string;
118
118
  directionX: number;
@@ -253,7 +253,7 @@ function maxLabelFT(
253
253
  config: any,
254
254
  formatter: any,
255
255
  font: any,
256
- isVertical: any
256
+ isVertical: any,
257
257
  ) {
258
258
  let max = 0;
259
259
  data.length
@@ -265,7 +265,7 @@ function maxLabelFT(
265
265
  format: { type: config.format, showType: config.showType },
266
266
  }),
267
267
  font,
268
- isVertical
268
+ isVertical,
269
269
  ) > max
270
270
  )
271
271
  max = calculateTextWidth(
@@ -274,14 +274,14 @@ function maxLabelFT(
274
274
  format: { type: config.format, showType: config.showType },
275
275
  }),
276
276
  font,
277
- isVertical
277
+ isVertical,
278
278
  );
279
279
  })
280
280
  : "";
281
281
  return max;
282
282
  }
283
283
  const Label: (
284
- props: LabelType
284
+ props: LabelType,
285
285
  ) => ReactComponentElement<ComponentType> | null = ({
286
286
  className,
287
287
  orientation = defaultOrientation,
@@ -311,7 +311,7 @@ const Label: (
311
311
  });
312
312
  const { transform, directionX, directionY } = getLayout(
313
313
  orientation,
314
- adaptive ? 0 : rotate
314
+ adaptive ? 0 : rotate,
315
315
  );
316
316
  const isVertical = orientation == "left" || orientation == "right";
317
317
 
@@ -339,6 +339,7 @@ const Label: (
339
339
  ...getFontStyle(font),
340
340
  position: "relative", // 替换 absolute
341
341
  cursor: "pointer",
342
+ display: !adaptive ? "inline-block" : "block",
342
343
  transform: `translate(${x + (isIOS ? iosX : 0)}px, ${
343
344
  y + (isIOS ? iosY : 0)
344
345
  }px)`, // 用 transform 定位
@@ -358,8 +359,8 @@ const Label: (
358
359
  textAlign == "left"
359
360
  ? "flex-start"
360
361
  : textAlign == "right"
361
- ? "flex-end"
362
- : "center",
362
+ ? "flex-end"
363
+ : "center",
363
364
  }}
364
365
  ></TextOverflow>
365
366
  ) : (
@@ -409,7 +410,7 @@ export default memo(
409
410
  rawTicks,
410
411
  paddingOuter,
411
412
  }: any,
412
- ref
413
+ ref,
413
414
  ) => {
414
415
  const { width, height, isIOS } = useContext(chartContext);
415
416
  const { cHeight, isC, cPercent } = controlInfo;
@@ -426,13 +427,13 @@ export default memo(
426
427
  label,
427
428
  formatter,
428
429
  label.font,
429
- isVertical
430
+ isVertical,
430
431
  );
431
432
  }
432
433
  }
433
434
  const LabelNum = !isVertical
434
435
  ? Math.floor(
435
- ((width / (isC ? cPercent : 1)) * (1 - paddingOuter)) / LabelWidth
436
+ ((width / (isC ? cPercent : 1)) * (1 - paddingOuter)) / LabelWidth,
436
437
  )
437
438
  : Math.floor(height / LabelWidth);
438
439
 
@@ -445,7 +446,7 @@ export default memo(
445
446
  ? Math.ceil(allTicks.length / 2)
446
447
  : LabelNum
447
448
  : allTicks.length,
448
- label.showLast
449
+ label.showLast,
449
450
  );
450
451
  if (!(on && ticks.length > 0)) return null;
451
452
 
@@ -453,7 +454,7 @@ export default memo(
453
454
  function getEvenlySpacedElements(
454
455
  arr: any[],
455
456
  expectCount: number,
456
- acc: boolean = false
457
+ acc: boolean = false,
457
458
  ): any[] {
458
459
  if (!arr.length || expectCount <= 0) return [];
459
460
  if (expectCount >= arr.length) return [...arr];
@@ -732,6 +733,6 @@ export default memo(
732
733
  </svg>
733
734
  </g>
734
735
  );
735
- }
736
- )
736
+ },
737
+ ),
737
738
  );
@@ -54,7 +54,7 @@ export default memo(
54
54
  onMouseMove={onMouseMove}
55
55
  ref={ref}
56
56
  style={{
57
- overflow: "hidden",
57
+ overflow: "visible",
58
58
  position: "absolute",
59
59
  width,
60
60
  height,
@@ -622,6 +622,20 @@ const Component = memo(
622
622
  )}
623
623
  </g>
624
624
  </ChartContainer>
625
+
626
+ <Legend
627
+ {...legend}
628
+ height={chartHeight}
629
+ columnsSeries={columnsSeries}
630
+ data={data}
631
+ series={_arcs.map((arc) => ({
632
+ ...arc,
633
+ percent: arc.percent.toFixed(legendPrecision),
634
+ }))}
635
+ pieClick={onClick}
636
+ formatter={formatter}
637
+ judge={judgeData}
638
+ />
625
639
  {tooltip &&
626
640
  mousePos &&
627
641
  mousePos.x != 0 &&
@@ -630,7 +644,6 @@ const Component = memo(
630
644
  <div
631
645
  style={{
632
646
  position: "absolute",
633
- zIndex: 9999,
634
647
  pointerEvents: "none",
635
648
  }}
636
649
  >
@@ -647,19 +660,6 @@ const Component = memo(
647
660
  />
648
661
  </div>
649
662
  )}
650
- <Legend
651
- {...legend}
652
- height={chartHeight}
653
- columnsSeries={columnsSeries}
654
- data={data}
655
- series={_arcs.map((arc) => ({
656
- ...arc,
657
- percent: arc.percent.toFixed(legendPrecision),
658
- }))}
659
- pieClick={onClick}
660
- formatter={formatter}
661
- judge={judgeData}
662
- />
663
663
  </div>
664
664
  ) : (
665
665
  <div ref={domRef}>
@@ -893,6 +893,20 @@ const Component = memo(
893
893
  radius={radius}
894
894
  />
895
895
  )}
896
+
897
+ <Legend
898
+ {...legend}
899
+ height={chartHeight}
900
+ data={data}
901
+ columnsSeries={columnsSeries}
902
+ series={_arcs.map((arc) => ({
903
+ ...arc,
904
+ percent: arc.percent.toFixed(legendPrecision),
905
+ }))}
906
+ pieClick={onClick}
907
+ formatter={formatter}
908
+ judge={judgeData}
909
+ />
896
910
  {tooltip &&
897
911
  mousePos &&
898
912
  mousePos.x != 0 &&
@@ -901,7 +915,6 @@ const Component = memo(
901
915
  <div
902
916
  style={{
903
917
  position: "absolute",
904
- zIndex: 9999,
905
918
  pointerEvents: "none",
906
919
  }}
907
920
  >
@@ -918,19 +931,6 @@ const Component = memo(
918
931
  />
919
932
  </div>
920
933
  )}
921
- <Legend
922
- {...legend}
923
- height={chartHeight}
924
- data={data}
925
- columnsSeries={columnsSeries}
926
- series={_arcs.map((arc) => ({
927
- ...arc,
928
- percent: arc.percent.toFixed(legendPrecision),
929
- }))}
930
- pieClick={onClick}
931
- formatter={formatter}
932
- judge={judgeData}
933
- />
934
934
  </div>
935
935
  );
936
936
  },
@@ -114,7 +114,6 @@ export default memo(
114
114
  width: "fit-content",
115
115
  maxWidth: "none",
116
116
  overflow: "visible",
117
- zIndex: 9999,
118
117
  }}
119
118
  >
120
119
  {formatter ? (