@ledgerhq/lumen-ui-rnative-visualization 0.1.14 → 0.1.16

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 (164) hide show
  1. package/dist/module/lib/Components/Axis/Axis.constants.js +21 -0
  2. package/dist/module/lib/Components/Axis/Axis.constants.js.map +1 -0
  3. package/dist/module/lib/Components/Axis/index.js +5 -0
  4. package/dist/module/lib/Components/Axis/index.js.map +1 -0
  5. package/dist/module/lib/Components/CartesianChart/CartesianChart.js +34 -22
  6. package/dist/module/lib/Components/CartesianChart/CartesianChart.js.map +1 -1
  7. package/dist/module/lib/Components/CartesianChart/context/useBuildChartContext.js +5 -4
  8. package/dist/module/lib/Components/CartesianChart/context/useBuildChartContext.js.map +1 -1
  9. package/dist/module/lib/Components/CartesianChart/context/useBuildChartContext.test.js +54 -0
  10. package/dist/module/lib/Components/CartesianChart/context/useBuildChartContext.test.js.map +1 -1
  11. package/dist/module/lib/Components/CartesianChart/utils.js +22 -12
  12. package/dist/module/lib/Components/CartesianChart/utils.js.map +1 -1
  13. package/dist/module/lib/Components/Line/utils.js +6 -1
  14. package/dist/module/lib/Components/Line/utils.js.map +1 -1
  15. package/dist/module/lib/Components/Line/utils.test.js +88 -0
  16. package/dist/module/lib/Components/Line/utils.test.js.map +1 -0
  17. package/dist/module/lib/Components/LineChart/LineChart.js +19 -31
  18. package/dist/module/lib/Components/LineChart/LineChart.js.map +1 -1
  19. package/dist/module/lib/Components/LineChart/LineChart.stories.js +38 -0
  20. package/dist/module/lib/Components/LineChart/LineChart.stories.js.map +1 -1
  21. package/dist/module/lib/Components/LineChart/LineChart.test.js +192 -0
  22. package/dist/module/lib/Components/LineChart/LineChart.test.js.map +1 -1
  23. package/dist/module/lib/Components/Point/Point.js +8 -2
  24. package/dist/module/lib/Components/Point/Point.js.map +1 -1
  25. package/dist/module/lib/Components/Point/constants.js +9 -0
  26. package/dist/module/lib/Components/Point/constants.js.map +1 -0
  27. package/dist/module/lib/Components/Point/pointContext/MagneticPointsProvider.js +35 -0
  28. package/dist/module/lib/Components/Point/pointContext/MagneticPointsProvider.js.map +1 -0
  29. package/dist/module/lib/Components/Point/pointContext/MagneticPointsProvider.test.js +153 -0
  30. package/dist/module/lib/Components/Point/pointContext/MagneticPointsProvider.test.js.map +1 -0
  31. package/dist/module/lib/Components/Point/pointContext/index.js +5 -0
  32. package/dist/module/lib/Components/Point/pointContext/index.js.map +1 -0
  33. package/dist/module/lib/Components/Point/pointContext/magneticPointsContext.js +10 -0
  34. package/dist/module/lib/Components/Point/pointContext/magneticPointsContext.js.map +1 -0
  35. package/dist/module/lib/Components/Point/utils.js +26 -6
  36. package/dist/module/lib/Components/Point/utils.js.map +1 -1
  37. package/dist/module/lib/Components/Point/utils.test.js +84 -2
  38. package/dist/module/lib/Components/Point/utils.test.js.map +1 -1
  39. package/dist/module/lib/Components/ReferenceLine/utils.js.map +1 -1
  40. package/dist/module/lib/Components/Scrubber/DefaultScrubberTooltip/ChartTooltipItem.js +3 -3
  41. package/dist/module/lib/Components/Scrubber/DefaultScrubberTooltip/ChartTooltipItem.js.map +1 -1
  42. package/dist/module/lib/Components/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.js +5 -5
  43. package/dist/module/lib/Components/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.js.map +1 -1
  44. package/dist/module/lib/Components/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.test.js +5 -5
  45. package/dist/module/lib/Components/Scrubber/DefaultScrubberTooltip/constants.js +1 -2
  46. package/dist/module/lib/Components/Scrubber/DefaultScrubberTooltip/constants.js.map +1 -1
  47. package/dist/module/lib/Components/Scrubber/DefaultScrubberTooltip/utils.js +31 -10
  48. package/dist/module/lib/Components/Scrubber/DefaultScrubberTooltip/utils.js.map +1 -1
  49. package/dist/module/lib/Components/Scrubber/DefaultScrubberTooltip/utils.test.js +4 -4
  50. package/dist/module/lib/Components/Scrubber/DefaultScrubberTooltip/utils.test.js.map +1 -1
  51. package/dist/module/lib/Components/Scrubber/ScrubberProvider.js +35 -7
  52. package/dist/module/lib/Components/Scrubber/ScrubberProvider.js.map +1 -1
  53. package/dist/module/lib/Components/Scrubber/utils.js +64 -0
  54. package/dist/module/lib/Components/Scrubber/utils.js.map +1 -1
  55. package/dist/module/lib/Components/Scrubber/utils.test.js +128 -1
  56. package/dist/module/lib/Components/Scrubber/utils.test.js.map +1 -1
  57. package/dist/module/lib/utils/domain/domain.js.map +1 -1
  58. package/dist/module/lib/utils/scales/scales.js +13 -4
  59. package/dist/module/lib/utils/scales/scales.js.map +1 -1
  60. package/dist/module/lib/utils/scales/scales.test.js +29 -0
  61. package/dist/module/lib/utils/scales/scales.test.js.map +1 -1
  62. package/dist/module/lib/utils/ticks/ticks.js +13 -3
  63. package/dist/module/lib/utils/ticks/ticks.js.map +1 -1
  64. package/dist/module/lib/utils/ticks/ticks.test.js +34 -0
  65. package/dist/module/lib/utils/ticks/ticks.test.js.map +1 -1
  66. package/dist/typescript/src/lib/Components/Axis/Axis.constants.d.ts +5 -0
  67. package/dist/typescript/src/lib/Components/Axis/Axis.constants.d.ts.map +1 -0
  68. package/dist/typescript/src/lib/Components/Axis/Axis.types.d.ts +39 -0
  69. package/dist/typescript/src/lib/Components/Axis/Axis.types.d.ts.map +1 -1
  70. package/dist/typescript/src/lib/Components/Axis/index.d.ts +3 -0
  71. package/dist/typescript/src/lib/Components/Axis/index.d.ts.map +1 -0
  72. package/dist/typescript/src/lib/Components/CartesianChart/CartesianChart.d.ts +1 -1
  73. package/dist/typescript/src/lib/Components/CartesianChart/CartesianChart.d.ts.map +1 -1
  74. package/dist/typescript/src/lib/Components/CartesianChart/context/useBuildChartContext.d.ts +5 -4
  75. package/dist/typescript/src/lib/Components/CartesianChart/context/useBuildChartContext.d.ts.map +1 -1
  76. package/dist/typescript/src/lib/Components/CartesianChart/types.d.ts +11 -3
  77. package/dist/typescript/src/lib/Components/CartesianChart/types.d.ts.map +1 -1
  78. package/dist/typescript/src/lib/Components/CartesianChart/utils.d.ts +18 -8
  79. package/dist/typescript/src/lib/Components/CartesianChart/utils.d.ts.map +1 -1
  80. package/dist/typescript/src/lib/Components/Line/utils.d.ts +4 -0
  81. package/dist/typescript/src/lib/Components/Line/utils.d.ts.map +1 -1
  82. package/dist/typescript/src/lib/Components/LineChart/LineChart.d.ts +1 -1
  83. package/dist/typescript/src/lib/Components/LineChart/LineChart.d.ts.map +1 -1
  84. package/dist/typescript/src/lib/Components/LineChart/types.d.ts +10 -3
  85. package/dist/typescript/src/lib/Components/LineChart/types.d.ts.map +1 -1
  86. package/dist/typescript/src/lib/Components/Point/Point.d.ts +1 -1
  87. package/dist/typescript/src/lib/Components/Point/Point.d.ts.map +1 -1
  88. package/dist/typescript/src/lib/Components/Point/constants.d.ts +7 -0
  89. package/dist/typescript/src/lib/Components/Point/constants.d.ts.map +1 -0
  90. package/dist/typescript/src/lib/Components/Point/pointContext/MagneticPointsProvider.d.ts +7 -0
  91. package/dist/typescript/src/lib/Components/Point/pointContext/MagneticPointsProvider.d.ts.map +1 -0
  92. package/dist/typescript/src/lib/Components/Point/pointContext/index.d.ts +3 -0
  93. package/dist/typescript/src/lib/Components/Point/pointContext/index.d.ts.map +1 -0
  94. package/dist/typescript/src/lib/Components/Point/pointContext/magneticPointsContext.d.ts +13 -0
  95. package/dist/typescript/src/lib/Components/Point/pointContext/magneticPointsContext.d.ts.map +1 -0
  96. package/dist/typescript/src/lib/Components/Point/types.d.ts +7 -0
  97. package/dist/typescript/src/lib/Components/Point/types.d.ts.map +1 -1
  98. package/dist/typescript/src/lib/Components/Point/utils.d.ts +8 -6
  99. package/dist/typescript/src/lib/Components/Point/utils.d.ts.map +1 -1
  100. package/dist/typescript/src/lib/Components/ReferenceLine/utils.d.ts +3 -2
  101. package/dist/typescript/src/lib/Components/ReferenceLine/utils.d.ts.map +1 -1
  102. package/dist/typescript/src/lib/Components/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.d.ts.map +1 -1
  103. package/dist/typescript/src/lib/Components/Scrubber/DefaultScrubberTooltip/constants.d.ts +1 -2
  104. package/dist/typescript/src/lib/Components/Scrubber/DefaultScrubberTooltip/constants.d.ts.map +1 -1
  105. package/dist/typescript/src/lib/Components/Scrubber/DefaultScrubberTooltip/utils.d.ts +5 -1
  106. package/dist/typescript/src/lib/Components/Scrubber/DefaultScrubberTooltip/utils.d.ts.map +1 -1
  107. package/dist/typescript/src/lib/Components/Scrubber/ScrubberProvider.d.ts +1 -1
  108. package/dist/typescript/src/lib/Components/Scrubber/ScrubberProvider.d.ts.map +1 -1
  109. package/dist/typescript/src/lib/Components/Scrubber/types.d.ts +13 -0
  110. package/dist/typescript/src/lib/Components/Scrubber/types.d.ts.map +1 -1
  111. package/dist/typescript/src/lib/Components/Scrubber/utils.d.ts +33 -3
  112. package/dist/typescript/src/lib/Components/Scrubber/utils.d.ts.map +1 -1
  113. package/dist/typescript/src/lib/utils/domain/domain.d.ts +5 -4
  114. package/dist/typescript/src/lib/utils/domain/domain.d.ts.map +1 -1
  115. package/dist/typescript/src/lib/utils/index.d.ts +1 -1
  116. package/dist/typescript/src/lib/utils/index.d.ts.map +1 -1
  117. package/dist/typescript/src/lib/utils/scales/scales.d.ts +11 -5
  118. package/dist/typescript/src/lib/utils/scales/scales.d.ts.map +1 -1
  119. package/dist/typescript/src/lib/utils/ticks/ticks.d.ts +13 -5
  120. package/dist/typescript/src/lib/utils/ticks/ticks.d.ts.map +1 -1
  121. package/dist/typescript/src/lib/utils/types.d.ts +3 -28
  122. package/dist/typescript/src/lib/utils/types.d.ts.map +1 -1
  123. package/package.json +4 -4
  124. package/src/lib/Components/Axis/Axis.constants.ts +23 -0
  125. package/src/lib/Components/Axis/Axis.types.ts +40 -0
  126. package/src/lib/Components/Axis/index.ts +2 -0
  127. package/src/lib/Components/CartesianChart/CartesianChart.tsx +39 -23
  128. package/src/lib/Components/CartesianChart/context/useBuildChartContext.test.ts +56 -0
  129. package/src/lib/Components/CartesianChart/context/useBuildChartContext.ts +8 -8
  130. package/src/lib/Components/CartesianChart/types.ts +11 -3
  131. package/src/lib/Components/CartesianChart/utils.ts +22 -12
  132. package/src/lib/Components/Line/utils.test.ts +90 -0
  133. package/src/lib/Components/Line/utils.ts +6 -1
  134. package/src/lib/Components/LineChart/LineChart.stories.tsx +36 -0
  135. package/src/lib/Components/LineChart/LineChart.test.tsx +156 -0
  136. package/src/lib/Components/LineChart/LineChart.tsx +30 -40
  137. package/src/lib/Components/LineChart/types.ts +10 -3
  138. package/src/lib/Components/Point/Point.tsx +9 -3
  139. package/src/lib/Components/Point/constants.ts +6 -0
  140. package/src/lib/Components/Point/pointContext/MagneticPointsProvider.test.tsx +162 -0
  141. package/src/lib/Components/Point/pointContext/MagneticPointsProvider.tsx +45 -0
  142. package/src/lib/Components/Point/pointContext/index.ts +5 -0
  143. package/src/lib/Components/Point/pointContext/magneticPointsContext.ts +19 -0
  144. package/src/lib/Components/Point/types.ts +7 -0
  145. package/src/lib/Components/Point/utils.test.ts +95 -5
  146. package/src/lib/Components/Point/utils.ts +35 -7
  147. package/src/lib/Components/ReferenceLine/utils.ts +4 -7
  148. package/src/lib/Components/Scrubber/DefaultScrubberTooltip/ChartTooltipItem.tsx +3 -3
  149. package/src/lib/Components/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.test.tsx +5 -5
  150. package/src/lib/Components/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.tsx +4 -5
  151. package/src/lib/Components/Scrubber/DefaultScrubberTooltip/constants.ts +1 -2
  152. package/src/lib/Components/Scrubber/DefaultScrubberTooltip/utils.test.ts +4 -4
  153. package/src/lib/Components/Scrubber/DefaultScrubberTooltip/utils.ts +29 -15
  154. package/src/lib/Components/Scrubber/ScrubberProvider.tsx +41 -5
  155. package/src/lib/Components/Scrubber/types.ts +13 -0
  156. package/src/lib/Components/Scrubber/utils.test.ts +150 -0
  157. package/src/lib/Components/Scrubber/utils.ts +93 -3
  158. package/src/lib/utils/domain/domain.ts +6 -5
  159. package/src/lib/utils/index.ts +0 -2
  160. package/src/lib/utils/scales/scales.test.ts +19 -0
  161. package/src/lib/utils/scales/scales.ts +15 -9
  162. package/src/lib/utils/ticks/ticks.test.ts +45 -0
  163. package/src/lib/utils/ticks/ticks.ts +19 -9
  164. package/src/lib/utils/types.ts +3 -26
