@publishfx/publish-chart 2.1.44 → 2.2.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ **2.2.0** feat(chart): 分组对比折线图切换分组时自定义图例逻辑处理 f-7042142039
2
+ - 2026-07-08T16:49:05+08:00 [feat(chart): 分组对比折线图切换分组时自定义图例逻辑处理 f-7042142039](http://lf.git.oa.mt/publish_platform/web/publish/commit/7c686382752aca5c5d6f1b66863a9845c375bd67)
3
+
1
4
  **2.1.44** feat(chart): 更新图表组件及发布脚本
2
5
  - 2026-07-08T11:17:13+08:00 [feat(chart): 更新图表组件及发布脚本](http://lf.git.oa.mt/publish_platform/web/publish/commit/c3efe54dd3e640b72ea027815efd84b5d817f472)
3
6
  - 2026-07-07T14:20:55+08:00 [feat: 组合图副轴间距调整 f-6880297364](http://lf.git.oa.mt/publish_platform/web/publish/commit/b662f2234806c5b6e40c5ae8d2ed4a7cacc03bee)
@@ -58,6 +58,7 @@ const GroupLineCompare = ({ height, data, x = 'groupName', y = '', legend = 'gro
58
58
  const [legendItems, setLegendItems] = useState([]);
59
59
  const prevLegendItemsRef = useRef([]);
60
60
  const isFirstRenderRef = useRef(true);
61
+ const prevDataSignatureRef = useRef('');
61
62
  const [padding, setPadding] = useState([
62
63
  20,
63
64
  10,
@@ -166,6 +167,9 @@ const GroupLineCompare = ({ height, data, x = 'groupName', y = '', legend = 'gro
166
167
  }
167
168
  }
168
169
  }));
170
+ const dataSignature = groupTypeLegendArr.sort().join(',');
171
+ const isCompletelyNew = '' !== prevDataSignatureRef.current && prevDataSignatureRef.current !== dataSignature;
172
+ prevDataSignatureRef.current = dataSignature;
169
173
  setColorMap(colorMap);
170
174
  setLegendItems(legendItems);
171
175
  setCheckedLegendItems((prev)=>{
@@ -173,6 +177,7 @@ const GroupLineCompare = ({ height, data, x = 'groupName', y = '', legend = 'gro
173
177
  isFirstRenderRef.current = false;
174
178
  return groupTypeSet;
175
179
  }
180
+ if (isCompletelyNew) return groupTypeSet;
176
181
  const prevLegendNames = new Set(prevLegendItemsRef.current.map((item)=>item.name));
177
182
  const next = new Set();
178
183
  groupTypeSet.forEach((item)=>{
@@ -497,7 +502,7 @@ const GroupLineCompare = ({ height, data, x = 'groupName', y = '', legend = 'gro
497
502
  maxItemWidth: 1,
498
503
  visible: isLegend,
499
504
  itemHeight: 14
500
- }),
505
+ }, legendItems.map((item)=>item.name).join(',')),
501
506
  /*#__PURE__*/ jsx(Legend, {
502
507
  name: "color",
503
508
  visible: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@publishfx/publish-chart",
3
- "version": "2.1.44",
3
+ "version": "2.2.0",
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": [