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.
Files changed (218) hide show
  1. package/README.md +143 -66
  2. package/lib/commonjs/charts/candle/Candle.js +92 -177
  3. package/lib/commonjs/charts/candle/Candles.js +39 -66
  4. package/lib/commonjs/charts/candle/Chart.js +26 -37
  5. package/lib/commonjs/charts/candle/Context.js +49 -69
  6. package/lib/commonjs/charts/candle/Crosshair.js +82 -183
  7. package/lib/commonjs/charts/candle/Crosshair.js.map +1 -1
  8. package/lib/commonjs/charts/candle/CrosshairTooltip.js +61 -140
  9. package/lib/commonjs/charts/candle/DatetimeText.js +14 -19
  10. package/lib/commonjs/charts/candle/Line.js +27 -73
  11. package/lib/commonjs/charts/candle/PriceText.js +14 -19
  12. package/lib/commonjs/charts/candle/index.js +64 -67
  13. package/lib/commonjs/charts/candle/types.js +4 -4
  14. package/lib/commonjs/charts/candle/useCandleData.js +12 -9
  15. package/lib/commonjs/charts/candle/useCandlestickChart.js +7 -9
  16. package/lib/commonjs/charts/candle/useDatetime.js +18 -16
  17. package/lib/commonjs/charts/candle/usePrice.js +22 -21
  18. package/lib/commonjs/charts/candle/utils/getDomain.js +9 -5
  19. package/lib/commonjs/charts/candle/utils/getDomain.js.map +1 -1
  20. package/lib/commonjs/charts/candle/utils/getHeight.js +11 -12
  21. package/lib/commonjs/charts/candle/utils/getHeight.js.map +1 -1
  22. package/lib/commonjs/charts/candle/utils/getPrice.js +11 -12
  23. package/lib/commonjs/charts/candle/utils/getPrice.js.map +1 -1
  24. package/lib/commonjs/charts/candle/utils/getY.js +11 -12
  25. package/lib/commonjs/charts/candle/utils/getY.js.map +1 -1
  26. package/lib/commonjs/charts/candle/utils/index.js +16 -16
  27. package/lib/commonjs/charts/line/Axis.js +148 -268
  28. package/lib/commonjs/charts/line/Chart.js +62 -129
  29. package/lib/commonjs/charts/line/Chart.js.map +1 -1
  30. package/lib/commonjs/charts/line/ChartPath.js +105 -285
  31. package/lib/commonjs/charts/line/Context.js +37 -95
  32. package/lib/commonjs/charts/line/Cursor.js +74 -125
  33. package/lib/commonjs/charts/line/Cursor.js.map +1 -1
  34. package/lib/commonjs/charts/line/CursorCrosshair.js +56 -134
  35. package/lib/commonjs/charts/line/CursorCrosshair.js.map +1 -1
  36. package/lib/commonjs/charts/line/CursorLine.js +67 -152
  37. package/lib/commonjs/charts/line/CursorLine.js.map +1 -1
  38. package/lib/commonjs/charts/line/Data.js +34 -73
  39. package/lib/commonjs/charts/line/DatetimeText.js +15 -20
  40. package/lib/commonjs/charts/line/Dot.js +56 -149
  41. package/lib/commonjs/charts/line/Gradient.js +53 -124
  42. package/lib/commonjs/charts/line/Group.js +23 -54
  43. package/lib/commonjs/charts/line/Group.js.map +1 -1
  44. package/lib/commonjs/charts/line/Highlight.js +47 -115
  45. package/lib/commonjs/charts/line/HorizontalLine.js +39 -92
  46. package/lib/commonjs/charts/line/HoverTrap/index.js +7 -10
  47. package/lib/commonjs/charts/line/HoverTrap/index.web.js +43 -48
  48. package/lib/commonjs/charts/line/LineChartPathContext.js +11 -14
  49. package/lib/commonjs/charts/line/Path.js +32 -78
  50. package/lib/commonjs/charts/line/PriceText.js +36 -78
  51. package/lib/commonjs/charts/line/Tooltip.js +102 -188
  52. package/lib/commonjs/charts/line/Tooltip.js.map +1 -1
  53. package/lib/commonjs/charts/line/index.js +65 -65
  54. package/lib/commonjs/charts/line/types.js +4 -4
  55. package/lib/commonjs/charts/line/useAnimatedPath.js +22 -27
  56. package/lib/commonjs/charts/line/useCurrentY.js +17 -17
  57. package/lib/commonjs/charts/line/useDatetime.js +28 -32
  58. package/lib/commonjs/charts/line/useLineChart.js +15 -20
  59. package/lib/commonjs/charts/line/usePrice.js +26 -28
  60. package/lib/commonjs/charts/line/utils/getArea.js +14 -47
  61. package/lib/commonjs/charts/line/utils/getDomain.js +8 -5
  62. package/lib/commonjs/charts/line/utils/getDomain.js.map +1 -1
  63. package/lib/commonjs/charts/line/utils/getPath.js +14 -53
  64. package/lib/commonjs/charts/line/utils/getXPositionForCurve.js +5 -8
  65. package/lib/commonjs/charts/line/utils/index.js +19 -19
  66. package/lib/commonjs/charts/line/utils/interpolatePath.js +60 -100
  67. package/lib/commonjs/charts/line/utils/lineChartDataPropToArray.js +5 -5
  68. package/lib/commonjs/components/AnimatedText.js +29 -67
  69. package/lib/commonjs/index.js +19 -19
  70. package/lib/commonjs/types.js +2 -2
  71. package/lib/commonjs/utils/formatDatetime.js +9 -5
  72. package/lib/commonjs/utils/formatPrice.js +6 -10
  73. package/lib/commonjs/utils/index.js +13 -13
  74. package/lib/commonjs/utils/usePrevious.js +6 -8
  75. package/lib/module/charts/candle/Candle.js +76 -126
  76. package/lib/module/charts/candle/Candles.js +30 -52
  77. package/lib/module/charts/candle/Chart.js +19 -22
  78. package/lib/module/charts/candle/Context.js +29 -47
  79. package/lib/module/charts/candle/Crosshair.js +69 -142
  80. package/lib/module/charts/candle/Crosshair.js.map +1 -1
  81. package/lib/module/charts/candle/CrosshairTooltip.js +51 -101
  82. package/lib/module/charts/candle/DatetimeText.js +5 -5
  83. package/lib/module/charts/candle/Line.js +19 -37
  84. package/lib/module/charts/candle/PriceText.js +5 -5
  85. package/lib/module/charts/candle/index.js +2 -2
  86. package/lib/module/charts/candle/types.js +1 -1
  87. package/lib/module/charts/candle/useCandleData.js +7 -3
  88. package/lib/module/charts/candle/useCandlestickChart.js +1 -1
  89. package/lib/module/charts/candle/useDatetime.js +12 -10
  90. package/lib/module/charts/candle/usePrice.js +14 -12
  91. package/lib/module/charts/candle/utils/getDomain.js +6 -2
  92. package/lib/module/charts/candle/utils/getDomain.js.map +1 -1
  93. package/lib/module/charts/candle/utils/getHeight.js +8 -9
  94. package/lib/module/charts/candle/utils/getHeight.js.map +1 -1
  95. package/lib/module/charts/candle/utils/getPrice.js +8 -4
  96. package/lib/module/charts/candle/utils/getPrice.js.map +1 -1
  97. package/lib/module/charts/candle/utils/getY.js +8 -4
  98. package/lib/module/charts/candle/utils/getY.js.map +1 -1
  99. package/lib/module/charts/candle/utils/index.js +1 -1
  100. package/lib/module/charts/line/Axis.js +113 -189
  101. package/lib/module/charts/line/Chart.js +40 -73
  102. package/lib/module/charts/line/Chart.js.map +1 -1
  103. package/lib/module/charts/line/ChartPath.js +90 -238
  104. package/lib/module/charts/line/Context.js +29 -61
  105. package/lib/module/charts/line/Cursor.js +61 -82
  106. package/lib/module/charts/line/Cursor.js.map +1 -1
  107. package/lib/module/charts/line/CursorCrosshair.js +47 -99
  108. package/lib/module/charts/line/CursorCrosshair.js.map +1 -1
  109. package/lib/module/charts/line/CursorLine.js +52 -107
  110. package/lib/module/charts/line/CursorLine.js.map +1 -1
  111. package/lib/module/charts/line/Data.js +28 -41
  112. package/lib/module/charts/line/DatetimeText.js +5 -5
  113. package/lib/module/charts/line/Dot.js +39 -93
  114. package/lib/module/charts/line/Gradient.js +41 -79
  115. package/lib/module/charts/line/Group.js +14 -15
  116. package/lib/module/charts/line/Group.js.map +1 -1
  117. package/lib/module/charts/line/Highlight.js +32 -61
  118. package/lib/module/charts/line/HorizontalLine.js +27 -49
  119. package/lib/module/charts/line/HoverTrap/index.js +2 -3
  120. package/lib/module/charts/line/HoverTrap/index.web.js +34 -34
  121. package/lib/module/charts/line/LineChartPathContext.js +3 -3
  122. package/lib/module/charts/line/Path.js +20 -33
  123. package/lib/module/charts/line/PriceText.js +25 -42
  124. package/lib/module/charts/line/Tooltip.js +89 -151
  125. package/lib/module/charts/line/Tooltip.js.map +1 -1
  126. package/lib/module/charts/line/index.js +2 -2
  127. package/lib/module/charts/line/types.js +1 -1
  128. package/lib/module/charts/line/useAnimatedPath.js +16 -22
  129. package/lib/module/charts/line/useCurrentY.js +9 -4
  130. package/lib/module/charts/line/useDatetime.js +22 -26
  131. package/lib/module/charts/line/useLineChart.js +7 -10
  132. package/lib/module/charts/line/usePrice.js +20 -22
  133. package/lib/module/charts/line/utils/getArea.js +8 -15
  134. package/lib/module/charts/line/utils/getDomain.js +5 -2
  135. package/lib/module/charts/line/utils/getDomain.js.map +1 -1
  136. package/lib/module/charts/line/utils/getPath.js +8 -21
  137. package/lib/module/charts/line/utils/getXPositionForCurve.js +2 -5
  138. package/lib/module/charts/line/utils/index.js +1 -1
  139. package/lib/module/charts/line/utils/interpolatePath.js +57 -97
  140. package/lib/module/charts/line/utils/lineChartDataPropToArray.js +2 -2
  141. package/lib/module/components/AnimatedText.js +21 -25
  142. package/lib/module/index.js +1 -1
  143. package/lib/module/types.js +2 -1
  144. package/lib/module/utils/formatDatetime.js +6 -2
  145. package/lib/module/utils/formatPrice.js +3 -7
  146. package/lib/module/utils/index.js +1 -1
  147. package/lib/module/utils/usePrevious.js +1 -1
  148. package/lib/typescript/src/charts/candle/Candle.d.ts +31 -45
  149. package/lib/typescript/src/charts/candle/Candles.d.ts +13 -24
  150. package/lib/typescript/src/charts/candle/Chart.d.ts +7 -12
  151. package/lib/typescript/src/charts/candle/Context.d.ts +7 -12
  152. package/lib/typescript/src/charts/candle/Crosshair.d.ts +9 -17
  153. package/lib/typescript/src/charts/candle/CrosshairTooltip.d.ts +8 -15
  154. package/lib/typescript/src/charts/candle/DatetimeText.d.ts +9 -15
  155. package/lib/typescript/src/charts/candle/Line.d.ts +5 -10
  156. package/lib/typescript/src/charts/candle/PriceText.d.ts +7 -13
  157. package/lib/typescript/src/charts/candle/index.d.ts +13 -32
  158. package/lib/typescript/src/charts/candle/types.d.ts +16 -16
  159. package/lib/typescript/src/charts/candle/useCandleData.d.ts +1 -1
  160. package/lib/typescript/src/charts/candle/useCandlestickChart.d.ts +1 -1
  161. package/lib/typescript/src/charts/candle/useDatetime.d.ts +9 -13
  162. package/lib/typescript/src/charts/candle/usePrice.d.ts +7 -11
  163. package/lib/typescript/src/charts/candle/utils/getDomain.d.ts +1 -1
  164. package/lib/typescript/src/charts/candle/utils/getDomain.d.ts.map +1 -1
  165. package/lib/typescript/src/charts/candle/utils/getHeight.d.ts +5 -9
  166. package/lib/typescript/src/charts/candle/utils/getPrice.d.ts +5 -9
  167. package/lib/typescript/src/charts/candle/utils/getY.d.ts +5 -9
  168. package/lib/typescript/src/charts/candle/utils/index.d.ts +1 -1
  169. package/lib/typescript/src/charts/line/Axis.d.ts +14 -27
  170. package/lib/typescript/src/charts/line/Chart.d.ts +23 -33
  171. package/lib/typescript/src/charts/line/Chart.d.ts.map +1 -1
  172. package/lib/typescript/src/charts/line/ChartPath.d.ts +15 -28
  173. package/lib/typescript/src/charts/line/Context.d.ts +9 -16
  174. package/lib/typescript/src/charts/line/Cursor.d.ts +14 -22
  175. package/lib/typescript/src/charts/line/Cursor.d.ts.map +1 -1
  176. package/lib/typescript/src/charts/line/CursorCrosshair.d.ts +11 -23
  177. package/lib/typescript/src/charts/line/CursorCrosshair.d.ts.map +1 -1
  178. package/lib/typescript/src/charts/line/CursorLine.d.ts +9 -15
  179. package/lib/typescript/src/charts/line/CursorLine.d.ts.map +1 -1
  180. package/lib/typescript/src/charts/line/Data.d.ts +13 -17
  181. package/lib/typescript/src/charts/line/DatetimeText.d.ts +8 -14
  182. package/lib/typescript/src/charts/line/Dot.d.ts +25 -38
  183. package/lib/typescript/src/charts/line/Gradient.d.ts +5 -9
  184. package/lib/typescript/src/charts/line/Group.d.ts +3 -6
  185. package/lib/typescript/src/charts/line/Group.d.ts.map +1 -1
  186. package/lib/typescript/src/charts/line/Highlight.d.ts +9 -17
  187. package/lib/typescript/src/charts/line/HorizontalLine.d.ts +22 -30
  188. package/lib/typescript/src/charts/line/HoverTrap/index.d.ts +1 -1
  189. package/lib/typescript/src/charts/line/HoverTrap/index.web.d.ts +1 -1
  190. package/lib/typescript/src/charts/line/LineChartPathContext.d.ts +4 -4
  191. package/lib/typescript/src/charts/line/Path.d.ts +23 -28
  192. package/lib/typescript/src/charts/line/PriceText.d.ts +20 -28
  193. package/lib/typescript/src/charts/line/Tooltip.d.ts +20 -32
  194. package/lib/typescript/src/charts/line/index.d.ts +20 -33
  195. package/lib/typescript/src/charts/line/types.d.ts +17 -19
  196. package/lib/typescript/src/charts/line/useAnimatedPath.d.ts +7 -10
  197. package/lib/typescript/src/charts/line/useCurrentY.d.ts +2 -2
  198. package/lib/typescript/src/charts/line/useDatetime.d.ts +7 -11
  199. package/lib/typescript/src/charts/line/useLineChart.d.ts +10 -10
  200. package/lib/typescript/src/charts/line/usePrice.d.ts +7 -11
  201. package/lib/typescript/src/charts/line/utils/getArea.d.ts +9 -17
  202. package/lib/typescript/src/charts/line/utils/getDomain.d.ts +1 -1
  203. package/lib/typescript/src/charts/line/utils/getDomain.d.ts.map +1 -1
  204. package/lib/typescript/src/charts/line/utils/getPath.d.ts +11 -21
  205. package/lib/typescript/src/charts/line/utils/getXPositionForCurve.d.ts +1 -1
  206. package/lib/typescript/src/charts/line/utils/index.d.ts +1 -1
  207. package/lib/typescript/src/charts/line/utils/interpolatePath.d.ts +5 -17
  208. package/lib/typescript/src/charts/line/utils/lineChartDataPropToArray.d.ts +2 -4
  209. package/lib/typescript/src/components/AnimatedText.d.ts +4 -7
  210. package/lib/typescript/src/index.d.ts +1 -1
  211. package/lib/typescript/src/types.d.ts +4 -7
  212. package/lib/typescript/src/utils/formatDatetime.d.ts +5 -9
  213. package/lib/typescript/src/utils/formatPrice.d.ts +5 -9
  214. package/lib/typescript/src/utils/index.d.ts +1 -1
  215. package/lib/typescript/src/utils/usePrevious.d.ts +1 -1
  216. package/package.json +1 -1
  217. package/src/charts/line/CursorLine.tsx +6 -2
  218. 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
