@publishfx/publish-chart 2.1.9 → 2.1.10

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,7 @@
1
+ **2.1.10** fix(chart): 修复剩余数据全为0时的Y轴异常问题
2
+ - 2026-03-04T17:34:02+08:00 [fix(chart): 修复剩余数据全为0时的Y轴异常问题](http://lf.git.oa.mt/publish_platform/web/publish/commit/0d64328b1c38b71ad0289579592870fa20bc37b1)
3
+ - 2026-03-04T17:13:55+08:00 [fix(chart): 辅助线分左右,分别影响主、副轴的刻度尺](http://lf.git.oa.mt/publish_platform/web/publish/commit/0c91a39b4fe8ff1b13999766e8f6f90dce85f37e)
4
+
1
5
  **2.1.9** feat(chart): 组合图折线色彩设置
2
6
  - 2026-03-04T16:45:43+08:00 [feat(chart): 组合图折线色彩设置](http://lf.git.oa.mt/publish_platform/web/publish/commit/2d456a5bd13fbed534b125a71955e8d18f62bbfc)
3
7
  - 2026-03-04T16:42:51+08:00 [feat(chart): 组合图副轴最大值逻辑复原](http://lf.git.oa.mt/publish_platform/web/publish/commit/6a1e758f64f6e7ef202c8089afecdd49580cf133)
@@ -263,7 +263,7 @@ function applyNodeData(view, nodeData, x, y) {
263
263
  return nodeList;
264
264
  }
265
265
  function adjustDomainMax(domainMin, domainMax) {
266
- return domainMax === domainMin ? domainMin > 0 ? 1.1 * domainMax : domainMax + 1 : domainMax;
266
+ return domainMax === domainMin ? domainMin > 0 ? 1.1 * domainMax : domainMax + 1000 : domainMax;
267
267
  }
268
268
  const sortByIndicators = (arr, indicators)=>arr.sort((a, b)=>{
269
269
  const baseA = a.split('_')[0];
@@ -40,9 +40,11 @@ function renderG2CombineChart(container, options) {
40
40
  const key = isGroup ? "total" : BAR_Y_FIELD;
41
41
  return Math.max(max, item[key]);
42
42
  }, 0);
43
- const auxValues = auxiliaryLineData?.length ? auxiliaryLineData.map((item)=>item.value) : [];
44
- const maxAux = auxValues.length ? Math.max(...auxValues) : 0;
45
- const finalIntervalMax = Math.max(intervalMaxY, maxAux);
43
+ const auxLeftValues = auxiliaryLineData?.length ? auxiliaryLineData.filter((item)=>'left' === item.axis).map((item)=>item.value) : [];
44
+ const maxAuxLeft = auxLeftValues.length ? Math.max(...auxLeftValues) : 0;
45
+ const auxRightValues = auxiliaryLineData?.length ? auxiliaryLineData.filter((item)=>'right' === item.axis).map((item)=>item.value) : [];
46
+ const maxAuxRight = auxRightValues.length ? Math.max(...auxRightValues) : 0;
47
+ const finalIntervalMax = Math.max(intervalMaxY, maxAuxLeft);
46
48
  const interval = view.interval().data(intervalData).encode("x", x).encode("y", BAR_Y_FIELD).encode("color", "groupType").transform(isGroup ? {
47
49
  type: 'stackY',
48
50
  reverse: true
@@ -163,7 +165,7 @@ function renderG2CombineChart(container, options) {
163
165
  const lineMaxY = lineData.reduce((max, item)=>Math.max(max, item[LINE_Y_FIELD]), 0);
164
166
  const compareLineMaxY = compareLineData.reduce((max, item)=>Math.max(max, item[LINE_Y_FIELD]), 0);
165
167
  const lineFinalMaxY = Math.max(lineMaxY, compareLineMaxY) || 1;
166
- const finalLineMax = Math.max(lineFinalMaxY, maxAux);
168
+ const finalLineMax = Math.max(lineFinalMaxY, maxAuxRight);
167
169
  console.log('lineData:', lineData);
168
170
  const line = view.line().data(lineData).encode("x", x).encode("y", LINE_Y_FIELD).encode('color', 'groupType').style({
169
171
  lineWidth: 2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@publishfx/publish-chart",
3
- "version": "2.1.9",
3
+ "version": "2.1.10",
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": [