@publishfx/publish-chart 2.1.30 → 2.1.32

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.
@@ -47,7 +47,7 @@ const transformDataToGroupBarLineFormat = (data, x = "groupName", y = "", indica
47
47
  isCombine: isCombineFlag,
48
48
  total: compareValue,
49
49
  change: changeValue,
50
- compareTime: compareTimeValue
50
+ compareTime: compareTimeValue || '对比时间'
51
51
  });
52
52
  return rows;
53
53
  });
@@ -34,7 +34,7 @@ function renderG2BarChart(container, options) {
34
34
  key: 'main'
35
35
  });
36
36
  if (!CLOSE_HIGHLIGHT_DEBUG) applyHighlightDate(view, x, data, highlightDate, isHighlight);
37
- const minLabelWidth = data.some((d)=>d.groupName.length < 3) ? 30 : 90;
37
+ const minLabelWidth = data.some((d)=>d.groupName.length < 3) ? 30 : isHorizontal ? 30 : 90;
38
38
  const interval = view.interval().encode('x', x).encode('y', y).encode('color', 'groupType').transform({
39
39
  type: 'dodgeX',
40
40
  padding: isHorizontal ? 0.2 : 0
@@ -3,8 +3,9 @@ import { memo } from "react";
3
3
  import { CompareChange } from "@publishfx/publish-components";
4
4
  import { getIndicatorCompareName } from "../../../utils/indicatorHelpers.js";
5
5
  const G2CompareTooltip = ({ isGroupBar = false, title, items, safeIndicatorMap, formatter, auxiliaryLineData })=>{
6
- let auxiIndicatorId = '';
7
- let combineIndicatorId = '';
6
+ let auxiIndicatorId = "";
7
+ let combineIndicatorId = "";
8
+ let changeValue = null;
8
9
  const uniqueColors = [];
9
10
  return /*#__PURE__*/ jsxs("div", {
10
11
  style: {
@@ -22,7 +23,9 @@ const G2CompareTooltip = ({ isGroupBar = false, title, items, safeIndicatorMap,
22
23
  isFirst = true;
23
24
  uniqueColors.push(color);
24
25
  }
25
- if (combineIndicatorId === auxiIndicatorId && '-' === value && 'manual' === dataType) return null;
26
+ if (null !== changeValue && combineIndicatorId === auxiIndicatorId && "manual" === dataType && isChange) value = changeValue ?? '';
27
+ if (isChange) changeValue = value ?? '';
28
+ if (combineIndicatorId === auxiIndicatorId && "-" === value && "manual" === dataType && !isChange) return null;
26
29
  return !hidden && /*#__PURE__*/ jsxs("div", {
27
30
  style: {
28
31
  display: "flex",
@@ -43,7 +46,7 @@ const G2CompareTooltip = ({ isGroupBar = false, title, items, safeIndicatorMap,
43
46
  borderRadius: "50%"
44
47
  }
45
48
  }),
46
- isChange ? "相比变化" : compareTime ? `${getIndicatorCompareName(safeIndicatorMap, indicatorId ?? '')}(${compareTime})` : isGroupBar ? name : `${getIndicatorCompareName(safeIndicatorMap, indicatorId ?? '')}`,
49
+ isChange ? "相比变化" : compareTime ? `${getIndicatorCompareName(safeIndicatorMap, indicatorId ?? "")}(${compareTime})` : isGroupBar ? name : `${getIndicatorCompareName(safeIndicatorMap, indicatorId ?? "")}`,
47
50
  ":"
48
51
  ]
49
52
  }),
@@ -82,7 +85,7 @@ const G2CompareTooltip = ({ isGroupBar = false, title, items, safeIndicatorMap,
82
85
  ]
83
86
  }),
84
87
  /*#__PURE__*/ jsx("div", {
85
- children: 'right' === axis ? formatter.formatIndicator(value, safeIndicatorMap[combineIndicatorId ?? ''] ?? {}) : formatter.formatIndicator(value, safeIndicatorMap[auxiIndicatorId ?? ''] ?? {})
88
+ children: "right" === axis ? formatter.formatIndicator(value, safeIndicatorMap[combineIndicatorId ?? ""] ?? {}) : formatter.formatIndicator(value, safeIndicatorMap[auxiIndicatorId ?? ""] ?? {})
86
89
  })
87
90
  ]
88
91
  }, index))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@publishfx/publish-chart",
3
- "version": "2.1.30",
3
+ "version": "2.1.32",
4
4
  "description": "A React chart component library for the Publish platform, including BarChart, LineChart, BarLineChart and other visualization components",
5
5
  "type": "module",
6
6
  "keywords": [