- timestamp: number;
4
- value: number;
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
- currentX: SharedValue<number>;
14
- currentIndex: SharedValue<number>;
15
- isActive: SharedValue<boolean>;
16
- domain: [number, number];
17
- yDomain: YDomain;
18
- xLength: number;
19
- xDomain?: [number, number] | undefined;
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
- min?: number;
23
- max?: number;
20
+ min?: number;
21
+ max?: number;
24
22
  };
25
23
  export type YDomain = {
26
- min: number;
27
- max: number;
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
- enabled,
3
- path,
4
- }: {
5
- enabled?: boolean;
6
- path: string;
1
+ export declare function useAnimatedPath({ enabled, path, }: {
2
+ enabled?: boolean;
3
+ path: string;
7
4
  }): {
8
- animatedProps: Partial<{
9
- d: string;
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('react-native-reanimated').DerivedValue<number>;
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
- format,
4
- locale,
5
- options,
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
- value: import('react-native-reanimated').DerivedValue<number>;
12
- formatted: import('react-native-reanimated').DerivedValue<string>;
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
- 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;
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
- format,
4
- precision,
5
- index,
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
- value: import('react-native-reanimated').DerivedValue<string>;
12
- formatted: import('react-native-reanimated').DerivedValue<string>;
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
- data,
4
- width,
5
- height,
6
- gutter,
7
- shape: _shape,
8
- yDomain,
9
- xDomain,
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,3 +1,3 @@
1
1
  import type { TLineChartPoint } from '../types';
2
2
  export declare function getDomain(rows: TLineChartPoint[]): [number, number];
3
- //# sourceMappingURL=getDomain.d.ts.map
3
+ //# sourceMappingURL=getDomain.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,CAInE"}
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
- data,
4
- from,
5
- to,
6
- width,
7
- height,
8
- gutter,
9
- shape: _shape,
10
- yDomain,
11
- xDomain,
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
@@ -1,3 +1,3 @@
1
1
  import type { Path } from 'react-native-redash';
2
2
  export declare function getXPositionForCurve(path: Path, index: number): number;
3
- //# sourceMappingURL=getXPositionForCurve.d.ts.map
3
+ //# sourceMappingURL=getXPositionForCurve.d.ts.map
@@ -3,4 +3,4 @@ export * from './getDomain';
3
3
  export * from './getPath';
4
4
  export * from './interpolatePath';
5
5
  export * from './lineChartDataPropToArray';
6
- //# sourceMappingURL=index.d.ts.map
6
+ //# sourceMappingURL=index.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
- type: any;
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
- a: any,
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
- dataProp: TLineChartDataProp
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
- text: SharedValue<string>;
6
- style?: AnimatedProps<RNTextProps>['style'];
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
@@ -3,4 +3,4 @@ export * from './charts/line';
3
3
  export * from './components/AnimatedText';
4
4
  export * from './utils';
5
5
  export * from './types';
6
- //# sourceMappingURL=index.d.ts.map
6
+ //# sourceMappingURL=index.d.ts.map
@@ -1,8 +1,5 @@
1
- export type TFormatterFn<T> = ({
2
- value,
3
- formatted,
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
- value,
6
- locale,
7
- options,
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
- value: _value,
6
- defaultPrice: _defaultPrice,
7
- precision,
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,4 +1,4 @@
1
1
  export * from './formatDatetime';
2
2
  export * from './formatPrice';
3
3
  export * from './usePrevious';
4
- //# sourceMappingURL=index.d.ts.map
4
+ //# sourceMappingURL=index.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-wagmi-charts",
3
- "version": "2.9.0",
3
+ "version": "2.10.0",
4
4
  "description": "A sweet candlestick chart for React Native",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -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
- <AnimatedText text={displayText} style={textPositionStyle} />
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 heightBetweenGutters = height - gutter * 2;
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);