react-native-livechart 4.16.0 → 4.18.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 (58) hide show
  1. package/dist/components/CustomMarkerOverlay.d.ts.map +1 -1
  2. package/dist/components/DotOverlay.d.ts +7 -1
  3. package/dist/components/DotOverlay.d.ts.map +1 -1
  4. package/dist/components/LiveChart.d.ts.map +1 -1
  5. package/dist/components/LiveChartSeries.d.ts.map +1 -1
  6. package/dist/components/MarkerOverlay.d.ts.map +1 -1
  7. package/dist/core/liveChartEngineTick.d.ts.map +1 -1
  8. package/dist/core/liveChartSeriesEngineTick.d.ts.map +1 -1
  9. package/dist/core/resolveConfig.d.ts +9 -0
  10. package/dist/core/resolveConfig.d.ts.map +1 -1
  11. package/dist/core/useLiveChartEngine.d.ts.map +1 -1
  12. package/dist/core/useLiveChartSeriesEngine.d.ts.map +1 -1
  13. package/dist/draw/line.d.ts +2 -2
  14. package/dist/draw/line.d.ts.map +1 -1
  15. package/dist/hooks/crosshairShared.d.ts +8 -0
  16. package/dist/hooks/crosshairShared.d.ts.map +1 -1
  17. package/dist/hooks/resolveChartLayout.d.ts +4 -1
  18. package/dist/hooks/resolveChartLayout.d.ts.map +1 -1
  19. package/dist/hooks/useCandlePaths.d.ts +22 -11
  20. package/dist/hooks/useCandlePaths.d.ts.map +1 -1
  21. package/dist/hooks/useChartReveal.d.ts +3 -2
  22. package/dist/hooks/useChartReveal.d.ts.map +1 -1
  23. package/dist/hooks/useCrosshair.d.ts +7 -1
  24. package/dist/hooks/useCrosshair.d.ts.map +1 -1
  25. package/dist/hooks/useLiveDot.d.ts +8 -2
  26. package/dist/hooks/useLiveDot.d.ts.map +1 -1
  27. package/dist/hooks/useMarkers.d.ts.map +1 -1
  28. package/dist/hooks/usePanScroll.d.ts +8 -1
  29. package/dist/hooks/usePanScroll.d.ts.map +1 -1
  30. package/dist/index.d.ts +1 -1
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/math/markerCluster.d.ts +9 -0
  33. package/dist/math/markerCluster.d.ts.map +1 -1
  34. package/dist/types.d.ts +71 -2
  35. package/dist/types.d.ts.map +1 -1
  36. package/package.json +1 -1
  37. package/src/components/CustomMarkerOverlay.tsx +5 -1
  38. package/src/components/DotOverlay.tsx +9 -2
  39. package/src/components/LiveChart.tsx +128 -17
  40. package/src/components/LiveChartSeries.tsx +4 -0
  41. package/src/components/MarkerOverlay.tsx +5 -1
  42. package/src/core/liveChartEngineTick.ts +5 -1
  43. package/src/core/liveChartSeriesEngineTick.ts +5 -1
  44. package/src/core/resolveConfig.ts +20 -0
  45. package/src/core/useLiveChartEngine.ts +6 -2
  46. package/src/core/useLiveChartSeriesEngine.ts +4 -2
  47. package/src/draw/line.ts +4 -3
  48. package/src/hooks/crosshairShared.ts +31 -0
  49. package/src/hooks/resolveChartLayout.ts +14 -2
  50. package/src/hooks/useCandlePaths.ts +41 -27
  51. package/src/hooks/useChartReveal.ts +11 -3
  52. package/src/hooks/useCrosshair.ts +29 -2
  53. package/src/hooks/useLiveDot.ts +28 -3
  54. package/src/hooks/useMarkers.ts +6 -1
  55. package/src/hooks/usePanScroll.ts +12 -1
  56. package/src/index.ts +1 -0
  57. package/src/math/markerCluster.ts +28 -0
  58. package/src/types.ts +72 -2
