@publishfx/publish-chart 2.1.6 → 2.1.7
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,12 @@
|
|
|
1
|
+
**2.1.7** fix(chart): 修复折线图有空数据的异常场景
|
|
2
|
+
- 2026-03-03T17:50:03+08:00 [fix(chart): 修复折线图有空数据的异常场景](http://lf.git.oa.mt/publish_platform/web/publish/commit/3465ede843d4fb156932871cdf042315dbb17096)
|
|
3
|
+
- 2026-03-03T17:38:27+08:00 [fix(chart): 组合图柱数据缺失问题优化](http://lf.git.oa.mt/publish_platform/web/publish/commit/fa55e35a7569b9e7000d2c4dc5d09eee3b60bfff)
|
|
4
|
+
- 2026-03-03T17:35:16+08:00 [fix: tserror](http://lf.git.oa.mt/publish_platform/web/publish/commit/995efdbe45391ecdb06ef6838c65d9bc87c33efa)
|
|
5
|
+
- 2026-03-03T17:28:25+08:00 [feat: 去掉element:click](http://lf.git.oa.mt/publish_platform/web/publish/commit/5bb84001d505392306f4dfd8300e7d21f47fe95b)
|
|
6
|
+
- 2026-03-03T17:26:42+08:00 [fix: 折线图点击无法下钻](http://lf.git.oa.mt/publish_platform/web/publish/commit/5395a60b96d9db398d5a4c5c8610481cbba8362a)
|
|
7
|
+
- 2026-03-03T16:36:31+08:00 [fix: label缩略时要设置minLength](http://lf.git.oa.mt/publish_platform/web/publish/commit/b11ff5ff52376442f3a9b057b942f0d47c4f9ee5)
|
|
8
|
+
- 2026-03-03T14:19:39+08:00 [feat(chart): 组合图排序代码整理](http://lf.git.oa.mt/publish_platform/web/publish/commit/baab4ed6bbd0a3bac46fccb1d3875af241368770)
|
|
9
|
+
|
|
1
10
|
**2.1.6** fix(chart): 解决ts错误
|
|
2
11
|
- 2026-03-03T06:38:38+08:00 [fix(chart): 解决ts错误](http://lf.git.oa.mt/publish_platform/web/publish/commit/a1a61c8cbfede6e0993a1101dd4f375ad3383302)
|
|
3
12
|
- 2026-03-03T06:30:33+08:00 [fix(chart): 修复所有遗留问题](http://lf.git.oa.mt/publish_platform/web/publish/commit/73456fbb6fe853fc9069e2c6712851375dd372da)
|
|
@@ -106,7 +106,7 @@ class DataAdapter {
|
|
|
106
106
|
if (config.y) dv.transform({
|
|
107
107
|
type: 'map',
|
|
108
108
|
callback: (row)=>{
|
|
109
|
-
row[config.y] = '' !== row[config.y] ? +row[config.y] : '-';
|
|
109
|
+
row[config.y] = '' !== row[config.y] && '-' !== row[config.y] && null !== row[config.y] ? +row[config.y] : '-';
|
|
110
110
|
return row;
|
|
111
111
|
}
|
|
112
112
|
});
|
|
@@ -158,10 +158,15 @@ class DataAdapter {
|
|
|
158
158
|
});
|
|
159
159
|
const xKey = config.x ?? 'x';
|
|
160
160
|
const sortData = tdv.rows.map((item)=>item[xKey]);
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
combinedv.rows.sort((a, b)=>{
|
|
162
|
+
const aIndex = sortData.indexOf(a[xKey]);
|
|
163
|
+
const bIndex = sortData.indexOf(b[xKey]);
|
|
164
|
+
if (-1 === aIndex) return 1;
|
|
165
|
+
if (-1 === bIndex) return -1;
|
|
166
|
+
return aIndex - bIndex;
|
|
167
|
+
});
|
|
163
168
|
}
|
|
164
|
-
console.log('
|
|
169
|
+
console.log('leftData:', tdv.rows, 'rightData:', combinedv.rows);
|
|
165
170
|
return {
|
|
166
171
|
transformedData: dv.rows,
|
|
167
172
|
leftData: tdv.rows,
|
|
@@ -31,6 +31,7 @@ const G2LineChart = ({ height = 300, data, x = "", y = "", z = "", indicatorMap,
|
|
|
31
31
|
const [legendItems, setLegendItems] = useState([]);
|
|
32
32
|
const containerRef = useRef(null);
|
|
33
33
|
const chartRef = useRef(null);
|
|
34
|
+
const currentTooltipTitleRef = useRef(null);
|
|
34
35
|
const [viewWidth, setViewWidth] = useState(0);
|
|
35
36
|
const [viewOffset, setViewOffset] = useState(0);
|
|
36
37
|
const transformedData = useMemo(()=>{
|
|
@@ -72,6 +73,7 @@ const G2LineChart = ({ height = 300, data, x = "", y = "", z = "", indicatorMap,
|
|
|
72
73
|
safeY,
|
|
73
74
|
auxiliaryLineData
|
|
74
75
|
]);
|
|
76
|
+
console.log('minY, maxY:', minY, maxY);
|
|
75
77
|
const formatAxis = useCallback((val)=>getAxisFormat(val, safeIndicatorMap, safeLegend), [
|
|
76
78
|
safeIndicatorMap,
|
|
77
79
|
safeLegend
|
|
@@ -143,6 +145,7 @@ const G2LineChart = ({ height = 300, data, x = "", y = "", z = "", indicatorMap,
|
|
|
143
145
|
} : void 0,
|
|
144
146
|
height: height - canvasMarginBottom,
|
|
145
147
|
tooltipRender: (title, items)=>{
|
|
148
|
+
currentTooltipTitleRef.current = title;
|
|
146
149
|
const container = tooltipContainerRef.current;
|
|
147
150
|
if (!container) return null;
|
|
148
151
|
let safeItems = items.map((i)=>({
|
|
@@ -174,15 +177,18 @@ const G2LineChart = ({ height = 300, data, x = "", y = "", z = "", indicatorMap,
|
|
|
174
177
|
}
|
|
175
178
|
});
|
|
176
179
|
chartRef.current = chart;
|
|
177
|
-
if (onChartClick) chart.on("
|
|
178
|
-
const
|
|
179
|
-
if (
|
|
180
|
-
title
|
|
181
|
-
|
|
180
|
+
if (onChartClick) chart.on("plot:click", (_e)=>{
|
|
181
|
+
const tooltipTitle = currentTooltipTitleRef.current;
|
|
182
|
+
if (null != tooltipTitle) {
|
|
183
|
+
console.log('使用 tooltip title 触发下钻:', tooltipTitle);
|
|
184
|
+
onChartClick({
|
|
185
|
+
title: tooltipTitle
|
|
186
|
+
});
|
|
187
|
+
}
|
|
182
188
|
});
|
|
183
189
|
return ()=>{
|
|
184
190
|
if (chartRef.current) {
|
|
185
|
-
chartRef.current.off("
|
|
191
|
+
chartRef.current.off("plot:click");
|
|
186
192
|
chartRef.current.off("element:mouseenter");
|
|
187
193
|
chartRef.current.off("element:mouseleave");
|
|
188
194
|
chartRef.current.destroy();
|
|
@@ -76,6 +76,7 @@ function applyAxisX(mark, options = {}) {
|
|
|
76
76
|
size: isHorizontal ? Math.floor(containerWidth / 5) : 30,
|
|
77
77
|
labelAutoEllipsis: {
|
|
78
78
|
type: 'ellipsis',
|
|
79
|
+
minLength: 80,
|
|
79
80
|
maxLength: isHorizontal ? Math.floor(containerWidth / 5) : Math.min(maxLabelChars * fontSize * 0.55, 90)
|
|
80
81
|
},
|
|
81
82
|
labelAlign: 'horizontal',
|
|
@@ -186,6 +186,7 @@ function renderG2CombineChart(container, options) {
|
|
|
186
186
|
];
|
|
187
187
|
const groupType = String(datum?.groupType ?? '');
|
|
188
188
|
const index = groupTypeArr.findIndex((item)=>item === groupType);
|
|
189
|
+
console.log('line: groupTypeArr:', groupTypeArr, groupType, index, lineColors, getIndicatorCompareName(_indicatorMap, datum['groupType']), datum['groupType']);
|
|
189
190
|
return {
|
|
190
191
|
value: datum[LINE_Y_FIELD],
|
|
191
192
|
name: getIndicatorCompareName(_indicatorMap, datum['groupType']),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@publishfx/publish-chart",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.7",
|
|
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": [
|