@publishfx/publish-chart 2.1.33 → 2.1.35

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,9 @@
1
+ **2.1.35** fix(chart): 组合图需要highlightDate依赖侦听
2
+ - 2026-03-19T19:24:40+08:00 [fix(chart): 组合图需要highlightDate依赖侦听](http://lf.git.oa.mt/publish_platform/web/publish/commit/5bd7170d6dd7707c06a7a14f944a8317642ccf2f)
3
+
4
+ **2.1.34** fix(chart): 修复组合图有缺失项时导致的排序不符合预期的问题
5
+ - 2026-03-13T18:27:29+08:00 [fix(chart): 修复组合图有缺失项时导致的排序不符合预期的问题](http://lf.git.oa.mt/publish_platform/web/publish/commit/22494114c4fe99d7a63b434a6b48f1d4ad0fd58e)
6
+
1
7
  **2.1.33** fix(chart): 修复几个问题
2
8
  - 2026-03-13T15:39:21+08:00 [fix(chart): 修复几个问题](http://lf.git.oa.mt/publish_platform/web/publish/commit/8007ec69939e98bacdb694b917c73fff6f8254d2)
3
9
  - 2026-03-11T16:17:35+08:00 [fix(chart): 离线分析compareTimeValue为空时补充字符。](http://lf.git.oa.mt/publish_platform/web/publish/commit/9f042730b66e8378c90400981cd86376e8b3018d)
@@ -172,7 +172,7 @@ const G2CombineChart = ({ height = 300, data, x = "", y = "", z = "", indicatorM
172
172
  const result = leftData.filter((d)=>d.groupType ? activeIds.includes(String(d.groupType.replace("_compare", "") + "_" + d.isCombine)) : true);
173
173
  if (!isGroupRef.current) return result;
174
174
  {
175
- const groupTypes = Array.from(new Set(result.map((d)=>d.groupType)));
175
+ const groupTypes = Array.from(new Set(result.map((d)=>String(d.groupType))));
176
176
  const groupNameTotalMap = result.reduce((acc, item)=>{
177
177
  const groupName = String(item.groupName);
178
178
  const value = "" === item.groupValue || "-" === item.groupValue ? 0 : Number(item.groupValue) || 0;
@@ -184,23 +184,38 @@ const G2CombineChart = ({ height = 300, data, x = "", y = "", z = "", indicatorM
184
184
  const key = String(item.groupName);
185
185
  if (!leftDataOrder.has(key)) leftDataOrder.set(key, leftDataOrder.size);
186
186
  });
187
+ const orderedGroupNames = Array.from(new Set(result.map((item)=>String(item.groupName)))).sort((a, b)=>{
188
+ if (isDescend) {
189
+ const aTotal = groupNameTotalMap[a] ?? 0;
190
+ const bTotal = groupNameTotalMap[b] ?? 0;
191
+ if (aTotal !== bTotal) return bTotal - aTotal;
192
+ }
193
+ const aIndex = leftDataOrder.get(a);
194
+ const bIndex = leftDataOrder.get(b);
195
+ if (void 0 === aIndex && void 0 === bIndex) return xKey.indexOf(a) - xKey.indexOf(b);
196
+ if (void 0 === aIndex) return 1;
197
+ if (void 0 === bIndex) return -1;
198
+ return aIndex - bIndex;
199
+ });
187
200
  let groupResult = [];
188
201
  groupTypes.forEach((groupType)=>{
189
- const groupData = leftData.filter((d)=>d.groupType === groupType).map((d)=>({
202
+ const groupDataMap = new Map();
203
+ leftData.filter((d)=>d.groupType === groupType).forEach((d)=>{
204
+ groupDataMap.set(String(d.groupName), {
190
205
  ...d
191
- }));
192
- groupData.sort((a, b)=>{
193
- if (isDescend) {
194
- const aTotal = groupNameTotalMap[String(a.groupName)] ?? 0;
195
- const bTotal = groupNameTotalMap[String(b.groupName)] ?? 0;
196
- if (aTotal !== bTotal) return bTotal - aTotal;
197
- }
198
- const aIndex = leftDataOrder.get(String(a.groupName));
199
- const bIndex = leftDataOrder.get(String(b.groupName));
200
- if (void 0 === aIndex && void 0 === bIndex) return xKey.indexOf(a.groupName) - xKey.indexOf(b.groupName);
201
- if (void 0 === aIndex) return 1;
202
- if (void 0 === bIndex) return -1;
203
- return aIndex - bIndex;
206
+ });
207
+ });
208
+ const groupData = orderedGroupNames.map((groupName)=>{
209
+ const existed = groupDataMap.get(groupName);
210
+ if (existed) return existed;
211
+ return {
212
+ groupName,
213
+ isCombine: false,
214
+ groupType,
215
+ groupValue: null,
216
+ total: 0,
217
+ percent: ""
218
+ };
204
219
  });
205
220
  groupResult = groupResult.concat(groupData);
206
221
  });
@@ -372,6 +387,7 @@ const G2CombineChart = ({ height = 300, data, x = "", y = "", z = "", indicatorM
372
387
  onChartClick,
373
388
  isLegend,
374
389
  isHighlight,
390
+ highlightDate,
375
391
  legendItems,
376
392
  auxiliaryLineData,
377
393
  leftData,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@publishfx/publish-chart",
3
- "version": "2.1.33",
3
+ "version": "2.1.35",
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": [