@publishfx/publish-chart 1.5.0 → 2.0.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 +8 -0
- package/dist/components/g2/base/G2BarChart.d.ts +8 -0
- package/dist/components/g2/base/G2BarChart.js +107 -0
- package/dist/components/g2/base/G2GaugeChart.d.ts +38 -0
- package/dist/components/g2/base/G2GaugeChart.example.d.ts +10 -0
- package/dist/components/g2/base/G2GaugeChart.example.js +88 -0
- package/dist/components/g2/base/G2GaugeChart.js +137 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -1
- package/dist/utils/lazyHelpers.d.ts +2 -2
- package/package.json +4 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
**2.0.0** feat(chart): 修改ts错误问题
|
|
2
|
+
- 2026-02-02T14:37:21+08:00 [feat(chart): 修改ts错误问题](http://lf.git.oa.mt/publish_platform/web/publish/commit/023b12647850619e340164e02a1f86e884eccf35)
|
|
3
|
+
- 2026-02-02T11:12:14+08:00 [feat(chart): 新增G2图表组件](http://lf.git.oa.mt/publish_platform/web/publish/commit/cfec9e945ceb9d8c0645dcea3d9adfe43c8d0bdc)
|
|
4
|
+
|
|
5
|
+
# @publishfx/publish-chart CHANGELOG
|
|
6
|
+
|
|
7
|
+
**1.5.0** feat(chart): 多指标对比折线图统一指标颜色统一
|
|
8
|
+
- 2026-01-22T21:47:35+08:00 [feat(chart): 多指标对比折线图统一指标颜色统一](http://lf.git.oa.mt/publish_platform/web/publish/commit/eaf01cf03ecb479adf3b0bc82e941f2912513f43)
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useRef } from "react";
|
|
3
|
+
import { Chart } from "@antv/g2";
|
|
4
|
+
import { useChartContext } from "../../../core/ChartContext.js";
|
|
5
|
+
import { DataAdapter } from "../../../adapters/DataAdapter.js";
|
|
6
|
+
const G2BarChart = ({ height = 300, data, x = '', y = '', indicatorMap, onChartClick, legend = '', config })=>{
|
|
7
|
+
const { formatter, dataTransform, config: contextConfig } = useChartContext();
|
|
8
|
+
const safeIndicatorMap = indicatorMap || contextConfig.indicatorMap || {};
|
|
9
|
+
const safeLegend = legend || y;
|
|
10
|
+
const chartConfig = config || {};
|
|
11
|
+
const { isDataTag = false, isDescend = false, isHorizontal = false } = chartConfig;
|
|
12
|
+
const transformedData = useMemo(()=>{
|
|
13
|
+
const result = DataAdapter.transform(data, 'bar', {
|
|
14
|
+
type: 'bar',
|
|
15
|
+
x,
|
|
16
|
+
y,
|
|
17
|
+
isDescend,
|
|
18
|
+
isHorizontal
|
|
19
|
+
});
|
|
20
|
+
return result.map((item)=>dataTransform.processNodeInfo(item, contextConfig.nodeMap));
|
|
21
|
+
}, [
|
|
22
|
+
data,
|
|
23
|
+
x,
|
|
24
|
+
y,
|
|
25
|
+
isDescend,
|
|
26
|
+
isHorizontal,
|
|
27
|
+
dataTransform,
|
|
28
|
+
contextConfig.nodeMap
|
|
29
|
+
]);
|
|
30
|
+
const maxY = useMemo(()=>{
|
|
31
|
+
const values = transformedData.filter((item)=>'-' !== item[y] && void 0 !== item[y] && null !== item[y]).map((item)=>Number(item[y]) || 0);
|
|
32
|
+
return values.length > 0 ? Math.max(...values) : 0;
|
|
33
|
+
}, [
|
|
34
|
+
transformedData,
|
|
35
|
+
y
|
|
36
|
+
]);
|
|
37
|
+
const containerRef = useRef(null);
|
|
38
|
+
const chartRef = useRef(null);
|
|
39
|
+
useEffect(()=>{
|
|
40
|
+
if (!containerRef.current || !transformedData.length) return;
|
|
41
|
+
if (chartRef.current) chartRef.current.destroy();
|
|
42
|
+
const chart = new Chart({
|
|
43
|
+
container: containerRef.current,
|
|
44
|
+
autoFit: true,
|
|
45
|
+
height: height
|
|
46
|
+
});
|
|
47
|
+
chart.data(transformedData);
|
|
48
|
+
if (isHorizontal) chart.coordinate({
|
|
49
|
+
transform: [
|
|
50
|
+
{
|
|
51
|
+
type: 'transpose'
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
});
|
|
55
|
+
chart.scale({
|
|
56
|
+
[y]: {
|
|
57
|
+
nice: true,
|
|
58
|
+
min: 0,
|
|
59
|
+
max: maxY
|
|
60
|
+
},
|
|
61
|
+
[x]: {
|
|
62
|
+
type: 'cat'
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
if (safeLegend && false !== chartConfig.isLegend) chart.legend(safeLegend, {
|
|
66
|
+
position: 'top'
|
|
67
|
+
});
|
|
68
|
+
chart.interaction('poptip', true);
|
|
69
|
+
const interval = chart.interval().encode('x', x).encode('y', y);
|
|
70
|
+
if (safeLegend) interval.encode('color', safeLegend);
|
|
71
|
+
if (isDataTag) interval.label({
|
|
72
|
+
text: (d)=>formatter.formatIndicator(d[y], safeIndicatorMap[y]),
|
|
73
|
+
position: isHorizontal ? 'right' : 'top',
|
|
74
|
+
offset: 5
|
|
75
|
+
});
|
|
76
|
+
chart.render();
|
|
77
|
+
chartRef.current = chart;
|
|
78
|
+
return ()=>{
|
|
79
|
+
if (chartRef.current) {
|
|
80
|
+
chartRef.current.destroy();
|
|
81
|
+
chartRef.current = null;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}, [
|
|
85
|
+
transformedData,
|
|
86
|
+
height,
|
|
87
|
+
x,
|
|
88
|
+
y,
|
|
89
|
+
safeLegend,
|
|
90
|
+
isHorizontal,
|
|
91
|
+
isDataTag,
|
|
92
|
+
maxY,
|
|
93
|
+
chartConfig.isLegend,
|
|
94
|
+
safeIndicatorMap,
|
|
95
|
+
formatter,
|
|
96
|
+
onChartClick
|
|
97
|
+
]);
|
|
98
|
+
return /*#__PURE__*/ jsx("div", {
|
|
99
|
+
ref: containerRef,
|
|
100
|
+
style: {
|
|
101
|
+
width: '100%',
|
|
102
|
+
height: `${height}px`
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
const base_G2BarChart = G2BarChart;
|
|
107
|
+
export { base_G2BarChart as default };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* G2@5 仪表盘(Gauge)图表组件
|
|
3
|
+
* 支持自定义 scale 和阈值区间,可基于目标值设置刻度
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
export interface G2GaugeChartProps {
|
|
7
|
+
/** 当前值 */
|
|
8
|
+
value: number;
|
|
9
|
+
/** 最小值 */
|
|
10
|
+
min?: number;
|
|
11
|
+
/** 最大值 */
|
|
12
|
+
max: number;
|
|
13
|
+
/** 目标值(用于设置阈值区间和刻度) */
|
|
14
|
+
target?: number;
|
|
15
|
+
/** 自定义阈值区间配置(优先级高于 target) */
|
|
16
|
+
thresholds?: number[] | Array<{
|
|
17
|
+
/** 阈值点 */
|
|
18
|
+
value: number;
|
|
19
|
+
/** 区间颜色 */
|
|
20
|
+
color: string;
|
|
21
|
+
}>;
|
|
22
|
+
/** 自定义刻度点(优先级高于 target) */
|
|
23
|
+
ticks?: number[];
|
|
24
|
+
/** 图表高度 */
|
|
25
|
+
height?: number;
|
|
26
|
+
/** 是否显示百分比 */
|
|
27
|
+
showPercent?: boolean;
|
|
28
|
+
/** 自定义格式化函数 */
|
|
29
|
+
formatter?: (value: number, percent: number) => string;
|
|
30
|
+
/** 刻度标签格式化函数(用于格式化刻度上的数值,如 100000 -> "100.00k") */
|
|
31
|
+
tickFormatter?: (value: number) => string;
|
|
32
|
+
/** 指针颜色 */
|
|
33
|
+
pointerColor?: string;
|
|
34
|
+
/** 阈值颜色数组 */
|
|
35
|
+
thresholdColors?: string[];
|
|
36
|
+
}
|
|
37
|
+
declare const G2GaugeChart: React.FC<G2GaugeChartProps>;
|
|
38
|
+
export default G2GaugeChart;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* G2 Gauge 图表使用示例
|
|
3
|
+
* 展示如何自定义 scale 和阈值区间
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
export declare const Example1_TargetBased: React.FC;
|
|
7
|
+
export declare const Example2_CustomThresholds: React.FC;
|
|
8
|
+
export declare const Example3_CustomThresholdsWithColors: React.FC;
|
|
9
|
+
export declare const Example4_TargetWithCustomScale: React.FC;
|
|
10
|
+
export declare const Example5_Simple: React.FC;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import G2GaugeChart from "./G2GaugeChart.js";
|
|
4
|
+
const Example1_TargetBased = ()=>/*#__PURE__*/ jsx(G2GaugeChart, {
|
|
5
|
+
value: 147530,
|
|
6
|
+
min: 0,
|
|
7
|
+
max: 200000,
|
|
8
|
+
target: 160000,
|
|
9
|
+
showPercent: true
|
|
10
|
+
});
|
|
11
|
+
const Example2_CustomThresholds = ()=>/*#__PURE__*/ jsx(G2GaugeChart, {
|
|
12
|
+
value: 147530,
|
|
13
|
+
min: 0,
|
|
14
|
+
max: 200000,
|
|
15
|
+
thresholds: [
|
|
16
|
+
60000,
|
|
17
|
+
120000,
|
|
18
|
+
180000
|
|
19
|
+
],
|
|
20
|
+
thresholdColors: [
|
|
21
|
+
'#FF4D4F',
|
|
22
|
+
'#FFA940',
|
|
23
|
+
'#FFC53D',
|
|
24
|
+
'#52C41A'
|
|
25
|
+
],
|
|
26
|
+
ticks: [
|
|
27
|
+
0,
|
|
28
|
+
50000,
|
|
29
|
+
100000,
|
|
30
|
+
150000,
|
|
31
|
+
200000
|
|
32
|
+
],
|
|
33
|
+
showPercent: true
|
|
34
|
+
});
|
|
35
|
+
const Example3_CustomThresholdsWithColors = ()=>/*#__PURE__*/ jsx(G2GaugeChart, {
|
|
36
|
+
value: 147530,
|
|
37
|
+
min: 0,
|
|
38
|
+
max: 200000,
|
|
39
|
+
thresholds: [
|
|
40
|
+
{
|
|
41
|
+
value: 50000,
|
|
42
|
+
color: '#FF4D4F'
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
value: 100000,
|
|
46
|
+
color: '#FFA940'
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
value: 150000,
|
|
50
|
+
color: '#FFC53D'
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
value: 200000,
|
|
54
|
+
color: '#52C41A'
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
ticks: [
|
|
58
|
+
0,
|
|
59
|
+
50000,
|
|
60
|
+
100000,
|
|
61
|
+
150000,
|
|
62
|
+
200000
|
|
63
|
+
],
|
|
64
|
+
showPercent: true
|
|
65
|
+
});
|
|
66
|
+
const Example4_TargetWithCustomScale = ()=>{
|
|
67
|
+
const max = 200000;
|
|
68
|
+
const target = 160000;
|
|
69
|
+
return /*#__PURE__*/ jsx(G2GaugeChart, {
|
|
70
|
+
value: 147530,
|
|
71
|
+
min: 0,
|
|
72
|
+
max: max,
|
|
73
|
+
target: target,
|
|
74
|
+
thresholdColors: [
|
|
75
|
+
'#FF4D4F',
|
|
76
|
+
'#FFA940',
|
|
77
|
+
'#FFC53D',
|
|
78
|
+
'#52C41A'
|
|
79
|
+
],
|
|
80
|
+
formatter: (value, percent)=>`${value}\n完成度: ${percent.toFixed(1)}%`
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
const Example5_Simple = ()=>/*#__PURE__*/ jsx(G2GaugeChart, {
|
|
84
|
+
value: 147530,
|
|
85
|
+
max: 200000,
|
|
86
|
+
showPercent: true
|
|
87
|
+
});
|
|
88
|
+
export { Example1_TargetBased, Example2_CustomThresholds, Example3_CustomThresholdsWithColors, Example4_TargetWithCustomScale, Example5_Simple };
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useRef } from "react";
|
|
3
|
+
import { Chart } from "@antv/g2";
|
|
4
|
+
const G2GaugeChart = ({ value, min = 0, max, target, thresholds, ticks, height = 300, showPercent = true, formatter, tickFormatter, thresholdColors = [
|
|
5
|
+
'#F4664A',
|
|
6
|
+
'#FAAD14',
|
|
7
|
+
'#52C41A'
|
|
8
|
+
] })=>{
|
|
9
|
+
const containerRef = useRef(null);
|
|
10
|
+
const chartRef = useRef(null);
|
|
11
|
+
const scaleTicks = useMemo(()=>{
|
|
12
|
+
if (ticks && ticks.length > 0) return ticks;
|
|
13
|
+
if (target) return [
|
|
14
|
+
min,
|
|
15
|
+
Math.round(0.5 * target),
|
|
16
|
+
target,
|
|
17
|
+
Math.round(0.9 * max),
|
|
18
|
+
max
|
|
19
|
+
];
|
|
20
|
+
const step = (max - min) / 4;
|
|
21
|
+
return [
|
|
22
|
+
min,
|
|
23
|
+
Math.round(min + step),
|
|
24
|
+
Math.round(min + 2 * step),
|
|
25
|
+
Math.round(min + 3 * step),
|
|
26
|
+
max
|
|
27
|
+
];
|
|
28
|
+
}, [
|
|
29
|
+
min,
|
|
30
|
+
max,
|
|
31
|
+
target,
|
|
32
|
+
ticks
|
|
33
|
+
]);
|
|
34
|
+
const thresholdValues = useMemo(()=>{
|
|
35
|
+
if (thresholds) {
|
|
36
|
+
if (Array.isArray(thresholds) && thresholds.length > 0 && 'number' == typeof thresholds[0]) return thresholds;
|
|
37
|
+
if (Array.isArray(thresholds) && thresholds.length > 0 && 'object' == typeof thresholds[0]) return thresholds.map((t)=>t.value);
|
|
38
|
+
}
|
|
39
|
+
if (target) return [
|
|
40
|
+
Math.round(0.6 * target),
|
|
41
|
+
Math.round(0.9 * target),
|
|
42
|
+
target
|
|
43
|
+
];
|
|
44
|
+
const step = (max - min) / 3;
|
|
45
|
+
return [
|
|
46
|
+
Math.round(min + step),
|
|
47
|
+
Math.round(min + 2 * step),
|
|
48
|
+
max
|
|
49
|
+
];
|
|
50
|
+
}, [
|
|
51
|
+
min,
|
|
52
|
+
max,
|
|
53
|
+
target,
|
|
54
|
+
thresholds
|
|
55
|
+
]);
|
|
56
|
+
const thresholdColorArray = useMemo(()=>{
|
|
57
|
+
if (thresholds && Array.isArray(thresholds) && thresholds.length > 0 && 'object' == typeof thresholds[0]) return thresholds.map((t)=>t.color);
|
|
58
|
+
return thresholdColors;
|
|
59
|
+
}, [
|
|
60
|
+
thresholds,
|
|
61
|
+
thresholdColors
|
|
62
|
+
]);
|
|
63
|
+
useEffect(()=>{
|
|
64
|
+
if (!containerRef.current) return;
|
|
65
|
+
if (chartRef.current) chartRef.current.destroy();
|
|
66
|
+
const chart = new Chart({
|
|
67
|
+
container: containerRef.current,
|
|
68
|
+
autoFit: true,
|
|
69
|
+
height: height
|
|
70
|
+
});
|
|
71
|
+
chart.options({
|
|
72
|
+
type: 'gauge',
|
|
73
|
+
data: {
|
|
74
|
+
value: {
|
|
75
|
+
target: value,
|
|
76
|
+
total: max,
|
|
77
|
+
name: 'value',
|
|
78
|
+
thresholds: thresholdValues
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
scale: {
|
|
82
|
+
color: {
|
|
83
|
+
range: thresholdColorArray
|
|
84
|
+
},
|
|
85
|
+
value: {
|
|
86
|
+
formatter: tickFormatter || ((d)=>{
|
|
87
|
+
const matchedTick = scaleTicks.find((tick)=>Math.abs(d - tick) < 0.01);
|
|
88
|
+
return void 0 !== matchedTick ? String(matchedTick) : '';
|
|
89
|
+
}),
|
|
90
|
+
domain: [
|
|
91
|
+
min,
|
|
92
|
+
max
|
|
93
|
+
],
|
|
94
|
+
tickCount: scaleTicks.length,
|
|
95
|
+
ticks: scaleTicks
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
style: {
|
|
99
|
+
textContent: (target, total)=>{
|
|
100
|
+
const percent = (target / total * 100).toFixed(3);
|
|
101
|
+
if (formatter) return formatter(target, parseFloat(percent));
|
|
102
|
+
return showPercent ? `${target}\n占比: ${percent}%` : String(target);
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
legend: false
|
|
106
|
+
});
|
|
107
|
+
chart.render();
|
|
108
|
+
chartRef.current = chart;
|
|
109
|
+
return ()=>{
|
|
110
|
+
if (chartRef.current) {
|
|
111
|
+
chartRef.current.destroy();
|
|
112
|
+
chartRef.current = null;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}, [
|
|
116
|
+
value,
|
|
117
|
+
min,
|
|
118
|
+
max,
|
|
119
|
+
target,
|
|
120
|
+
thresholdValues,
|
|
121
|
+
thresholdColorArray,
|
|
122
|
+
scaleTicks,
|
|
123
|
+
height,
|
|
124
|
+
showPercent,
|
|
125
|
+
formatter,
|
|
126
|
+
tickFormatter
|
|
127
|
+
]);
|
|
128
|
+
return /*#__PURE__*/ jsx("div", {
|
|
129
|
+
ref: containerRef,
|
|
130
|
+
style: {
|
|
131
|
+
width: '100%',
|
|
132
|
+
height: `${height}px`
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
const base_G2GaugeChart = G2GaugeChart;
|
|
137
|
+
export { base_G2GaugeChart as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,9 @@ export { default as GroupLine } from './components/composite/GroupLine';
|
|
|
20
20
|
export { default as GroupLineCompare } from './components/composite/GroupLineCompare';
|
|
21
21
|
export { default as MultipleLine } from './components/composite/MultipleLine';
|
|
22
22
|
export { default as MultipleCompareLine } from './components/composite/MultipleCompareLine';
|
|
23
|
+
export { default as G2BarChart } from './components/g2/base/G2BarChart';
|
|
24
|
+
export { default as G2GaugeChart } from './components/g2/base/G2GaugeChart';
|
|
25
|
+
export type { G2GaugeChartProps } from './components/g2/base/G2GaugeChart';
|
|
23
26
|
export { createLazyComponent, createLazyComponents } from './utils/lazyHelpers';
|
|
24
27
|
export { TypeAdapter } from './adapters/TypeAdapter';
|
|
25
28
|
export { DataAdapter } from './adapters/DataAdapter';
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,8 @@ import GroupLine from "./components/composite/GroupLine.js";
|
|
|
14
14
|
import GroupLineCompare from "./components/composite/GroupLineCompare.js";
|
|
15
15
|
import MultipleLine from "./components/composite/MultipleLine.js";
|
|
16
16
|
import MultipleCompareLine from "./components/composite/MultipleCompareLine.js";
|
|
17
|
+
import G2BarChart from "./components/g2/base/G2BarChart.js";
|
|
18
|
+
import G2GaugeChart from "./components/g2/base/G2GaugeChart.js";
|
|
17
19
|
import { createLazyComponent, createLazyComponents } from "./utils/lazyHelpers.js";
|
|
18
20
|
import { TypeAdapter } from "./adapters/TypeAdapter.js";
|
|
19
21
|
import { DataAdapter } from "./adapters/DataAdapter.js";
|
|
@@ -23,4 +25,4 @@ import { BigNumberUtil, formatBigNumber, formatIndicatorV2, formatNumberV2, form
|
|
|
23
25
|
import { calTextWidth, calculateBarWidth, createStripePatternCanvas, getAxisFormat, getAxisHorPaddingByText, markerStyle, truncateText } from "./utils/chartHelpers.js";
|
|
24
26
|
import { getIntervalRatio, groupArray, transformIndicatorList } from "./utils/dataTransform.js";
|
|
25
27
|
import { getIndicator, getIndicatorCompareName, getIndicatorName } from "./utils/indicatorHelpers.js";
|
|
26
|
-
export { AuxiliaryLine, BarChart, BarLineAdapter, BarLineChart, BarLineCompareWeekend, BigNumberUtil, ChartProvider, DataAdapter, DefaultDataTransformService, DefaultFormatterService, GroupBar, GroupBarLine, GroupCompare, GroupLine, GroupLineCompare, LineChart, MultipleCompareLine, MultipleLine, TypeAdapter, XAxisBackground, calTextWidth, calculateBarWidth, createDataTransformService, createFormatterService, createLazyComponent, createLazyComponents, createStripePatternCanvas, defaultChartConfig, formatBigNumber, formatIndicatorV2, formatNumberV2, formatPercentage, getAxisFormat, getAxisFormatFromContext, getAxisHorPaddingByText, getIndicator, getIndicatorCompareName, getIndicatorName, getIntervalRatio, getThemeColors, groupArray, markerStyle, mergeChartConfig, transformIndicatorList, truncateText, useChartContext };
|
|
28
|
+
export { AuxiliaryLine, BarChart, BarLineAdapter, BarLineChart, BarLineCompareWeekend, BigNumberUtil, ChartProvider, DataAdapter, DefaultDataTransformService, DefaultFormatterService, G2BarChart, G2GaugeChart, GroupBar, GroupBarLine, GroupCompare, GroupLine, GroupLineCompare, LineChart, MultipleCompareLine, MultipleLine, TypeAdapter, XAxisBackground, calTextWidth, calculateBarWidth, createDataTransformService, createFormatterService, createLazyComponent, createLazyComponents, createStripePatternCanvas, defaultChartConfig, formatBigNumber, formatIndicatorV2, formatNumberV2, formatPercentage, getAxisFormat, getAxisFormatFromContext, getAxisHorPaddingByText, getIndicator, getIndicatorCompareName, getIndicatorName, getIntervalRatio, getThemeColors, groupArray, markerStyle, mergeChartConfig, transformIndicatorList, truncateText, useChartContext };
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* 创建 lazy 组件(从命名导出)
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
|
-
* const BarChart = createLazyComponent(() => import('@
|
|
9
|
+
* const BarChart = createLazyComponent(() => import('@publishfx/publish-chart'), 'BarChart');
|
|
10
10
|
*/
|
|
11
11
|
export declare function createLazyComponent<T = any>(importFn: () => Promise<{
|
|
12
12
|
[key: string]: T;
|
|
@@ -18,7 +18,7 @@ export declare function createLazyComponent<T = any>(importFn: () => Promise<{
|
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* const { BarChart, LineChart } = createLazyComponents(
|
|
21
|
-
* () => import('@
|
|
21
|
+
* () => import('@publishfx/publish-chart'),
|
|
22
22
|
* ['BarChart', 'LineChart']
|
|
23
23
|
* );
|
|
24
24
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@publishfx/publish-chart",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.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": [
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@antv/data-set": "^0.11.8",
|
|
29
|
+
"@antv/g2": "^5.3.0",
|
|
29
30
|
"@types/jest": "^29.5.12",
|
|
30
31
|
"@types/lodash": "^4.17.20",
|
|
31
32
|
"@types/react": "^18.3.18",
|
|
@@ -44,10 +45,11 @@
|
|
|
44
45
|
"styled-components": "^5.3.11",
|
|
45
46
|
"ts-jest": "^29.1.2",
|
|
46
47
|
"typescript": "^5.9.3",
|
|
47
|
-
"@publishfx/publish-components": "^2.0
|
|
48
|
+
"@publishfx/publish-components": "^2.1.0"
|
|
48
49
|
},
|
|
49
50
|
"peerDependencies": {
|
|
50
51
|
"@antv/data-set": "^0.11.8",
|
|
52
|
+
"@antv/g2": "^5.3.0",
|
|
51
53
|
"@arco-design/web-react": "^2.66.0",
|
|
52
54
|
"@types/react": "^18.3.18",
|
|
53
55
|
"@types/react-dom": "^18.3.5",
|