@@ -1,4 +1,5 @@
1
1
  import type { ReactNode } from 'react';
2
+ import type { StyleProp, ViewStyle } from 'react-native';
2
3
  import type { DrawingArea } from '../../utils/types';
3
4
  export type ScrubberContextValue = {
4
5
  /**
@@ -32,6 +33,18 @@ export type ScrubberProviderProps = {
32
33
  * Optional external callback fired whenever the scrubber position changes.
33
34
  */
34
35
  onScrubberPositionChange?: (index: number | undefined) => void;
36
+ /**
37
+ * Pixel radius within which the scrubber magnetically snaps to registered
38
+ * magnetic points. Set to `0` to disable magnetisation.
39
+ * @default 6
40
+ */
41
+ magnetRadius?: number;
42
+ /**
43
+ * Optional style applied to the wrapping `View` that holds the chart and the
44
+ * gesture overlay.Used to offset the(enlarged) SVG group so its drawing area
45
+ * aligns with the container footprint.
46
+ */
47
+ style?: StyleProp<ViewStyle>;
35
48
  };
36
49
  export type ChartTooltipItemData = {
37
50
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Scrubber/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,MAAM,oBAAoB,GAAG;IACjC;;OAEG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC;;OAEG;IACH,wBAAwB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAC/D,CAAC;AAEF,MAAM,MAAM,qBAAqB,GA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OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,0BAA0B,GAAG;IAC9D;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,WAAW,EAAE,WAAW,CAAC;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;OAEG;IACH,KAAK,EAAE,oBAAoB,EAAE,CAAC;CAC/B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,0BAA0B,GAAG;IAChE;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;IAC3E;;OAEG;IACH,KAAK,EAAE,oBAAoB,EAAE,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,sBAAsB,CAAC;CACzD,CAAC"}
@@ -1,4 +1,9 @@
1
- import type { AxisConfigProps, CartesianChartContextValue, ChartScaleFunction } from '../../utils/types';
1
+ import type { CartesianChartContextValue, ChartScaleFunction } from '../../utils/types';
2
+ import type { BaseAxisProps } from '../Axis';
3
+ export type MagnetEntry = {
4
+ index: number;
5
+ pixelX: number;
6
+ };
2
7
  /**
3
8
  * Converts a pixel position along the x-axis into the nearest data index.
4
9
  *
@@ -6,7 +11,7 @@ import type { AxisConfigProps, CartesianChartContextValue, ChartScaleFunction }
6
11
  * `pixelX`. For numeric scales, uses `scale.invert()` and rounds to the
7
12
  * nearest integer, clamped to the valid index range.
8
13
  */
9
- export declare const getDataIndexFromPosition: (pixelX: number, scale: ChartScaleFunction, axisConfig: Partial<AxisConfigProps> | undefined, dataLength: number) => number;
14
+ export declare const getDataIndexFromPosition: (pixelX: number, scale: ChartScaleFunction, axisConfig: Partial<BaseAxisProps> | undefined, dataLength: number) => number;
10
15
  /**
11
16
  * Resolves the pixel y-coordinate for a given series data point at a data index.
12
17
  * Returns undefined when the value is null/missing or the scale is unavailable.
@@ -18,5 +23,30 @@ export declare const resolvePixelY: (dataIndex: number, seriesData: (number | nu
18
23
  * otherwise the data index is used as the x input.
19
24
  * Returns undefined only when the scale is unavailable.
20
25
  */
21
- export declare const resolvePixelX: (dataIndex: number, getXScale: CartesianChartContextValue["getXScale"], axisConfig?: AxisConfigProps) => number | undefined;
26
+ export declare const resolvePixelX: (dataIndex: number, getXScale: CartesianChartContextValue["getXScale"], axisConfig?: BaseAxisProps) => number | undefined;
27
+ /**
28
+ * Resolves each magnetic index to its pixel position and returns them sorted
29
+ * by `pixelX` ascending. Indices that cannot be projected are filtered out.
30
+ * The sorted output enables early-exit in {@link applyMagnetisation}.
31
+ */
32
+ export declare const buildSortedMagnets: ({ magneticIndices, getPixelForIndex, }: {
33
+ magneticIndices: ReadonlySet<number>;
34
+ getPixelForIndex: (index: number) => number | undefined;
35
+ }) => MagnetEntry[];
36
+ /**
37
+ * Binary search for the magnet whose `pixelX` is closest to `pixelX`.
38
+ * Returns -1 when the array is empty. Favors the left neighbor on ties.
39
+ */
40
+ export declare const nearestIndex: (sortedMagnets: readonly MagnetEntry[], pixelX: number) => number;
41
+ /**
42
+ * Given a resolved data index and the raw pixel position, checks whether any
43
+ * magnetic point is within `magnetRadius` pixels of `pixelX`. If so, returns
44
+ * the closest magnetic index; otherwise returns the original `resolvedIndex`.
45
+ */
46
+ export declare const applyMagnetisation: ({ resolvedIndex, pixelX, sortedMagnets, magnetRadius, }: {
47
+ resolvedIndex: number;
48
+ pixelX: number;
49
+ sortedMagnets: readonly MagnetEntry[];
50
+ magnetRadius: number;
51
+ }) => number;
22
52
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Scrubber/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,eAAe,EACf,0BAA0B,EAC1B,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAgC3B;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GACnC,QAAQ,MAAM,EACd,OAAO,kBAAkB,EACzB,YAAY,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,EAChD,YAAY,MAAM,KACjB,MAmCF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,GACxB,WAAW,MAAM,EACjB,YAAY,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,SAAS,EACzC,WAAW,0BAA0B,CAAC,WAAW,CAAC,KACjD,MAAM,GAAG,SASX,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GACxB,WAAW,MAAM,EACjB,WAAW,0BAA0B,CAAC,WAAW,CAAC,EAClD,aAAa,eAAe,KAC3B,MAAM,GAAG,SAMX,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Scrubber/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,0BAA0B,EAC1B,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAgCF;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GACnC,QAAQ,MAAM,EACd,OAAO,kBAAkB,EACzB,YAAY,OAAO,CAAC,aAAa,CAAC,GAAG,SAAS,EAC9C,YAAY,MAAM,KACjB,MAmCF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,GACxB,WAAW,MAAM,EACjB,YAAY,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,SAAS,EACzC,WAAW,0BAA0B,CAAC,WAAW,CAAC,KACjD,MAAM,GAAG,SASX,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GACxB,WAAW,MAAM,EACjB,WAAW,0BAA0B,CAAC,WAAW,CAAC,EAClD,aAAa,aAAa,KACzB,MAAM,GAAG,SAMX,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,wCAGhC;IACD,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACrC,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CACzD,KAAG,WAAW,EAad,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,GACvB,eAAe,SAAS,WAAW,EAAE,EACrC,QAAQ,MAAM,KACb,MAsBF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,yDAKhC;IACD,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,SAAS,WAAW,EAAE,CAAC;IACtC,YAAY,EAAE,MAAM,CAAC;CACtB,KAAG,MAWH,CAAC"}
@@ -1,17 +1,18 @@
1
- import type { AxisBounds, AxisConfigProps, Series } from '../types';
1
+ import type { AxisBounds, BaseAxisProps } from '../../Components/Axis';
2
+ import type { Series } from '../types';
2
3
  /**
3
4
  * Compute the X domain (index-based) from series data and axis config.
4
5
  * For the X axis the domain is typically 0..N-1 where N = longest series length,
5
6
  * unless explicit `data` is provided on the axis config.
6
7
  */
7
- export declare const computeXDomain: (series: Series[], axisConfig?: Partial<AxisConfigProps>) => AxisBounds;
8
+ export declare const computeXDomain: (series: Series[], axisConfig?: Partial<BaseAxisProps>) => AxisBounds;
8
9
  /**
9
10
  * Compute the Y domain (value-based) from series data and axis config.
10
11
  * Scans all non-null values across all series to find min/max.
11
12
  */
12
- export declare const computeYDomain: (series: Series[], axisConfig?: Partial<AxisConfigProps>) => AxisBounds;
13
+ export declare const computeYDomain: (series: Series[], axisConfig?: Partial<BaseAxisProps>) => AxisBounds;
13
14
  /**
14
15
  * Compute the data length (number of discrete positions on the index axis).
15
16
  */
16
- export declare const computeDataLength: (series: Series[], axisConfig?: Partial<AxisConfigProps>) => number;
17
+ export declare const computeDataLength: (series: Series[], axisConfig?: Partial<BaseAxisProps>) => number;
17
18
  //# sourceMappingURL=domain.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/utils/domain/domain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEpE;;;;GAIG;AACH,eAAO,MAAM,cAAc,GACzB,QAAQ,MAAM,EAAE,EAChB,aAAa,OAAO,CAAC,eAAe,CAAC,KACpC,UA4BF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,GACzB,QAAQ,MAAM,EAAE,EAChB,aAAa,OAAO,CAAC,eAAe,CAAC,KACpC,UAwBF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,MAAM,EAAE,EAChB,aAAa,OAAO,CAAC,eAAe,CAAC,KACpC,MAKF,CAAC"}
1
+ {"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/utils/domain/domain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC;;;;GAIG;AACH,eAAO,MAAM,cAAc,GACzB,QAAQ,MAAM,EAAE,EAChB,aAAa,OAAO,CAAC,aAAa,CAAC,KAClC,UA4BF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,GACzB,QAAQ,MAAM,EAAE,EAChB,aAAa,OAAO,CAAC,aAAa,CAAC,KAClC,UAwBF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,MAAM,EAAE,EAChB,aAAa,OAAO,CAAC,aAAa,CAAC,KAClC,MAKF,CAAC"}
@@ -1,2 +1,2 @@
1
- export type { AxisBounds, AxisConfigProps, CartesianChartContextValue, CategoricalScale, ChartInset, ChartScaleFunction, DrawingArea, NumericScale, Series, } from './types';
1
+ export type { CartesianChartContextValue, CategoricalScale, ChartInset, ChartScaleFunction, DrawingArea, NumericScale, Series, } from './types';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,eAAe,EACf,0BAA0B,EAC1B,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,MAAM,GACP,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,0BAA0B,EAC1B,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,MAAM,GACP,MAAM,SAAS,CAAC"}
@@ -1,12 +1,18 @@
1
- import type { AxisBounds, AxisConfigProps, CategoricalScale, ChartScaleFunction, NumericScale } from '../types';
1
+ import type { AxisBounds, BaseAxisProps } from '../../Components/Axis';
2
+ import type { CategoricalScale, ChartScaleFunction, NumericScale } from '../types';
2
3
  /**
3
- * Creates a numeric scale with `.nice()` applied so the domain
4
- * extends to clean rounded boundaries (e.g. `[4, 98]` → `[0, 100]`).
4
+ * Creates a numeric scale.
5
+ *
6
+ * When `nice` is `true` (default), the domain is rounded outward to clean
7
+ * boundaries via d3's `.nice()` (e.g. `[4, 98]` → `[0, 100]`). Set `nice` to
8
+ * `false` to keep the domain exactly as provided so data fills the range
9
+ * boundary-to-boundary.
5
10
  */
6
- export declare const getNumericScale: ({ scaleType, domain, range, }: {
11
+ export declare const getNumericScale: ({ scaleType, domain, range, nice, }: {
7
12
  scaleType: "linear" | "log";
8
13
  domain: AxisBounds;
9
14
  range: AxisBounds;
15
+ nice?: boolean;
10
16
  }) => NumericScale;
11
17
  export declare const getCategoricalScale: ({ domain, range, padding, }: {
12
18
  domain: AxisBounds;
@@ -16,7 +22,7 @@ export declare const getCategoricalScale: ({ domain, range, padding, }: {
16
22
  /**
17
23
  * Checks if a scale type config value refers to a band (categorical) scale.
18
24
  */
19
- export declare const isBandScaleType: (scaleType: AxisConfigProps["scaleType"]) => scaleType is "band";
25
+ export declare const isBandScaleType: (scaleType: BaseAxisProps["scaleType"]) => scaleType is "band";
20
26
  /**
21
27
  * Checks if a scale is a categorical scale.
22
28
  */
@@ -1 +1 @@
1
- {"version":3,"file":"scales.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/utils/scales/scales.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACb,MAAM,UAAU,CAAC;AAElB;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,+BAI7B;IACD,SAAS,EAAE,QAAQ,GAAG,KAAK,CAAC;IAC5B,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;CACnB,KAAG,YAMH,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,6BAIjC;IACD,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,KAAG,gBAUH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAC1B,WAAW,eAAe,CAAC,WA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AC;AAE/C;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,kBAAkB,KACxB,KAAK,IAAI,gBAEX,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GACzB,OAAO,kBAAkB,KACxB,KAAK,IAAI,YAEX,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAC1B,WAAW,MAAM,EACjB,OAAO,kBAAkB,KACxB,MAKF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GACvB,OAAO,MAAM,EACb,OAAO,MAAM,EACb,QAAQ,kBAAkB,EAC1B,QAAQ,kBAAkB,KACzB;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAGvB,CAAC"}
@@ -1,4 +1,5 @@
1
- import type { AxisConfigProps, ChartScaleFunction, DrawingArea } from '../types';
1
+ import type { BaseAxisProps } from '../../Components/Axis';
2
+ import type { ChartScaleFunction, DrawingArea } from '../types';
2
3
  export declare const APPROXIMATE_TICK_COUNT = 5;
3
4
  export type TickData = {
4
5
  position: number;
@@ -7,9 +8,16 @@ export type TickData = {
7
8
  };
8
9
  /**
9
10
  * Resolves which numeric tick values should appear on the axis.
10
- * Explicit ticks take priority, then scale-specific defaults.
11
+ *
12
+ * Priority:
13
+ * 1. Explicit `ticks` provided by the consumer.
14
+ * 2. Axis `data` — when provided, ticks come from the data itself (numeric
15
+ * values for numeric data, indices for string data) so the rendered ticks
16
+ * mirror exactly what the consumer asked for, with no d3-invented
17
+ * intermediate values.
18
+ * 3. Scale-specific defaults (band domain, or `scale.ticks()` for numeric).
11
19
  */
12
- export declare const getTickValues: (scale: ChartScaleFunction, explicitTicks?: number[]) => number[];
20
+ export declare const getTickValues: (scale: ChartScaleFunction, explicitTicks?: number[], axisData?: BaseAxisProps["data"]) => number[];
13
21
  /**
14
22
  * Converts a tick value to its pixel position on the axis.
15
23
  * Band scales are centered within the band.
@@ -19,11 +27,11 @@ export declare const getTickPosition: (scale: ChartScaleFunction, tick: number)
19
27
  * Resolves the display label for a tick value.
20
28
  * Priority: formatter > string label lookup > raw value.
21
29
  */
22
- export declare const getTickLabel: (tick: number, axisData: AxisConfigProps["data"], formatter?: (value: number | string) => string) => string;
30
+ export declare const getTickLabel: (tick: number, axisData: BaseAxisProps["data"], formatter?: (value: number | string) => string) => string;
23
31
  /**
24
32
  * Builds the complete tick data array from a scale and axis configuration.
25
33
  */
26
- export declare const buildTicksData: (scale: ChartScaleFunction, axisConfig?: AxisConfigProps, explicitTicks?: number[], formatter?: (value: number | string) => string) => TickData[];
34
+ export declare const buildTicksData: (scale: ChartScaleFunction, axisConfig?: BaseAxisProps, explicitTicks?: number[], formatter?: (value: number | string) => string) => TickData[];
27
35
  /**
28
36
  * Excludes the X grid line at the Y-axis origin (left edge)
29
37
  * to prevent overlap with the Y-axis solid line.
@@ -1 +1 @@
1
- {"version":3,"file":"ticks.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/utils/ticks/ticks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,WAAW,EACZ,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,GACxB,OAAO,kBAAkB,EACzB,gBAAgB,MAAM,EAAE,KACvB,MAAM,EAKR,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,kBAAkB,EACzB,MAAM,MAAM,KACX,MAKF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,GACvB,MAAM,MAAM,EACZ,UAAU,eAAe,CAAC,MAAM,CAAC,EACjC,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK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O,MAAM,cAAc,GACzB,OAAO,kBAAkB,EACzB,aAAa,aAAa,EAC1B,gBAAgB,MAAM,EAAE,EACxB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,KAC7C,QAAQ,EASV,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,GAClC,MAAM,QAAQ,EACd,aAAa,WAAW,KACvB,OAEF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,GAClC,MAAM,QAAQ,EACd,aAAa,WAAW,KACvB,OAEF,CAAC"}
@@ -1,8 +1,5 @@
1
1
  import type { ScaleBand, ScaleLinear, ScaleLogarithmic } from 'd3-scale';
2
- export type AxisBounds = {
3
- min: number;
4
- max: number;
5
- };
2
+ import type { BaseAxisProps } from '../Components/Axis';
6
3
  export type ChartInset = {
7
4
  top: number;
8
5
  right: number;
@@ -36,28 +33,6 @@ export type Series = {
36
33
  */
37
34
  stroke: string;
38
35
  };
39
- export type AxisConfigProps = {
40
- /**
41
- * Scale algorithm used by this axis.
42
- * @default 'linear'
43
- */
44
- scaleType?: 'linear' | 'log' | 'band';
45
- /**
46
- * Explicit data values for band scales or category labels.
47
- * For band scales, provides the discrete domain. For numeric scales, string values
48
- * are used as tick labels at corresponding indices.
49
- */
50
- data?: string[] | number[];
51
- /**
52
- * Fixed domain bounds or a function that adjusts the computed bounds.
53
- * A partial object overrides only the specified bound(s).
54
- * A function receives the auto-computed bounds and returns adjusted ones.
55
- *
56
- * The final domain is always rounded to nice boundaries via d3's `.nice()`,
57
- * ensuring tick marks land on clean values (e.g. `[4, 98]` becomes `[0, 100]`).
58
- */
59
- domain?: Partial<AxisBounds> | ((bounds: AxisBounds) => AxisBounds);
60
- };
61
36
  export type NumericScale = ScaleLinear<number, number> | ScaleLogarithmic<number, number>;
62
37
  export type CategoricalScale = ScaleBand<number>;
63
38
  export type ChartScaleFunction = NumericScale | CategoricalScale;
@@ -81,11 +56,11 @@ export type CartesianChartContextValue = {
81
56
  /**
82
57
  * Returns the x-axis config. Accepts an optional axis ID for future multi-axis support.
83
58
  */
84
- getXAxisConfig: (id?: string) => AxisConfigProps | undefined;
59
+ getXAxisConfig: (id?: string) => BaseAxisProps | undefined;
85
60
  /**
86
61
  * Returns the y-axis config. Accepts an optional axis ID for future multi-axis support.
87
62
  */
88
- getYAxisConfig: (id?: string) => AxisConfigProps | undefined;
63
+ getYAxisConfig: (id?: string) => BaseAxisProps | undefined;
89
64
  /**
90
65
  * Pixel bounds of the drawable region.
91
66
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEzE,MAAM,MAAM,UAAU,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtD,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACnB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IACzB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B;;;OAGG;I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,CAAC,EAAE,MAAM,KAAK,kBAAkB,GAAG,SAAS,CAAC;IAC3D;;OAEG;IACH,cAAc,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,aAAa,GAAG,SAAS,CAAC;IAC3D;;OAEG;IACH,cAAc,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,aAAa,GAAG,SAAS,CAAC;IAC3D;;OAEG;IACH,WAAW,EAAE,WAAW,CAAC;IACzB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/lumen-ui-rnative-visualization",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "keywords": [
@@ -31,7 +31,7 @@
31
31
  "!**/*.tsbuildinfo"
32
32
  ],
33
33
  "dependencies": {
34
- "@ledgerhq/lumen-utils-shared": "0.1.4",
34
+ "@ledgerhq/lumen-utils-shared": "0.1.5",
35
35
  "d3-array": "^3.2.4",
36
36
  "d3-scale": "^4.0.2",
37
37
  "d3-shape": "^3.2.0"
@@ -44,8 +44,8 @@
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@types/react": "^19.0.0",
47
- "@ledgerhq/lumen-design-core": "0.1.15",
48
- "@ledgerhq/lumen-ui-rnative": "0.1.37",
47
+ "@ledgerhq/lumen-design-core": "0.1.16",
48
+ "@ledgerhq/lumen-ui-rnative": "0.1.39",
49
49
  "react": "^19.0.0",
50
50
  "react-native": "~0.79.7",
51
51
  "react-native-svg": "^15.0.0",
@@ -0,0 +1,23 @@
1
+ import type { XAxisProps } from './XAxis';
2
+ import { DEFAULT_AXIS_WIDTH } from './YAxis';
3
+
4
+ import type { YAxisProps } from './YAxis';
5
+
6
+ export const defaultXAxisProps: XAxisProps = {
7
+ position: 'bottom',
8
+ showGrid: false,
9
+ showLine: false,
10
+ showTickMark: false,
11
+ scaleType: 'linear',
12
+ nice: false,
13
+ };
14
+
15
+ export const defaultYAxisProps: YAxisProps = {
16
+ position: 'start',
17
+ showGrid: false,
18
+ showLine: false,
19
+ showTickMark: false,
20
+ scaleType: 'linear',
21
+ nice: true,
22
+ width: DEFAULT_AXIS_WIDTH,
23
+ };
@@ -1,3 +1,8 @@
1
+ export type AxisBounds = {
2
+ min: number;
3
+ max: number;
4
+ };
5
+
1
6
  export type BaseAxisProps = {
2
7
  /**
3
8
  * Whether to render grid lines at each tick.
@@ -29,4 +34,39 @@ export type BaseAxisProps = {
29
34
  * Receives the raw tick value (number or string label) and must return a string.
30
35
  */
31
36
  tickLabelFormatter?: (value: number | string) => string;
37
+ /**
38
+ * Scale algorithm used by this axis.
39
+ * @default 'linear'
40
+ */
41
+ scaleType?: 'linear' | 'log' | 'band';
42
+ /**
43
+ * Explicit data values for band scales or category labels.
44
+ * For band scales, provides the discrete domain. For numeric scales, string values
45
+ * are used as tick labels at corresponding indices.
46
+ */
47
+ data?: string[] | number[];
48
+ /**
49
+ * Fixed domain bounds or a function that adjusts the computed bounds.
50
+ * A partial object overrides only the specified bound(s).
51
+ * A function receives the auto-computed bounds and returns adjusted ones.
52
+ *
53
+ * Applied before {@link BaseAxisProps.nice}. To keep your bounds exactly as
54
+ * provided, set `nice: false` alongside a full `{ min, max }` override.
55
+ */
56
+ domain?: Partial<AxisBounds> | ((bounds: AxisBounds) => AxisBounds);
57
+ /**
58
+ * Round the domain outward to clean boundaries via d3's `.nice()`
59
+ * (e.g. `[4, 98]` becomes `[0, 100]`).
60
+ *
61
+ * Defaults to `true` for Y Axis and `false` for X Axis.
62
+ *
63
+ * Set to `false` to keep the domain exactly as provided
64
+ * so data fills the plot area boundary-to-boundary — typically only useful
65
+ * when you also pass a full `domain: { min, max }` and don't have overlays
66
+ * (reference lines, scrubber positions, annotations) that may sit outside
67
+ * the data range.
68
+ *
69
+ * Applied after any {@link BaseAxisProps.domain} override.
70
+ */
71
+ nice?: boolean;
32
72
  };
@@ -0,0 +1,2 @@
1
+ export * from './Axis.types';
2
+ export * from './Axis.constants';
@@ -2,13 +2,15 @@ import { useCallback, useMemo, useState } from 'react';
2
2
  import { View, type LayoutChangeEvent } from 'react-native';
3
3
  import { Svg } from 'react-native-svg';
4
4
 
5
+ import { MagneticPointsProvider } from '../Point/pointContext';
5
6
  import { ScrubberProvider } from '../Scrubber/ScrubberProvider';
6
7
  import { CartesianChartProvider, useBuildChartContext } from './context';
7
8
  import { RevealClipDefs } from './RevealClip';
8
9
  import type { CartesianChartProps } from './types';
9
10
  import {
10
11
  DEFAULT_HEIGHT,
11
- OVERFLOW_NEGATIVE_MARGIN,
12
+ OVERFLOW_BUFFER,
13
+ OVERFLOW_OFFSET,
12
14
  resolveAxisPadding,
13
15
  resolveInset,
14
16
  } from './utils';
@@ -26,6 +28,7 @@ export function CartesianChart({
26
28
  enableScrubbing = false,
27
29
  onScrubberPositionChange,
28
30
  animate = true,
31
+ magnetRadius,
29
32
  }: Readonly<CartesianChartProps>) {
30
33
  const [measuredWidth, setMeasuredWidth] = useState<number | undefined>(width);
31
34
 
@@ -41,6 +44,15 @@ export function CartesianChart({
41
44
 
42
45
  const resolvedWidth = width ?? measuredWidth ?? 0;
43
46
 
47
+ // The SVG canvas is enlarged by the overflow buffer on every side so edge
48
+ // content (labels, points, ticks) is not clipped, then shifted back by
49
+ // `OVERFLOW_OFFSET` so the drawing area still spans the container footprint.
50
+ const svgWidth =
51
+ resolvedWidth > 0
52
+ ? resolvedWidth + OVERFLOW_BUFFER.left + OVERFLOW_BUFFER.right
53
+ : 0;
54
+ const svgHeight = height + OVERFLOW_BUFFER.top + OVERFLOW_BUFFER.bottom;
55
+
44
56
  const resolvedInset = useMemo(() => resolveInset(inset), [inset]);
45
57
  const resolvedAxisPadding = useMemo(
46
58
  () => resolveAxisPadding(axisPadding),
@@ -51,8 +63,8 @@ export function CartesianChart({
51
63
  series,
52
64
  xAxis,
53
65
  yAxis,
54
- width: resolvedWidth,
55
- height,
66
+ width: svgWidth,
67
+ height: svgHeight,
56
68
  inset: resolvedInset,
57
69
  axisPadding: resolvedAxisPadding,
58
70
  });
@@ -66,32 +78,36 @@ export function CartesianChart({
66
78
  style={{
67
79
  width: needsMeasurement ? undefined : resolvedWidth,
68
80
  height,
69
- ...OVERFLOW_NEGATIVE_MARGIN,
81
+ overflow: 'visible',
70
82
  }}
71
83
  >
72
84
  {resolvedWidth > 0 && (
73
85
  <CartesianChartProvider value={contextValue}>
74
- <ScrubberProvider
75
- width={resolvedWidth}
76
- height={height}
77
- enableScrubbing={enableScrubbing}
78
- onScrubberPositionChange={onScrubberPositionChange}
79
- >
80
- <Svg
81
- testID='chart-svg'
82
- width={resolvedWidth}
83
- height={height}
84
- style={{ overflow: 'visible' }}
86
+ <MagneticPointsProvider>
87
+ <ScrubberProvider
88
+ width={svgWidth}
89
+ height={svgHeight}
90
+ enableScrubbing={enableScrubbing}
91
+ onScrubberPositionChange={onScrubberPositionChange}
92
+ style={OVERFLOW_OFFSET}
93
+ magnetRadius={magnetRadius}
85
94
  >
86
- <RevealClipDefs
87
- drawingArea={contextValue.drawingArea}
88
- series={series}
89
- animate={animate}
95
+ <Svg
96
+ testID='chart-svg'
97
+ width={svgWidth}
98
+ height={svgHeight}
99
+ style={{ overflow: 'visible' }}
90
100
  >
91
- {children}
92
- </RevealClipDefs>
93
- </Svg>
94
- </ScrubberProvider>
101
+ <RevealClipDefs
102
+ drawingArea={contextValue.drawingArea}
103
+ series={series}
104
+ animate={animate}
105
+ >
106
+ {children}
107
+ </RevealClipDefs>
108
+ </Svg>
109
+ </ScrubberProvider>
110
+ </MagneticPointsProvider>
95
111
  </CartesianChartProvider>
96
112
  )}
97
113
  </View>
@@ -221,4 +221,60 @@ describe('useBuildChartContext', () => {
221
221
  expect(result.current.drawingArea.width).toBe(400 - 40);
222
222
  expect(result.current.drawingArea.height).toBe(200 - 28);
223
223
  });
224
+
225
+ describe('nice domain prop', () => {
226
+ // Series of length 3770 → auto X domain is [0, 3769]; `.nice()` rounds it
227
+ // outward to [0, 4000] (the trailing "dead zone" keeps overlays that sit
228
+ // outside the data range — e.g. reference lines — from being clipped).
229
+ const longSeries = makeSeries(Array.from({ length: 3770 }, (_, i) => i));
230
+
231
+ it('rounds the X domain by default (.nice())', () => {
232
+ const { result } = renderHook(() =>
233
+ useBuildChartContext(hookParams({ series: [longSeries] })),
234
+ );
235
+ expect(result.current.getXScale()!.domain()).toEqual([0, 4000]);
236
+ });
237
+
238
+ it('rounds the Y domain by default (.nice())', () => {
239
+ const { result } = renderHook(() =>
240
+ useBuildChartContext(
241
+ hookParams({
242
+ yAxis: {
243
+ domain: (bounds: { min: number; max: number }) => ({
244
+ min: bounds.min - 5,
245
+ max: bounds.max + 5,
246
+ }),
247
+ },
248
+ }),
249
+ ),
250
+ );
251
+ expect(result.current.getYScale()!.domain()).toEqual([0, 40]);
252
+ });
253
+
254
+ it('opts the X axis out of .nice() when nice is false', () => {
255
+ const { result } = renderHook(() =>
256
+ useBuildChartContext(
257
+ hookParams({ series: [longSeries], xAxis: { nice: false } }),
258
+ ),
259
+ );
260
+ expect(result.current.getXScale()!.domain()).toEqual([0, 3769]);
261
+ });
262
+
263
+ it('opts the Y axis out of .nice() when nice is false', () => {
264
+ const { result } = renderHook(() =>
265
+ useBuildChartContext(
266
+ hookParams({
267
+ yAxis: {
268
+ nice: false,
269
+ domain: (bounds: { min: number; max: number }) => ({
270
+ min: bounds.min - 5,
271
+ max: bounds.max + 5,
272
+ }),
273
+ },
274
+ }),
275
+ ),
276
+ );
277
+ expect(result.current.getYScale()!.domain()).toEqual([5, 35]);
278
+ });
279
+ });
224
280
  });
@@ -11,19 +11,18 @@ import {
11
11
  isBandScaleType,
12
12
  } from '../../../utils/scales/scales';
13
13
  import type {
14
- AxisBounds,
15
- AxisConfigProps,
16
14
  CartesianChartContextValue,
17
15
  ChartInset,
18
16
  ChartScaleFunction,
19
17
  DrawingArea,
20
18
  Series,
21
19
  } from '../../../utils/types';
20
+ import type { AxisBounds, BaseAxisProps } from '../../Axis';
22
21
 
23
22
  type UseBuildChartContextParams = {
24
23
  series: Series[];
25
- xAxis?: Partial<AxisConfigProps>;
26
- yAxis?: Partial<AxisConfigProps>;
24
+ xAxis?: Partial<BaseAxisProps>;
25
+ yAxis?: Partial<BaseAxisProps>;
27
26
  width: number;
28
27
  height: number;
29
28
  inset: ChartInset;
@@ -45,11 +44,12 @@ export const computeAxisRange = (
45
44
  export const buildScale = (
46
45
  domain: AxisBounds,
47
46
  range: AxisRange,
48
- scaleType: AxisConfigProps['scaleType'] = 'linear',
47
+ scaleType: BaseAxisProps['scaleType'] = 'linear',
48
+ nice?: boolean,
49
49
  ): ChartScaleFunction =>
50
50
  isBandScaleType(scaleType)
51
51
  ? getCategoricalScale({ domain, range })
52
- : getNumericScale({ scaleType, domain, range });
52
+ : getNumericScale({ scaleType, domain, range, nice });
53
53
 
54
54
  export const computeDrawingArea = (
55
55
  width: number,
@@ -94,8 +94,8 @@ export const useBuildChartContext = ({
94
94
  if (drawingArea.width > 0 && drawingArea.height > 0) {
95
95
  const xDomain = computeXDomain(series, xAxis);
96
96
  const yDomain = computeYDomain(series, yAxis);
97
- xScale = buildScale(xDomain, xRange, xAxis?.scaleType);
98
- yScale = buildScale(yDomain, yRange, yAxis?.scaleType);
97
+ xScale = buildScale(xDomain, xRange, xAxis?.scaleType, xAxis?.nice);
98
+ yScale = buildScale(yDomain, yRange, yAxis?.scaleType, yAxis?.nice);
99
99
  }
100
100
 
101
101
  const dataLength = computeDataLength(series, xAxis);