react-native-wagmi-charts 2.9.0 → 2.10.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/README.md +143 -66
- package/lib/commonjs/charts/candle/Candle.js +92 -177
- package/lib/commonjs/charts/candle/Candles.js +39 -66
- package/lib/commonjs/charts/candle/Chart.js +26 -37
- package/lib/commonjs/charts/candle/Context.js +49 -69
- package/lib/commonjs/charts/candle/Crosshair.js +82 -183
- package/lib/commonjs/charts/candle/Crosshair.js.map +1 -1
- package/lib/commonjs/charts/candle/CrosshairTooltip.js +61 -140
- package/lib/commonjs/charts/candle/DatetimeText.js +14 -19
- package/lib/commonjs/charts/candle/Line.js +27 -73
- package/lib/commonjs/charts/candle/PriceText.js +14 -19
- package/lib/commonjs/charts/candle/index.js +64 -67
- package/lib/commonjs/charts/candle/types.js +4 -4
- package/lib/commonjs/charts/candle/useCandleData.js +12 -9
- package/lib/commonjs/charts/candle/useCandlestickChart.js +7 -9
- package/lib/commonjs/charts/candle/useDatetime.js +18 -16
- package/lib/commonjs/charts/candle/usePrice.js +22 -21
- package/lib/commonjs/charts/candle/utils/getDomain.js +9 -5
- package/lib/commonjs/charts/candle/utils/getDomain.js.map +1 -1
- package/lib/commonjs/charts/candle/utils/getHeight.js +11 -12
- package/lib/commonjs/charts/candle/utils/getHeight.js.map +1 -1
- package/lib/commonjs/charts/candle/utils/getPrice.js +11 -12
- package/lib/commonjs/charts/candle/utils/getPrice.js.map +1 -1
- package/lib/commonjs/charts/candle/utils/getY.js +11 -12
- package/lib/commonjs/charts/candle/utils/getY.js.map +1 -1
- package/lib/commonjs/charts/candle/utils/index.js +16 -16
- package/lib/commonjs/charts/line/Axis.js +148 -268
- package/lib/commonjs/charts/line/Chart.js +62 -129
- package/lib/commonjs/charts/line/Chart.js.map +1 -1
- package/lib/commonjs/charts/line/ChartPath.js +105 -285
- package/lib/commonjs/charts/line/Context.js +37 -95
- package/lib/commonjs/charts/line/Cursor.js +74 -125
- package/lib/commonjs/charts/line/Cursor.js.map +1 -1
- package/lib/commonjs/charts/line/CursorCrosshair.js +56 -134
- package/lib/commonjs/charts/line/CursorCrosshair.js.map +1 -1
- package/lib/commonjs/charts/line/CursorLine.js +67 -152
- package/lib/commonjs/charts/line/CursorLine.js.map +1 -1
- package/lib/commonjs/charts/line/Data.js +34 -73
- package/lib/commonjs/charts/line/DatetimeText.js +15 -20
- package/lib/commonjs/charts/line/Dot.js +56 -149
- package/lib/commonjs/charts/line/Gradient.js +53 -124
- package/lib/commonjs/charts/line/Group.js +23 -54
- package/lib/commonjs/charts/line/Group.js.map +1 -1
- package/lib/commonjs/charts/line/Highlight.js +47 -115
- package/lib/commonjs/charts/line/HorizontalLine.js +39 -92
- package/lib/commonjs/charts/line/HoverTrap/index.js +7 -10
- package/lib/commonjs/charts/line/HoverTrap/index.web.js +43 -48
- package/lib/commonjs/charts/line/LineChartPathContext.js +11 -14
- package/lib/commonjs/charts/line/Path.js +32 -78
- package/lib/commonjs/charts/line/PriceText.js +36 -78
- package/lib/commonjs/charts/line/Tooltip.js +102 -188
- package/lib/commonjs/charts/line/Tooltip.js.map +1 -1
- package/lib/commonjs/charts/line/index.js +65 -65
- package/lib/commonjs/charts/line/types.js +4 -4
- package/lib/commonjs/charts/line/useAnimatedPath.js +22 -27
- package/lib/commonjs/charts/line/useCurrentY.js +17 -17
- package/lib/commonjs/charts/line/useDatetime.js +28 -32
- package/lib/commonjs/charts/line/useLineChart.js +15 -20
- package/lib/commonjs/charts/line/usePrice.js +26 -28
- package/lib/commonjs/charts/line/utils/getArea.js +14 -47
- package/lib/commonjs/charts/line/utils/getDomain.js +8 -5
- package/lib/commonjs/charts/line/utils/getDomain.js.map +1 -1
- package/lib/commonjs/charts/line/utils/getPath.js +14 -53
- package/lib/commonjs/charts/line/utils/getXPositionForCurve.js +5 -8
- package/lib/commonjs/charts/line/utils/index.js +19 -19
- package/lib/commonjs/charts/line/utils/interpolatePath.js +60 -100
- package/lib/commonjs/charts/line/utils/lineChartDataPropToArray.js +5 -5
- package/lib/commonjs/components/AnimatedText.js +29 -67
- package/lib/commonjs/index.js +19 -19
- package/lib/commonjs/types.js +2 -2
- package/lib/commonjs/utils/formatDatetime.js +9 -5
- package/lib/commonjs/utils/formatPrice.js +6 -10
- package/lib/commonjs/utils/index.js +13 -13
- package/lib/commonjs/utils/usePrevious.js +6 -8
- package/lib/module/charts/candle/Candle.js +76 -126
- package/lib/module/charts/candle/Candles.js +30 -52
- package/lib/module/charts/candle/Chart.js +19 -22
- package/lib/module/charts/candle/Context.js +29 -47
- package/lib/module/charts/candle/Crosshair.js +69 -142
- package/lib/module/charts/candle/Crosshair.js.map +1 -1
- package/lib/module/charts/candle/CrosshairTooltip.js +51 -101
- package/lib/module/charts/candle/DatetimeText.js +5 -5
- package/lib/module/charts/candle/Line.js +19 -37
- package/lib/module/charts/candle/PriceText.js +5 -5
- package/lib/module/charts/candle/index.js +2 -2
- package/lib/module/charts/candle/types.js +1 -1
- package/lib/module/charts/candle/useCandleData.js +7 -3
- package/lib/module/charts/candle/useCandlestickChart.js +1 -1
- package/lib/module/charts/candle/useDatetime.js +12 -10
- package/lib/module/charts/candle/usePrice.js +14 -12
- package/lib/module/charts/candle/utils/getDomain.js +6 -2
- package/lib/module/charts/candle/utils/getDomain.js.map +1 -1
- package/lib/module/charts/candle/utils/getHeight.js +8 -9
- package/lib/module/charts/candle/utils/getHeight.js.map +1 -1
- package/lib/module/charts/candle/utils/getPrice.js +8 -4
- package/lib/module/charts/candle/utils/getPrice.js.map +1 -1
- package/lib/module/charts/candle/utils/getY.js +8 -4
- package/lib/module/charts/candle/utils/getY.js.map +1 -1
- package/lib/module/charts/candle/utils/index.js +1 -1
- package/lib/module/charts/line/Axis.js +113 -189
- package/lib/module/charts/line/Chart.js +40 -73
- package/lib/module/charts/line/Chart.js.map +1 -1
- package/lib/module/charts/line/ChartPath.js +90 -238
- package/lib/module/charts/line/Context.js +29 -61
- package/lib/module/charts/line/Cursor.js +61 -82
- package/lib/module/charts/line/Cursor.js.map +1 -1
- package/lib/module/charts/line/CursorCrosshair.js +47 -99
- package/lib/module/charts/line/CursorCrosshair.js.map +1 -1
- package/lib/module/charts/line/CursorLine.js +52 -107
- package/lib/module/charts/line/CursorLine.js.map +1 -1
- package/lib/module/charts/line/Data.js +28 -41
- package/lib/module/charts/line/DatetimeText.js +5 -5
- package/lib/module/charts/line/Dot.js +39 -93
- package/lib/module/charts/line/Gradient.js +41 -79
- package/lib/module/charts/line/Group.js +14 -15
- package/lib/module/charts/line/Group.js.map +1 -1
- package/lib/module/charts/line/Highlight.js +32 -61
- package/lib/module/charts/line/HorizontalLine.js +27 -49
- package/lib/module/charts/line/HoverTrap/index.js +2 -3
- package/lib/module/charts/line/HoverTrap/index.web.js +34 -34
- package/lib/module/charts/line/LineChartPathContext.js +3 -3
- package/lib/module/charts/line/Path.js +20 -33
- package/lib/module/charts/line/PriceText.js +25 -42
- package/lib/module/charts/line/Tooltip.js +89 -151
- package/lib/module/charts/line/Tooltip.js.map +1 -1
- package/lib/module/charts/line/index.js +2 -2
- package/lib/module/charts/line/types.js +1 -1
- package/lib/module/charts/line/useAnimatedPath.js +16 -22
- package/lib/module/charts/line/useCurrentY.js +9 -4
- package/lib/module/charts/line/useDatetime.js +22 -26
- package/lib/module/charts/line/useLineChart.js +7 -10
- package/lib/module/charts/line/usePrice.js +20 -22
- package/lib/module/charts/line/utils/getArea.js +8 -15
- package/lib/module/charts/line/utils/getDomain.js +5 -2
- package/lib/module/charts/line/utils/getDomain.js.map +1 -1
- package/lib/module/charts/line/utils/getPath.js +8 -21
- package/lib/module/charts/line/utils/getXPositionForCurve.js +2 -5
- package/lib/module/charts/line/utils/index.js +1 -1
- package/lib/module/charts/line/utils/interpolatePath.js +57 -97
- package/lib/module/charts/line/utils/lineChartDataPropToArray.js +2 -2
- package/lib/module/components/AnimatedText.js +21 -25
- package/lib/module/index.js +1 -1
- package/lib/module/types.js +2 -1
- package/lib/module/utils/formatDatetime.js +6 -2
- package/lib/module/utils/formatPrice.js +3 -7
- package/lib/module/utils/index.js +1 -1
- package/lib/module/utils/usePrevious.js +1 -1
- package/lib/typescript/src/charts/candle/Candle.d.ts +31 -45
- package/lib/typescript/src/charts/candle/Candles.d.ts +13 -24
- package/lib/typescript/src/charts/candle/Chart.d.ts +7 -12
- package/lib/typescript/src/charts/candle/Context.d.ts +7 -12
- package/lib/typescript/src/charts/candle/Crosshair.d.ts +9 -17
- package/lib/typescript/src/charts/candle/CrosshairTooltip.d.ts +8 -15
- package/lib/typescript/src/charts/candle/DatetimeText.d.ts +9 -15
- package/lib/typescript/src/charts/candle/Line.d.ts +5 -10
- package/lib/typescript/src/charts/candle/PriceText.d.ts +7 -13
- package/lib/typescript/src/charts/candle/index.d.ts +13 -32
- package/lib/typescript/src/charts/candle/types.d.ts +16 -16
- package/lib/typescript/src/charts/candle/useCandleData.d.ts +1 -1
- package/lib/typescript/src/charts/candle/useCandlestickChart.d.ts +1 -1
- package/lib/typescript/src/charts/candle/useDatetime.d.ts +9 -13
- package/lib/typescript/src/charts/candle/usePrice.d.ts +7 -11
- package/lib/typescript/src/charts/candle/utils/getDomain.d.ts +1 -1
- package/lib/typescript/src/charts/candle/utils/getDomain.d.ts.map +1 -1
- package/lib/typescript/src/charts/candle/utils/getHeight.d.ts +5 -9
- package/lib/typescript/src/charts/candle/utils/getPrice.d.ts +5 -9
- package/lib/typescript/src/charts/candle/utils/getY.d.ts +5 -9
- package/lib/typescript/src/charts/candle/utils/index.d.ts +1 -1
- package/lib/typescript/src/charts/line/Axis.d.ts +14 -27
- package/lib/typescript/src/charts/line/Chart.d.ts +23 -33
- package/lib/typescript/src/charts/line/Chart.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/ChartPath.d.ts +15 -28
- package/lib/typescript/src/charts/line/Context.d.ts +9 -16
- package/lib/typescript/src/charts/line/Cursor.d.ts +14 -22
- package/lib/typescript/src/charts/line/Cursor.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/CursorCrosshair.d.ts +11 -23
- package/lib/typescript/src/charts/line/CursorCrosshair.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/CursorLine.d.ts +9 -15
- package/lib/typescript/src/charts/line/CursorLine.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/Data.d.ts +13 -17
- package/lib/typescript/src/charts/line/DatetimeText.d.ts +8 -14
- package/lib/typescript/src/charts/line/Dot.d.ts +25 -38
- package/lib/typescript/src/charts/line/Gradient.d.ts +5 -9
- package/lib/typescript/src/charts/line/Group.d.ts +3 -6
- package/lib/typescript/src/charts/line/Group.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/Highlight.d.ts +9 -17
- package/lib/typescript/src/charts/line/HorizontalLine.d.ts +22 -30
- package/lib/typescript/src/charts/line/HoverTrap/index.d.ts +1 -1
- package/lib/typescript/src/charts/line/HoverTrap/index.web.d.ts +1 -1
- package/lib/typescript/src/charts/line/LineChartPathContext.d.ts +4 -4
- package/lib/typescript/src/charts/line/Path.d.ts +23 -28
- package/lib/typescript/src/charts/line/PriceText.d.ts +20 -28
- package/lib/typescript/src/charts/line/Tooltip.d.ts +20 -32
- package/lib/typescript/src/charts/line/index.d.ts +20 -33
- package/lib/typescript/src/charts/line/types.d.ts +17 -19
- package/lib/typescript/src/charts/line/useAnimatedPath.d.ts +7 -10
- package/lib/typescript/src/charts/line/useCurrentY.d.ts +2 -2
- package/lib/typescript/src/charts/line/useDatetime.d.ts +7 -11
- package/lib/typescript/src/charts/line/useLineChart.d.ts +10 -10
- package/lib/typescript/src/charts/line/usePrice.d.ts +7 -11
- package/lib/typescript/src/charts/line/utils/getArea.d.ts +9 -17
- package/lib/typescript/src/charts/line/utils/getDomain.d.ts +1 -1
- package/lib/typescript/src/charts/line/utils/getDomain.d.ts.map +1 -1
- package/lib/typescript/src/charts/line/utils/getPath.d.ts +11 -21
- package/lib/typescript/src/charts/line/utils/getXPositionForCurve.d.ts +1 -1
- package/lib/typescript/src/charts/line/utils/index.d.ts +1 -1
- package/lib/typescript/src/charts/line/utils/interpolatePath.d.ts +5 -17
- package/lib/typescript/src/charts/line/utils/lineChartDataPropToArray.d.ts +2 -4
- package/lib/typescript/src/components/AnimatedText.d.ts +4 -7
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/types.d.ts +4 -7
- package/lib/typescript/src/utils/formatDatetime.d.ts +5 -9
- package/lib/typescript/src/utils/formatPrice.d.ts +5 -9
- package/lib/typescript/src/utils/index.d.ts +1 -1
- package/lib/typescript/src/utils/usePrevious.d.ts +1 -1
- package/package.json +1 -1
- package/src/charts/line/CursorLine.tsx +6 -2
- package/src/charts/line/HorizontalLine.tsx +5 -1
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
import type { SharedValue } from 'react-native-reanimated';
|
|
2
2
|
export type TLineChartPoint = {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
timestamp: number;
|
|
4
|
+
value: number;
|
|
5
|
+
};
|
|
6
|
+
export type TLineChartDataProp = TLineChartData | {
|
|
7
|
+
[key: string]: TLineChartData;
|
|
5
8
|
};
|
|
6
|
-
export type TLineChartDataProp =
|
|
7
|
-
| TLineChartData
|
|
8
|
-
| {
|
|
9
|
-
[key: string]: TLineChartData;
|
|
10
|
-
};
|
|
11
9
|
export type TLineChartData = Array<TLineChartPoint>;
|
|
12
10
|
export type TLineChartContext = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
currentX: SharedValue<number>;
|
|
12
|
+
currentIndex: SharedValue<number>;
|
|
13
|
+
isActive: SharedValue<boolean>;
|
|
14
|
+
domain: [number, number];
|
|
15
|
+
yDomain: YDomain;
|
|
16
|
+
xLength: number;
|
|
17
|
+
xDomain?: [number, number] | undefined;
|
|
20
18
|
};
|
|
21
19
|
export type YRangeProp = {
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
min?: number;
|
|
21
|
+
max?: number;
|
|
24
22
|
};
|
|
25
23
|
export type YDomain = {
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
min: number;
|
|
25
|
+
max: number;
|
|
28
26
|
};
|
|
29
|
-
//# sourceMappingURL=types.d.ts.map
|
|
27
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
export declare function useAnimatedPath({
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}: {
|
|
5
|
-
enabled?: boolean;
|
|
6
|
-
path: string;
|
|
1
|
+
export declare function useAnimatedPath({ enabled, path, }: {
|
|
2
|
+
enabled?: boolean;
|
|
3
|
+
path: string;
|
|
7
4
|
}): {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
animatedProps: Partial<{
|
|
6
|
+
d: string;
|
|
7
|
+
}>;
|
|
11
8
|
};
|
|
12
|
-
//# sourceMappingURL=useAnimatedPath.d.ts.map
|
|
9
|
+
//# sourceMappingURL=useAnimatedPath.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function useCurrentY(): import(
|
|
2
|
-
//# sourceMappingURL=useCurrentY.d.ts.map
|
|
1
|
+
export declare function useCurrentY(): import("react-native-reanimated").DerivedValue<number>;
|
|
2
|
+
//# sourceMappingURL=useCurrentY.d.ts.map
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import type { TFormatterFn } from '../../types';
|
|
2
|
-
export declare function useLineChartDatetime({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}?: {
|
|
7
|
-
format?: TFormatterFn<number>;
|
|
8
|
-
locale?: string;
|
|
9
|
-
options?: Intl.DateTimeFormatOptions;
|
|
2
|
+
export declare function useLineChartDatetime({ format, locale, options, }?: {
|
|
3
|
+
format?: TFormatterFn<number>;
|
|
4
|
+
locale?: string;
|
|
5
|
+
options?: Intl.DateTimeFormatOptions;
|
|
10
6
|
}): {
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
value: import("react-native-reanimated").DerivedValue<number>;
|
|
8
|
+
formatted: import("react-native-reanimated").DerivedValue<string>;
|
|
13
9
|
};
|
|
14
|
-
//# sourceMappingURL=useDatetime.d.ts.map
|
|
10
|
+
//# sourceMappingURL=useDatetime.d.ts.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export declare function useLineChart(): {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
currentY: import("react-native-reanimated").DerivedValue<number>;
|
|
3
|
+
data: import("./types").TLineChartData | undefined;
|
|
4
|
+
currentX: import("react-native-reanimated").SharedValue<number>;
|
|
5
|
+
currentIndex: import("react-native-reanimated").SharedValue<number>;
|
|
6
|
+
isActive: import("react-native-reanimated").SharedValue<boolean>;
|
|
7
|
+
domain: [number, number];
|
|
8
|
+
yDomain: import("./types").YDomain;
|
|
9
|
+
xLength: number;
|
|
10
|
+
xDomain?: [number, number] | undefined;
|
|
11
11
|
};
|
|
12
|
-
//# sourceMappingURL=useLineChart.d.ts.map
|
|
12
|
+
//# sourceMappingURL=useLineChart.d.ts.map
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import type { TFormatterFn } from '../../types';
|
|
2
|
-
export declare function useLineChartPrice({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}?: {
|
|
7
|
-
format?: TFormatterFn<string>;
|
|
8
|
-
precision?: number;
|
|
9
|
-
index?: number;
|
|
2
|
+
export declare function useLineChartPrice({ format, precision, index, }?: {
|
|
3
|
+
format?: TFormatterFn<string>;
|
|
4
|
+
precision?: number;
|
|
5
|
+
index?: number;
|
|
10
6
|
}): {
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
value: import("react-native-reanimated").DerivedValue<string>;
|
|
8
|
+
formatted: import("react-native-reanimated").DerivedValue<string>;
|
|
13
9
|
};
|
|
14
|
-
//# sourceMappingURL=usePrice.d.ts.map
|
|
10
|
+
//# sourceMappingURL=usePrice.d.ts.map
|
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
import type { TLineChartData, YDomain } from '../types';
|
|
2
|
-
export declare function getArea({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}: {
|
|
11
|
-
data: TLineChartData;
|
|
12
|
-
width: number;
|
|
13
|
-
height: number;
|
|
14
|
-
gutter: number;
|
|
15
|
-
shape?: unknown;
|
|
16
|
-
yDomain: YDomain;
|
|
17
|
-
xDomain?: [number, number];
|
|
2
|
+
export declare function getArea({ data, width, height, gutter, shape: _shape, yDomain, xDomain, }: {
|
|
3
|
+
data: TLineChartData;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
gutter: number;
|
|
7
|
+
shape?: unknown;
|
|
8
|
+
yDomain: YDomain;
|
|
9
|
+
xDomain?: [number, number];
|
|
18
10
|
}): string;
|
|
19
|
-
//# sourceMappingURL=getArea.d.ts.map
|
|
11
|
+
//# sourceMappingURL=getArea.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDomain.d.ts","sourceRoot":"","sources":["../../../../../../src/charts/line/utils/getDomain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,wBAAgB,SAAS,CAAC,IAAI,EAAE,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"getDomain.d.ts","sourceRoot":"","sources":["../../../../../../src/charts/line/utils/getDomain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,wBAAgB,SAAS,CAAC,IAAI,EAAE,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAKnE"}
|
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
import type { TLineChartData, YDomain } from '../types';
|
|
2
|
-
export declare function getPath({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}: {
|
|
13
|
-
data: TLineChartData;
|
|
14
|
-
from?: number;
|
|
15
|
-
to?: number;
|
|
16
|
-
width: number;
|
|
17
|
-
height: number;
|
|
18
|
-
gutter: number;
|
|
19
|
-
shape?: unknown;
|
|
20
|
-
yDomain: YDomain;
|
|
21
|
-
xDomain?: [number, number];
|
|
2
|
+
export declare function getPath({ data, from, to, width, height, gutter, shape: _shape, yDomain, xDomain, }: {
|
|
3
|
+
data: TLineChartData;
|
|
4
|
+
from?: number;
|
|
5
|
+
to?: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
gutter: number;
|
|
9
|
+
shape?: unknown;
|
|
10
|
+
yDomain: YDomain;
|
|
11
|
+
xDomain?: [number, number];
|
|
22
12
|
}): string;
|
|
23
|
-
//# sourceMappingURL=getPath.d.ts.map
|
|
13
|
+
//# sourceMappingURL=getPath.d.ts.map
|
|
@@ -7,11 +7,7 @@
|
|
|
7
7
|
* @param {Number} segmentCount The number of segments to create
|
|
8
8
|
* @return {Object[]} An array of commands representing the segments in sequence
|
|
9
9
|
*/
|
|
10
|
-
export declare function splitCurve(
|
|
11
|
-
commandStart: any,
|
|
12
|
-
commandEnd: any,
|
|
13
|
-
segmentCount: any
|
|
14
|
-
): {}[];
|
|
10
|
+
export declare function splitCurve(commandStart: any, commandEnd: any, segmentCount: any): {}[];
|
|
15
11
|
/**
|
|
16
12
|
* Takes a path `d` string and converts it into an array of command
|
|
17
13
|
* objects. Drops the `Z` character.
|
|
@@ -19,7 +15,7 @@ export declare function splitCurve(
|
|
|
19
15
|
* @param {String|null} d A path `d` string
|
|
20
16
|
*/
|
|
21
17
|
export declare function pathCommandsFromString(d: any): {
|
|
22
|
-
|
|
18
|
+
type: any;
|
|
23
19
|
}[];
|
|
24
20
|
/**
|
|
25
21
|
* Interpolate from A to B by extending A and B during interpolation to have
|
|
@@ -37,11 +33,7 @@ export declare function pathCommandsFromString(d: any): {
|
|
|
37
33
|
* end command object and returns true if the segment should be excluded from splitting.
|
|
38
34
|
* @returns {Function} Interpolation function that maps t ([0, 1]) to an array of path commands.
|
|
39
35
|
*/
|
|
40
|
-
export declare function interpolatePathCommands(
|
|
41
|
-
aCommandsInput: any,
|
|
42
|
-
bCommandsInput: any,
|
|
43
|
-
excludeSegment: any
|
|
44
|
-
): (t: any) => any;
|
|
36
|
+
export declare function interpolatePathCommands(aCommandsInput: any, bCommandsInput: any, excludeSegment: any): (t: any) => any;
|
|
45
37
|
/**
|
|
46
38
|
* Interpolate from A to B by extending A and B during interpolation to have
|
|
47
39
|
* the same number of points. This allows for a smooth transition when they
|
|
@@ -55,9 +47,5 @@ export declare function interpolatePathCommands(
|
|
|
55
47
|
* end command object and returns true if the segment should be excluded from splitting.
|
|
56
48
|
* @returns {Function} Interpolation function that maps t ([0, 1]) to a path `d` string.
|
|
57
49
|
*/
|
|
58
|
-
export declare function interpolatePath(
|
|
59
|
-
|
|
60
|
-
b: any,
|
|
61
|
-
excludeSegment: any
|
|
62
|
-
): (t: any) => any;
|
|
63
|
-
//# sourceMappingURL=interpolatePath.d.ts.map
|
|
50
|
+
export declare function interpolatePath(a: any, b: any, excludeSegment: any): (t: any) => any;
|
|
51
|
+
//# sourceMappingURL=interpolatePath.d.ts.map
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import type { TLineChartData, TLineChartDataProp } from '../types';
|
|
2
|
-
export declare function lineChartDataPropToArray(
|
|
3
|
-
|
|
4
|
-
): TLineChartData;
|
|
5
|
-
//# sourceMappingURL=lineChartDataPropToArray.d.ts.map
|
|
2
|
+
export declare function lineChartDataPropToArray(dataProp: TLineChartDataProp): TLineChartData;
|
|
3
|
+
//# sourceMappingURL=lineChartDataPropToArray.d.ts.map
|
|
@@ -2,12 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { TextProps as RNTextProps } from 'react-native';
|
|
3
3
|
import type { SharedValue, AnimatedProps } from 'react-native-reanimated';
|
|
4
4
|
interface AnimatedTextProps {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
text: SharedValue<string>;
|
|
6
|
+
style?: AnimatedProps<RNTextProps>['style'];
|
|
7
7
|
}
|
|
8
|
-
export declare const AnimatedText: ({
|
|
9
|
-
text,
|
|
10
|
-
style,
|
|
11
|
-
}: AnimatedTextProps) => React.JSX.Element;
|
|
8
|
+
export declare const AnimatedText: ({ text, style }: AnimatedTextProps) => React.JSX.Element;
|
|
12
9
|
export {};
|
|
13
|
-
//# sourceMappingURL=AnimatedText.d.ts.map
|
|
10
|
+
//# sourceMappingURL=AnimatedText.d.ts.map
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
export type TFormatterFn<T> = ({
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}: {
|
|
5
|
-
value: T;
|
|
6
|
-
formatted: string;
|
|
1
|
+
export type TFormatterFn<T> = ({ value, formatted, }: {
|
|
2
|
+
value: T;
|
|
3
|
+
formatted: string;
|
|
7
4
|
}) => string;
|
|
8
|
-
//# sourceMappingURL=types.d.ts.map
|
|
5
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @worklet
|
|
3
3
|
*/
|
|
4
|
-
export declare function formatDatetime({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}: {
|
|
9
|
-
value: number;
|
|
10
|
-
locale?: string;
|
|
11
|
-
options?: Intl.DateTimeFormatOptions;
|
|
4
|
+
export declare function formatDatetime({ value, locale, options, }: {
|
|
5
|
+
value: number;
|
|
6
|
+
locale?: string;
|
|
7
|
+
options?: Intl.DateTimeFormatOptions;
|
|
12
8
|
}): string;
|
|
13
|
-
//# sourceMappingURL=formatDatetime.d.ts.map
|
|
9
|
+
//# sourceMappingURL=formatDatetime.d.ts.map
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @worklet
|
|
3
3
|
*/
|
|
4
|
-
export declare function formatPrice({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}: {
|
|
9
|
-
value: string;
|
|
10
|
-
defaultPrice?: string | number;
|
|
11
|
-
precision?: number;
|
|
4
|
+
export declare function formatPrice({ value: _value, defaultPrice: _defaultPrice, precision, }: {
|
|
5
|
+
value: string;
|
|
6
|
+
defaultPrice?: string | number;
|
|
7
|
+
precision?: number;
|
|
12
8
|
}): string;
|
|
13
|
-
//# sourceMappingURL=formatPrice.d.ts.map
|
|
9
|
+
//# sourceMappingURL=formatPrice.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare function usePrevious<T>(value: T): T | undefined;
|
|
2
|
-
//# sourceMappingURL=usePrevious.d.ts.map
|
|
2
|
+
//# sourceMappingURL=usePrevious.d.ts.map
|
package/package.json
CHANGED
|
@@ -18,6 +18,7 @@ import { useLineChartPrice } from './usePrice';
|
|
|
18
18
|
type LineChartCursorLineProps = {
|
|
19
19
|
children?: React.ReactNode;
|
|
20
20
|
color?: string;
|
|
21
|
+
showLabel?: boolean;
|
|
21
22
|
lineProps?: Partial<LineProps>;
|
|
22
23
|
format?: TFormatterFn<string | number>;
|
|
23
24
|
textStyle?: TextStyle;
|
|
@@ -48,6 +49,7 @@ const AnimatedLine = Animated.createAnimatedComponent(SVGLine);
|
|
|
48
49
|
export function LineChartCursorLine({
|
|
49
50
|
children,
|
|
50
51
|
color = 'gray',
|
|
52
|
+
showLabel = true,
|
|
51
53
|
lineProps,
|
|
52
54
|
format,
|
|
53
55
|
textStyle,
|
|
@@ -105,7 +107,7 @@ export function LineChartCursorLine({
|
|
|
105
107
|
if (isHorizontal) return 0;
|
|
106
108
|
|
|
107
109
|
// For vertical cursor, extend line to the chart area (excluding reserved label space)
|
|
108
|
-
return height - SPACING.X_AXIS_LABEL_RESERVED_HEIGHT;
|
|
110
|
+
return showLabel ? height - SPACING.X_AXIS_LABEL_RESERVED_HEIGHT : height;
|
|
109
111
|
});
|
|
110
112
|
|
|
111
113
|
const containerStyle = useAnimatedStyle(() => ({
|
|
@@ -208,7 +210,9 @@ export function LineChartCursorLine({
|
|
|
208
210
|
{...lineProps}
|
|
209
211
|
/>
|
|
210
212
|
</Svg>
|
|
211
|
-
|
|
213
|
+
{showLabel && (
|
|
214
|
+
<AnimatedText text={displayText} style={textPositionStyle} />
|
|
215
|
+
)}
|
|
212
216
|
</Animated.View>
|
|
213
217
|
{children}
|
|
214
218
|
</LineChartCursor>
|
|
@@ -55,6 +55,9 @@ export function LineChartHorizontalLine({
|
|
|
55
55
|
);
|
|
56
56
|
const { yDomain } = useLineChart();
|
|
57
57
|
|
|
58
|
+
// Reserve space at the bottom for x-axis cursor labels
|
|
59
|
+
const X_AXIS_LABEL_RESERVED_HEIGHT = 40;
|
|
60
|
+
|
|
58
61
|
const y = useDerivedValue(() => {
|
|
59
62
|
if (typeof at === 'number' || at.index != null) {
|
|
60
63
|
const index = typeof at === 'number' ? at : at.index;
|
|
@@ -74,7 +77,8 @@ export function LineChartHorizontalLine({
|
|
|
74
77
|
|
|
75
78
|
const offsetTop = yDomain.max - at.value;
|
|
76
79
|
const percentageOffsetTop = offsetTop / (yDomain.max - yDomain.min);
|
|
77
|
-
const
|
|
80
|
+
const chartDrawingHeight = height - X_AXIS_LABEL_RESERVED_HEIGHT;
|
|
81
|
+
const heightBetweenGutters = chartDrawingHeight - gutter * 2;
|
|
78
82
|
const offsetTopPixels = gutter + percentageOffsetTop * heightBetweenGutters;
|
|
79
83
|
|
|
80
84
|
return withTiming(offsetTopPixels + offsetY);
|