package/src/types.ts CHANGED
@@ -591,7 +591,11 @@ export interface AreaDotsConfig {
591
591
  export interface BadgeConfig extends BadgeStyleConfig {
592
592
  /** Visual style of the badge pill. Default `"default"`. */
593
593
  variant?: BadgeVariant;
594
- /** Show the pointed tail toward the live dot. Default `true`. */
594
+ /**
595
+ * Show the pointed tail toward the live dot. When `false`, no tail space is
596
+ * reserved: the pill body sits flush at the gutter edge (right after the dot
597
+ * gap) and the auto right padding shrinks accordingly. Default `true`.
598
+ */
595
599
  tail?: boolean;
596
600
  /** Which side of the chart the badge appears on. Default `"right"`. */
597
601
  position?: "right" | "left";
@@ -737,6 +741,22 @@ export interface XAxisConfig {
737
741
  minGap?: number;
738
742
  }
739
743
 
744
+ /**
745
+ * Auto-hide both axes while idle (see {@link LiveChartCoreProps.axisAutoHide}).
746
+ *
747
+ * @experimental
748
+ */
749
+ export interface AxisAutoHideConfig {
750
+ /** Fade-in duration (ms) when interaction starts — near-instant. Default `60`. */
751
+ fadeInMs?: number;
752
+ /** Fade-out duration (ms) back to idle. Default `250`. */
753
+ fadeOutMs?: number;
754
+ /** Axis opacity while idle (0 = fully hidden). Default `0`. */
755
+ idleOpacity?: number;
756
+ /** Untouched time (ms) before the axes fade back out. Default `3000`. */
757
+ hideAfterMs?: number;
758
+ }
759
+
740
760
  /**
741
761
  * Morfi-style on-canvas tooltip for {@link LiveChartSeries}: a time-range pill
742
762
  * above the guide plus one value pill at every visible series intersection.
@@ -945,6 +965,15 @@ export interface ScrubConfig {
945
965
  * Default `false`.
946
966
  */
947
967
  clampToPlot?: boolean;
968
+ /**
969
+ * Candle mode: snap the crosshair to candle centers. The scrub X is
970
+ * quantized to the hovered candle's center before it drives the crosshair,
971
+ * so the line — and everything derived from it (the time, tooltip, and
972
+ * trailing dim) — jumps from candle to candle instead of gliding, the
973
+ * tick-to-tick feel of pro charting tools. A position in a gap between
974
+ * candles keeps the raw finger X; no effect in line mode. Default `false`.
975
+ */
976
+ snapToCandles?: boolean;
948
977
  }
949
978
 
950
979
  /**
@@ -1360,6 +1389,12 @@ export interface MarkerClusterConfig {
1360
1389
  /** Collapse a co-located run to a single count badge once it exceeds this many.
1361
1390
  * Default `5`. */
1362
1391
  maxBeforeGroup?: number;
1392
+ /**
1393
+ * `"vertical"` only: cap the column at this many glyphs instead of letting it
1394
+ * grow unbounded (and off the plot). The oldest `maxVisible` glyphs keep
1395
+ * their stack; the newest overflow is hidden. Default unbounded.
1396
+ */
1397
+ maxVisible?: number;
1363
1398
  /**
1364
1399
  * What a collapsed cluster draws in place of its members:
1365
1400
  * - `"count"` (default) — the built-in round count badge (a circle with the
@@ -1520,6 +1555,21 @@ export interface DotConfig {
1520
1555
  show?: boolean;
1521
1556
  /** Dot fill color. Defaults to the chart line color (per series for multi-series). */
1522
1557
  color?: string;
1558
+ /**
1559
+ * Keep the dot on the **true live point** while scrolled back or overscrolled
1560
+ * with `timeScroll`: it tracks the live point's x (instead of staying pinned
1561
+ * to the plot's right edge), keeps its heartbeat pulse (the dot still marks
1562
+ * an honest live position), stays visible under
1563
+ * `timeScroll.hideLiveOnScrollBack`, and hides once the live point leaves the
1564
+ * visible window. Ignored when `badge.followViewEdge` is set — an edge-pinned
1565
+ * dot must stay aligned with its badge. Single-series `LiveChart` only
1566
+ * (multi-series dots already ride each line's end while scrolled). Default
1567
+ * `false` (the dot stays pinned to the right edge with its pulse suppressed
1568
+ * while scrolled back).
1569
+ *
1570
+ * @experimental
1571
+ */
1572
+ trackWhileParked?: boolean;
1523
1573
  }
1524
1574
 
1525
1575
  /** Live dot configuration for multi-series charts (extends the shared {@link DotConfig}). */
@@ -1791,6 +1841,14 @@ export interface TimeScrollConfig {
1791
1841
  * clamped. Applies to the pinch-zoom (`zoom`) clamps too.
1792
1842
  */
1793
1843
  overscroll?: number;
1844
+ /**
1845
+ * Fling inertia on release: a fast drag keeps scrolling and decays to a
1846
+ * stop (the classic momentum feel). Set `false` to stop the window dead
1847
+ * where the finger lifts — a deliberate, TradingView-style hard stop. A
1848
+ * release that lands within the snap zone of the live edge still
1849
+ * re-attaches to live. Default `true`.
1850
+ */
1851
+ fling?: boolean;
1794
1852
  }
1795
1853
 
1796
1854
  /**
@@ -2005,7 +2063,10 @@ export interface LiveChartCoreProps {
2005
2063
  exaggerate?: boolean;
2006
2064
  /**
2007
2065
  * Clamp the Y-axis lower bound at 0 (prices, market caps, volumes) so the axis
2008
- * never shows negative ticks when data collapses toward zero. Default `false`.
2066
+ * never shows negative ticks when data collapses toward zero. With
2067
+ * `yRangeScale` zoomed out, the expansion stops once the lower bound reaches
2068
+ * 0 so the data stays centered instead of continuing to grow only upward.
2069
+ * Default `false`.
2009
2070
  */
2010
2071
  nonNegative?: boolean;
2011
2072
  /**
@@ -2038,6 +2099,15 @@ export interface LiveChartCoreProps {
2038
2099
  yAxis?: boolean | YAxisConfig;
2039
2100
  /** X-axis time labels. `true` = defaults, `false` = hidden, or pass `XAxisConfig`. Default `true`. */
2040
2101
  xAxis?: boolean | XAxisConfig;
2102
+ /**
2103
+ * Auto-hide both axes while the chart is at rest: the X/Y axes (grid, ticks,
2104
+ * labels) fade in on any interaction — scrubbing, time-scrolling, flinging,
2105
+ * pinch-zooming — and fade back out once the chart goes untouched for
2106
+ * `hideAfterMs`. `true` = defaults, or pass `AxisAutoHideConfig`. Default off.
2107
+ *
2108
+ * @experimental
2109
+ */
2110
+ axisAutoHide?: boolean | AxisAutoHideConfig;
2041
2111
  /**
2042
2112
  * Label floated at the top edge of the plot area. `true` = the built-in value
2043
2113
  * label showing the chart's current TOP Y-axis bound (updated each frame),