@aura-react-comp/charts 0.2.0 → 0.4.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/esm/charts/area-chart/index.d.ts +2 -2
- package/esm/charts/area-chart/index.js +28 -23
- package/esm/charts/bar-chart/index.d.ts +1 -1
- package/esm/charts/bar-chart/index.js +18 -21
- package/esm/charts/candlestick-chart/index.d.ts +2 -2
- package/esm/charts/candlestick-chart/index.js +243 -180
- package/esm/charts/combo-chart/index.d.ts +1 -1
- package/esm/charts/combo-chart/index.js +9 -20
- package/esm/charts/funnel-chart/index.d.ts +2 -2
- package/esm/charts/funnel-chart/index.js +134 -108
- package/esm/charts/gauge-chart/index.d.ts +1 -1
- package/esm/charts/gauge-chart/index.js +103 -105
- package/esm/charts/graph-chart/index.d.ts +3 -3
- package/esm/charts/graph-chart/index.js +155 -114
- package/esm/charts/heatmap-chart/index.d.ts +2 -2
- package/esm/charts/heatmap-chart/index.js +180 -135
- package/esm/charts/line-chart/index.d.ts +2 -2
- package/esm/charts/line-chart/index.js +29 -24
- package/esm/charts/pie-chart/index.d.ts +2 -2
- package/esm/charts/pie-chart/index.d.ts.map +1 -1
- package/esm/charts/pie-chart/index.js +199 -139
- package/esm/charts/radar-chart/index.d.ts +2 -2
- package/esm/charts/radar-chart/index.d.ts.map +1 -1
- package/esm/charts/radar-chart/index.js +155 -128
- package/esm/charts/ring-progress/index.d.ts +1 -1
- package/esm/charts/ring-progress/index.js +82 -82
- package/esm/charts/sankey-chart/index.d.ts +3 -3
- package/esm/charts/sankey-chart/index.js +172 -141
- package/esm/charts/scatter-chart/index.d.ts +3 -3
- package/esm/charts/scatter-chart/index.d.ts.map +1 -1
- package/esm/charts/scatter-chart/index.js +226 -159
- package/esm/charts/sparkline/index.d.ts +1 -1
- package/esm/charts/sparkline/index.js +82 -66
- package/esm/charts/tree-chart/index.d.ts +3 -3
- package/esm/charts/tree-chart/index.js +129 -102
- package/esm/charts/treemap-chart/index.d.ts +3 -3
- package/esm/charts/treemap-chart/index.js +163 -141
- package/esm/charts/waterfall-chart/index.d.ts +2 -2
- package/esm/charts/waterfall-chart/index.js +166 -121
- package/esm/components/Legend.d.ts +5 -4
- package/esm/components/Legend.d.ts.map +1 -1
- package/esm/components/Legend.js +80 -48
- package/esm/components/Tooltip.d.ts +2 -2
- package/esm/components/Tooltip.js +63 -71
- package/esm/components/chart/index.d.ts +5 -2
- package/esm/components/chart/index.d.ts.map +1 -1
- package/esm/components/chart/index.js +81 -102
- package/esm/components/chart.less +13 -0
- package/esm/core/animation.js +32 -43
- package/esm/core/export.d.ts +34 -0
- package/esm/core/export.d.ts.map +1 -0
- package/esm/core/export.js +390 -0
- package/esm/core/force.js +23 -45
- package/esm/core/format.js +49 -52
- package/esm/core/hierarchy.d.ts +1 -1
- package/esm/core/hierarchy.js +61 -92
- package/esm/core/layout.d.ts +1 -1
- package/esm/core/layout.js +33 -50
- package/esm/core/sampling.js +31 -53
- package/esm/core/sankey.js +36 -55
- package/esm/core/scale.js +73 -86
- package/esm/core/shape.js +102 -133
- package/esm/core/sync.d.ts +41 -0
- package/esm/core/sync.d.ts.map +1 -0
- package/esm/core/sync.js +120 -0
- package/esm/hooks/useChartExport.d.ts +19 -0
- package/esm/hooks/useChartExport.d.ts.map +1 -0
- package/esm/hooks/useChartExport.js +35 -0
- package/esm/hooks/useChartTheme.d.ts +6 -5
- package/esm/hooks/useChartTheme.d.ts.map +1 -1
- package/esm/hooks/useChartTheme.js +18 -18
- package/esm/hooks/useChartTransition.d.ts +1 -1
- package/esm/hooks/useChartTransition.js +59 -73
- package/esm/hooks/useElementSize.js +20 -28
- package/esm/hooks/usePlotPointer.d.ts +23 -0
- package/esm/hooks/usePlotPointer.d.ts.map +1 -0
- package/esm/hooks/usePlotPointer.js +94 -0
- package/esm/index.d.ts +56 -50
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +137 -47
- package/esm/internal/CartesianChart.d.ts +1 -1
- package/esm/internal/CartesianChart.d.ts.map +1 -1
- package/esm/internal/CartesianChart.js +667 -485
- package/esm/internal/model.d.ts +2 -2
- package/esm/internal/model.js +45 -60
- package/esm/scene/canvas.d.ts +1 -1
- package/esm/scene/canvas.js +101 -107
- package/esm/scene/svg.d.ts +1 -1
- package/esm/scene/svg.js +107 -99
- package/esm/scene/types.js +9 -15
- package/esm/style.css +10 -0
- package/esm/theme/index.d.ts +2 -2
- package/esm/theme/index.d.ts.map +1 -1
- package/esm/theme/index.js +145 -170
- package/esm/types.d.ts +7 -3
- package/esm/types.d.ts.map +1 -1
- package/esm/types.js +1 -1
- package/package.json +2 -2
|
@@ -1,119 +1,105 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
// src/hooks/useChartTransition.ts
|
|
3
|
+
import { useEffect, useReducer, useRef } from "react";
|
|
2
4
|
import { hashMatrix } from "../core/animation";
|
|
3
5
|
function prefersReducedMotion() {
|
|
4
|
-
if (typeof window ===
|
|
5
|
-
|
|
6
|
+
if (typeof window === "undefined" || !window.matchMedia)
|
|
7
|
+
return false;
|
|
8
|
+
return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
6
9
|
}
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 图表动画状态机。
|
|
10
|
-
*
|
|
11
|
-
* 只做两件事,且两者互斥,避免叠加出双重缓动:
|
|
12
|
-
* · **首次挂载** → 推进 `progress`(0→1),数值保持目标值,
|
|
13
|
-
* 由各图表用 staggerProgress 把 progress 映射成逐图元的位置;
|
|
14
|
-
* · **数据更新** → `progress` 恒为 1,改为在「当前显示值 → 新值」之间插值。
|
|
15
|
-
*
|
|
16
|
-
* 之前每次数据变化都重播入场,是「生硬」观感的主要来源:
|
|
17
|
-
* 用户改一个数字,整张图却从头长一遍。
|
|
18
|
-
*/
|
|
19
|
-
export function useChartTransition(matrix, animation) {
|
|
10
|
+
function useChartTransition(matrix, animation) {
|
|
20
11
|
const hash = hashMatrix(matrix);
|
|
21
12
|
const displayRef = useRef(matrix);
|
|
22
13
|
const progressRef = useRef(0);
|
|
23
14
|
const mountedRef = useRef(false);
|
|
24
|
-
const [, forceRender] = useReducer(tick => tick + 1, 0);
|
|
15
|
+
const [, forceRender] = useReducer((tick) => tick + 1, 0);
|
|
25
16
|
useEffect(() => {
|
|
26
|
-
/** 直接落到终态:无动画、时长非法、命中「减少动态效果」偏好、环境无 rAF */
|
|
27
17
|
const settle = () => {
|
|
28
18
|
displayRef.current = matrix;
|
|
29
19
|
progressRef.current = 1;
|
|
30
20
|
mountedRef.current = true;
|
|
31
21
|
forceRender();
|
|
32
22
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// 此时推进动画既无意义,还可能让图表停在起始帧
|
|
36
|
-
const hidden = typeof document !== 'undefined' && document.visibilityState === 'hidden';
|
|
37
|
-
if (!animation.enabled || animation.duration <= 0 || prefersReducedMotion() || hidden || typeof requestAnimationFrame === 'undefined') {
|
|
23
|
+
const hidden = typeof document !== "undefined" && document.visibilityState === "hidden";
|
|
24
|
+
if (!animation.enabled || animation.duration <= 0 || prefersReducedMotion() || hidden || typeof requestAnimationFrame === "undefined") {
|
|
38
25
|
settle();
|
|
39
|
-
return
|
|
26
|
+
return void 0;
|
|
40
27
|
}
|
|
41
28
|
const entering = !mountedRef.current;
|
|
42
29
|
mountedRef.current = true;
|
|
43
30
|
const from = entering ? matrix : displayRef.current;
|
|
44
31
|
const to = matrix;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
* 硬插值会让图「从 0 长出来」,比直接切换更难看。
|
|
50
|
-
*/
|
|
51
|
-
const sameShape = from.length === to.length && to.every((row, index) => row.length === (from[index]?.length ?? -1));
|
|
32
|
+
const sameShape = from.length === to.length && to.every((row, index) => {
|
|
33
|
+
var _a;
|
|
34
|
+
return row.length === (((_a = from[index]) == null ? void 0 : _a.length) ?? -1);
|
|
35
|
+
});
|
|
52
36
|
if (entering) {
|
|
53
37
|
progressRef.current = 0;
|
|
54
38
|
} else if (!sameShape) {
|
|
55
39
|
displayRef.current = to;
|
|
56
40
|
progressRef.current = 1;
|
|
57
41
|
forceRender();
|
|
58
|
-
return
|
|
42
|
+
return void 0;
|
|
59
43
|
}
|
|
60
44
|
let frame = 0;
|
|
61
45
|
let cancelled = false;
|
|
62
|
-
/**
|
|
63
|
-
* 时间基准用 Date.now()(墙钟)。
|
|
64
|
-
*
|
|
65
|
-
* 试过 rAF 回调的时间戳与 performance.now():浏览器里两者同源,
|
|
66
|
-
* 但 jsdom 等测试环境的时钟是冻结的,每帧拿到同一个值,
|
|
67
|
-
* 进度会永远停在 0 —— 动画在测试里完全不推进,也就无法断言。
|
|
68
|
-
* 600ms 量级用 1ms 精度完全够。
|
|
69
|
-
*/
|
|
70
46
|
const startAt = Date.now() + animation.delay;
|
|
71
47
|
const tick = () => {
|
|
72
|
-
if (cancelled)
|
|
73
|
-
|
|
48
|
+
if (cancelled)
|
|
49
|
+
return;
|
|
50
|
+
const raw = Math.max(
|
|
51
|
+
0,
|
|
52
|
+
Math.min(1, (Date.now() - startAt) / animation.duration)
|
|
53
|
+
);
|
|
74
54
|
const eased = animation.ease(raw);
|
|
75
55
|
if (entering) {
|
|
76
|
-
// 入场:只推进进度,数值就是目标值
|
|
77
56
|
progressRef.current = eased;
|
|
78
57
|
displayRef.current = to;
|
|
79
58
|
} else {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
59
|
+
displayRef.current = to.map(
|
|
60
|
+
(row, rowIndex) => row.map((target, columnIndex) => {
|
|
61
|
+
var _a;
|
|
62
|
+
const previous = ((_a = from[rowIndex]) == null ? void 0 : _a[columnIndex]) ?? target ?? 0;
|
|
63
|
+
if (target === null)
|
|
64
|
+
return previous === null ? null : previous;
|
|
65
|
+
if (previous === null)
|
|
66
|
+
return target;
|
|
67
|
+
return previous + (target - previous) * eased;
|
|
68
|
+
})
|
|
69
|
+
);
|
|
87
70
|
progressRef.current = 1;
|
|
88
71
|
}
|
|
89
72
|
forceRender();
|
|
90
|
-
if (raw < 1)
|
|
73
|
+
if (raw < 1)
|
|
74
|
+
frame = requestAnimationFrame(tick);
|
|
91
75
|
};
|
|
92
76
|
frame = requestAnimationFrame(tick);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
displayRef.current = to;
|
|
105
|
-
forceRender();
|
|
106
|
-
}, animation.delay + animation.duration + 100);
|
|
77
|
+
const failsafe = setTimeout(
|
|
78
|
+
() => {
|
|
79
|
+
if (cancelled)
|
|
80
|
+
return;
|
|
81
|
+
cancelled = true;
|
|
82
|
+
progressRef.current = 1;
|
|
83
|
+
displayRef.current = to;
|
|
84
|
+
forceRender();
|
|
85
|
+
},
|
|
86
|
+
animation.delay + animation.duration + 100
|
|
87
|
+
);
|
|
107
88
|
return () => {
|
|
108
89
|
cancelled = true;
|
|
109
90
|
cancelAnimationFrame(frame);
|
|
110
91
|
clearTimeout(failsafe);
|
|
111
92
|
};
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
93
|
+
}, [
|
|
94
|
+
hash,
|
|
95
|
+
animation.enabled,
|
|
96
|
+
animation.duration,
|
|
97
|
+
animation.easing,
|
|
98
|
+
animation.stagger,
|
|
99
|
+
animation.delay
|
|
100
|
+
]);
|
|
101
|
+
return { values: displayRef.current, progress: progressRef.current };
|
|
102
|
+
}
|
|
103
|
+
export {
|
|
104
|
+
useChartTransition
|
|
105
|
+
};
|
|
@@ -1,46 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* 图表必须能跟随容器变化(响应式栅格里容器宽度是被父元素决定的),
|
|
6
|
-
* 因此不用 window.resize(弹窗/抽屉里不会触发),而用 ResizeObserver。
|
|
7
|
-
*/
|
|
8
|
-
export function useElementSize() {
|
|
1
|
+
'use client';
|
|
2
|
+
// src/hooks/useElementSize.ts
|
|
3
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
|
+
function useElementSize() {
|
|
9
5
|
const ref = useRef(null);
|
|
10
|
-
const [size, setSize] = useState({
|
|
11
|
-
width: 0,
|
|
12
|
-
height: 0
|
|
13
|
-
});
|
|
6
|
+
const [size, setSize] = useState({ width: 0, height: 0 });
|
|
14
7
|
const measure = useCallback(() => {
|
|
15
8
|
const element = ref.current;
|
|
16
|
-
if (!element)
|
|
9
|
+
if (!element)
|
|
10
|
+
return;
|
|
17
11
|
const rect = element.getBoundingClientRect();
|
|
18
|
-
setSize(prev => {
|
|
12
|
+
setSize((prev) => {
|
|
19
13
|
const next = {
|
|
20
14
|
width: Math.round(rect.width),
|
|
21
15
|
height: Math.round(rect.height)
|
|
22
16
|
};
|
|
23
|
-
// 尺寸未变时不触发渲染,避免 ResizeObserver 抖动导致的重绘风暴
|
|
24
17
|
return prev.width === next.width && prev.height === next.height ? prev : next;
|
|
25
18
|
});
|
|
26
19
|
}, []);
|
|
27
20
|
useEffect(() => {
|
|
28
21
|
measure();
|
|
29
|
-
if (typeof ResizeObserver ===
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
window.
|
|
33
|
-
return () => window.removeEventListener('resize', measure);
|
|
22
|
+
if (typeof ResizeObserver === "undefined") {
|
|
23
|
+
if (typeof window !== "undefined") {
|
|
24
|
+
window.addEventListener("resize", measure);
|
|
25
|
+
return () => window.removeEventListener("resize", measure);
|
|
34
26
|
}
|
|
35
|
-
return
|
|
27
|
+
return void 0;
|
|
36
28
|
}
|
|
37
29
|
const observer = new ResizeObserver(measure);
|
|
38
|
-
if (ref.current)
|
|
30
|
+
if (ref.current)
|
|
31
|
+
observer.observe(ref.current);
|
|
39
32
|
return () => observer.disconnect();
|
|
40
33
|
}, [measure]);
|
|
41
|
-
return {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
34
|
+
return { ref, size, measure };
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
useElementSize
|
|
38
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface UsePlotPointerOptions {
|
|
2
|
+
/** 命中更新回调,传入屏幕坐标 (clientX, clientY) */
|
|
3
|
+
onMove: (clientX: number, clientY: number) => void;
|
|
4
|
+
/** 离开 / 触摸结束清理回调 */
|
|
5
|
+
onLeave: () => void;
|
|
6
|
+
/** 是否禁用交互(例如空数据或关闭 tooltip) */
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 统一处理桌面指针与移动端触摸交互:
|
|
11
|
+
* - `pointermove` 跳过 `touch`(避免与触摸事件重复触发);
|
|
12
|
+
* - `touchstart` 立即响应,`touchmove` 经 `requestAnimationFrame` 按帧合流节流;
|
|
13
|
+
* - `touchend` / `touchcancel` 与卸载时自动取消挂起帧并优雅收尾。
|
|
14
|
+
*/
|
|
15
|
+
export declare function usePlotPointer({ onMove, onLeave, disabled, }: UsePlotPointerOptions): {
|
|
16
|
+
onPointerMove: (event: React.PointerEvent<HTMLDivElement>) => void;
|
|
17
|
+
onPointerLeave: () => void;
|
|
18
|
+
onTouchStart: (event: React.TouchEvent<HTMLDivElement>) => void;
|
|
19
|
+
onTouchMove: (event: React.TouchEvent<HTMLDivElement>) => void;
|
|
20
|
+
onTouchEnd: () => void;
|
|
21
|
+
onTouchCancel: () => void;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=usePlotPointer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePlotPointer.d.ts","sourceRoot":"","sources":["usePlotPointer.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,qBAAqB;IACpC,uCAAuC;IACvC,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,oBAAoB;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,OAAO,EACP,QAAgB,GACjB,EAAE,qBAAqB;2BAoBZ,kBAAkB,CAAC,cAAc,CAAC;;0BAalC,gBAAgB,CAAC,cAAc,CAAC;yBAWhC,gBAAgB,CAAC,cAAc,CAAC;;;EAqC3C"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
// src/hooks/usePlotPointer.ts
|
|
3
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
4
|
+
function usePlotPointer({
|
|
5
|
+
onMove,
|
|
6
|
+
onLeave,
|
|
7
|
+
disabled = false
|
|
8
|
+
}) {
|
|
9
|
+
const moveRef = useRef(onMove);
|
|
10
|
+
moveRef.current = onMove;
|
|
11
|
+
const leaveRef = useRef(onLeave);
|
|
12
|
+
leaveRef.current = onLeave;
|
|
13
|
+
const rafRef = useRef(null);
|
|
14
|
+
const pendingRef = useRef(null);
|
|
15
|
+
const cancelFrame = useCallback(() => {
|
|
16
|
+
if (rafRef.current !== null && typeof cancelAnimationFrame === "function") {
|
|
17
|
+
cancelAnimationFrame(rafRef.current);
|
|
18
|
+
}
|
|
19
|
+
rafRef.current = null;
|
|
20
|
+
pendingRef.current = null;
|
|
21
|
+
}, []);
|
|
22
|
+
useEffect(() => cancelFrame, [cancelFrame]);
|
|
23
|
+
const onPointerMove = useCallback(
|
|
24
|
+
(event) => {
|
|
25
|
+
if (disabled || event.pointerType === "touch")
|
|
26
|
+
return;
|
|
27
|
+
moveRef.current(event.clientX, event.clientY);
|
|
28
|
+
},
|
|
29
|
+
[disabled]
|
|
30
|
+
);
|
|
31
|
+
const onPointerLeave = useCallback(() => {
|
|
32
|
+
if (disabled)
|
|
33
|
+
return;
|
|
34
|
+
leaveRef.current();
|
|
35
|
+
}, [disabled]);
|
|
36
|
+
const onTouchStart = useCallback(
|
|
37
|
+
(event) => {
|
|
38
|
+
var _a;
|
|
39
|
+
if (disabled)
|
|
40
|
+
return;
|
|
41
|
+
const touch = (_a = event.touches) == null ? void 0 : _a[0];
|
|
42
|
+
if (!touch)
|
|
43
|
+
return;
|
|
44
|
+
cancelFrame();
|
|
45
|
+
moveRef.current(touch.clientX, touch.clientY);
|
|
46
|
+
},
|
|
47
|
+
[disabled, cancelFrame]
|
|
48
|
+
);
|
|
49
|
+
const onTouchMove = useCallback(
|
|
50
|
+
(event) => {
|
|
51
|
+
var _a;
|
|
52
|
+
if (disabled)
|
|
53
|
+
return;
|
|
54
|
+
const touch = (_a = event.touches) == null ? void 0 : _a[0];
|
|
55
|
+
if (!touch)
|
|
56
|
+
return;
|
|
57
|
+
pendingRef.current = { x: touch.clientX, y: touch.clientY };
|
|
58
|
+
if (rafRef.current !== null)
|
|
59
|
+
return;
|
|
60
|
+
if (typeof requestAnimationFrame === "function") {
|
|
61
|
+
rafRef.current = requestAnimationFrame(() => {
|
|
62
|
+
rafRef.current = null;
|
|
63
|
+
const next = pendingRef.current;
|
|
64
|
+
pendingRef.current = null;
|
|
65
|
+
if (next)
|
|
66
|
+
moveRef.current(next.x, next.y);
|
|
67
|
+
});
|
|
68
|
+
} else {
|
|
69
|
+
const next = pendingRef.current;
|
|
70
|
+
pendingRef.current = null;
|
|
71
|
+
if (next)
|
|
72
|
+
moveRef.current(next.x, next.y);
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
[disabled]
|
|
76
|
+
);
|
|
77
|
+
const onTouchEnd = useCallback(() => {
|
|
78
|
+
cancelFrame();
|
|
79
|
+
if (disabled)
|
|
80
|
+
return;
|
|
81
|
+
leaveRef.current();
|
|
82
|
+
}, [disabled, cancelFrame]);
|
|
83
|
+
return {
|
|
84
|
+
onPointerMove,
|
|
85
|
+
onPointerLeave,
|
|
86
|
+
onTouchStart,
|
|
87
|
+
onTouchMove,
|
|
88
|
+
onTouchEnd,
|
|
89
|
+
onTouchCancel: onTouchEnd
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
export {
|
|
93
|
+
usePlotPointer
|
|
94
|
+
};
|
package/esm/index.d.ts
CHANGED
|
@@ -9,54 +9,60 @@
|
|
|
9
9
|
* · 主题工具(createChartTheme / readAuraTheme)—— 深度定制
|
|
10
10
|
* · 内核(scale / shape)—— 自建图表时的乐高积木
|
|
11
11
|
*/
|
|
12
|
-
export { LineChart } from './charts/line-chart';
|
|
13
|
-
export type { LineChartProps } from './charts/line-chart';
|
|
14
|
-
export { BarChart } from './charts/bar-chart';
|
|
15
|
-
export type { BarChartProps } from './charts/bar-chart';
|
|
16
|
-
export { AreaChart } from './charts/area-chart';
|
|
17
|
-
export type { AreaChartProps } from './charts/area-chart';
|
|
18
|
-
export { ComboChart } from './charts/combo-chart';
|
|
19
|
-
export type { ComboChartProps } from './charts/combo-chart';
|
|
20
|
-
export { ScatterChart } from './charts/scatter-chart';
|
|
21
|
-
export type { ScatterChartProps } from './charts/scatter-chart';
|
|
22
|
-
export { PieChart } from './charts/pie-chart';
|
|
23
|
-
export type { PieChartProps, PieDataItem } from './charts/pie-chart';
|
|
24
|
-
export { RadarChart } from './charts/radar-chart';
|
|
25
|
-
export type { RadarChartProps, RadarIndicator, RadarSeries, } from './charts/radar-chart';
|
|
26
|
-
export { GaugeChart } from './charts/gauge-chart';
|
|
27
|
-
export type { GaugeChartProps, GaugeRange } from './charts/gauge-chart';
|
|
28
|
-
export { FunnelChart } from './charts/funnel-chart';
|
|
29
|
-
export type { FunnelChartProps, FunnelDataItem } from './charts/funnel-chart';
|
|
30
|
-
export { RingProgress } from './charts/ring-progress';
|
|
31
|
-
export type { RingProgressProps } from './charts/ring-progress';
|
|
32
|
-
export { WaterfallChart } from './charts/waterfall-chart';
|
|
33
|
-
export type { WaterfallChartProps, WaterfallItem, } from './charts/waterfall-chart';
|
|
34
|
-
export { Sparkline } from './charts/sparkline';
|
|
35
|
-
export type { SparklineProps } from './charts/sparkline';
|
|
36
|
-
export { HeatmapChart } from './charts/heatmap-chart';
|
|
37
|
-
export type { HeatmapChartProps, HeatmapCell } from './charts/heatmap-chart';
|
|
38
|
-
export { CandlestickChart } from './charts/candlestick-chart';
|
|
39
|
-
export type { CandlestickChartProps, CandlestickItem, } from './charts/candlestick-chart';
|
|
40
|
-
export { TreemapChart } from './charts/treemap-chart';
|
|
41
|
-
export type { TreemapChartProps } from './charts/treemap-chart';
|
|
42
|
-
export { TreeChart } from './charts/tree-chart';
|
|
43
|
-
export type { TreeChartProps } from './charts/tree-chart';
|
|
44
|
-
export { SankeyChart } from './charts/sankey-chart';
|
|
45
|
-
export type { SankeyChartProps } from './charts/sankey-chart';
|
|
46
|
-
export { GraphChart } from './charts/graph-chart';
|
|
47
|
-
export type { GraphChartProps } from './charts/graph-chart';
|
|
48
|
-
export { Tooltip } from './components/Tooltip';
|
|
49
|
-
export { useElementSize } from './hooks/useElementSize';
|
|
50
|
-
export {
|
|
51
|
-
export type {
|
|
52
|
-
export
|
|
53
|
-
export {
|
|
54
|
-
export
|
|
55
|
-
export {
|
|
56
|
-
export
|
|
57
|
-
export {
|
|
58
|
-
export type {
|
|
59
|
-
export {
|
|
60
|
-
export {
|
|
61
|
-
export
|
|
12
|
+
export { LineChart } from './charts/line-chart/index.js';
|
|
13
|
+
export type { LineChartProps } from './charts/line-chart/index.js';
|
|
14
|
+
export { BarChart } from './charts/bar-chart/index.js';
|
|
15
|
+
export type { BarChartProps } from './charts/bar-chart/index.js';
|
|
16
|
+
export { AreaChart } from './charts/area-chart/index.js';
|
|
17
|
+
export type { AreaChartProps } from './charts/area-chart/index.js';
|
|
18
|
+
export { ComboChart } from './charts/combo-chart/index.js';
|
|
19
|
+
export type { ComboChartProps } from './charts/combo-chart/index.js';
|
|
20
|
+
export { ScatterChart } from './charts/scatter-chart/index.js';
|
|
21
|
+
export type { ScatterChartProps } from './charts/scatter-chart/index.js';
|
|
22
|
+
export { PieChart } from './charts/pie-chart/index.js';
|
|
23
|
+
export type { PieChartProps, PieDataItem } from './charts/pie-chart/index.js';
|
|
24
|
+
export { RadarChart } from './charts/radar-chart/index.js';
|
|
25
|
+
export type { RadarChartProps, RadarIndicator, RadarSeries, } from './charts/radar-chart/index.js';
|
|
26
|
+
export { GaugeChart } from './charts/gauge-chart/index.js';
|
|
27
|
+
export type { GaugeChartProps, GaugeRange } from './charts/gauge-chart/index.js';
|
|
28
|
+
export { FunnelChart } from './charts/funnel-chart/index.js';
|
|
29
|
+
export type { FunnelChartProps, FunnelDataItem } from './charts/funnel-chart/index.js';
|
|
30
|
+
export { RingProgress } from './charts/ring-progress/index.js';
|
|
31
|
+
export type { RingProgressProps } from './charts/ring-progress/index.js';
|
|
32
|
+
export { WaterfallChart } from './charts/waterfall-chart/index.js';
|
|
33
|
+
export type { WaterfallChartProps, WaterfallItem, } from './charts/waterfall-chart/index.js';
|
|
34
|
+
export { Sparkline } from './charts/sparkline/index.js';
|
|
35
|
+
export type { SparklineProps } from './charts/sparkline/index.js';
|
|
36
|
+
export { HeatmapChart } from './charts/heatmap-chart/index.js';
|
|
37
|
+
export type { HeatmapChartProps, HeatmapCell } from './charts/heatmap-chart/index.js';
|
|
38
|
+
export { CandlestickChart } from './charts/candlestick-chart/index.js';
|
|
39
|
+
export type { CandlestickChartProps, CandlestickItem, } from './charts/candlestick-chart/index.js';
|
|
40
|
+
export { TreemapChart } from './charts/treemap-chart/index.js';
|
|
41
|
+
export type { TreemapChartProps } from './charts/treemap-chart/index.js';
|
|
42
|
+
export { TreeChart } from './charts/tree-chart/index.js';
|
|
43
|
+
export type { TreeChartProps } from './charts/tree-chart/index.js';
|
|
44
|
+
export { SankeyChart } from './charts/sankey-chart/index.js';
|
|
45
|
+
export type { SankeyChartProps } from './charts/sankey-chart/index.js';
|
|
46
|
+
export { GraphChart } from './charts/graph-chart/index.js';
|
|
47
|
+
export type { GraphChartProps } from './charts/graph-chart/index.js';
|
|
48
|
+
export { Tooltip } from './components/Tooltip.js';
|
|
49
|
+
export { useElementSize } from './hooks/useElementSize.js';
|
|
50
|
+
export { ChartSyncProvider, useChartSync } from './core/sync.js';
|
|
51
|
+
export type { ChartSyncPayload, ChartSyncProviderProps, UseChartSyncResult, } from './core/sync.js';
|
|
52
|
+
export { exportChartSvg, exportChartDataUrl, downloadChart, } from './core/export.js';
|
|
53
|
+
export type { ChartExportFormat, ExportChartOptions, DownloadChartOptions, } from './core/export.js';
|
|
54
|
+
export { useChartExport } from './hooks/useChartExport.js';
|
|
55
|
+
export type { UseChartExportResult } from './hooks/useChartExport.js';
|
|
56
|
+
export { Chart } from './components/chart/index.js';
|
|
57
|
+
export type { ChartProps, ChartOption, ChartOptionSeries, } from './components/chart/index.js';
|
|
58
|
+
export type { BaseChartProps, ChartDataRow, SeriesConfig, SeriesType, AxisConfig, LegendConfig, TooltipConfig, TooltipPayload, TooltipSeriesItem, ChartRenderer, ChartAnimationInput, } from './types.js';
|
|
59
|
+
export { createChartTheme, readAuraTheme, resolveTheme, detectDarkMode, colorAt, withAlpha, mixColor, parseColor, lightTheme, darkTheme, DEFAULT_PALETTE, } from './theme/index.js';
|
|
60
|
+
export type { ChartTheme, ChartThemeInput, ChartThemeOptions, DeepPartial, } from './theme/index.js';
|
|
61
|
+
export { createBandScale, createPointScale, createLinearScale, linearTicks, niceStep, niceExtent, extentOf, extentWithZero, } from './core/scale.js';
|
|
62
|
+
export type { BandScale, PointScale, LinearScale, Extent } from './core/scale.js';
|
|
63
|
+
export { linePath, areaPath, arcLinePath, arcPath, roundedRectPath, symbolPath, splitSegments, } from './core/shape.js';
|
|
64
|
+
export type { CurveType, CurvePoint, Point, SymbolType } from './core/shape.js';
|
|
65
|
+
export { formatNumber, formatCompact, formatPercent, estimateTextWidth, } from './core/format.js';
|
|
66
|
+
export { squarify, buildTreemap, layoutTree, sumValues, } from './core/hierarchy.js';
|
|
67
|
+
export type { HierarchyNode, TreemapCell, TreeLayoutNode, } from './core/hierarchy.js';
|
|
62
68
|
//# sourceMappingURL=index.d.ts.map
|
package/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,YAAY,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAErE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,YAAY,EACV,eAAe,EACf,cAAc,EACd,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;A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