react-native-livechart 4.11.0 → 4.12.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 (67) hide show
  1. package/dist/components/CrosshairLine.d.ts +3 -1
  2. package/dist/components/CrosshairLine.d.ts.map +1 -1
  3. package/dist/components/CustomReferenceLineOverlay.d.ts +15 -10
  4. package/dist/components/CustomReferenceLineOverlay.d.ts.map +1 -1
  5. package/dist/components/DotOverlay.d.ts +3 -5
  6. package/dist/components/DotOverlay.d.ts.map +1 -1
  7. package/dist/components/LiveChart.d.ts.map +1 -1
  8. package/dist/components/LiveChartSeries.d.ts.map +1 -1
  9. package/dist/components/PerSeriesTooltipOverlay.d.ts +19 -0
  10. package/dist/components/PerSeriesTooltipOverlay.d.ts.map +1 -0
  11. package/dist/components/ReferenceLineOverlay.d.ts +20 -6
  12. package/dist/components/ReferenceLineOverlay.d.ts.map +1 -1
  13. package/dist/components/YAxisOverlay.d.ts +3 -1
  14. package/dist/components/YAxisOverlay.d.ts.map +1 -1
  15. package/dist/core/liveIndicatorVisibility.d.ts +9 -0
  16. package/dist/core/liveIndicatorVisibility.d.ts.map +1 -0
  17. package/dist/core/resolveConfig.d.ts +29 -0
  18. package/dist/core/resolveConfig.d.ts.map +1 -1
  19. package/dist/hooks/crosshairSeries.d.ts +10 -2
  20. package/dist/hooks/crosshairSeries.d.ts.map +1 -1
  21. package/dist/hooks/crosshairShared.d.ts +33 -2
  22. package/dist/hooks/crosshairShared.d.ts.map +1 -1
  23. package/dist/hooks/delayedPanGuard.d.ts +66 -8
  24. package/dist/hooks/delayedPanGuard.d.ts.map +1 -1
  25. package/dist/hooks/useChartPaths.d.ts +5 -9
  26. package/dist/hooks/useChartPaths.d.ts.map +1 -1
  27. package/dist/hooks/useCrosshair.d.ts +7 -1
  28. package/dist/hooks/useCrosshair.d.ts.map +1 -1
  29. package/dist/hooks/useCrosshairSeries.d.ts +22 -3
  30. package/dist/hooks/useCrosshairSeries.d.ts.map +1 -1
  31. package/dist/hooks/useMomentum.d.ts +1 -1
  32. package/dist/hooks/useMomentum.d.ts.map +1 -1
  33. package/dist/hooks/usePanScroll.d.ts +15 -1
  34. package/dist/hooks/usePanScroll.d.ts.map +1 -1
  35. package/dist/index.d.ts +1 -1
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/math/lerp.d.ts.map +1 -1
  38. package/dist/math/momentum.d.ts +1 -1
  39. package/dist/math/momentum.d.ts.map +1 -1
  40. package/dist/math/referenceLines.d.ts +7 -0
  41. package/dist/math/referenceLines.d.ts.map +1 -1
  42. package/dist/types.d.ts +160 -18
  43. package/dist/types.d.ts.map +1 -1
  44. package/package.json +1 -1
  45. package/src/components/CrosshairLine.tsx +4 -1
  46. package/src/components/CustomReferenceLineOverlay.tsx +42 -13
  47. package/src/components/DotOverlay.tsx +24 -8
  48. package/src/components/LiveChart.tsx +157 -37
  49. package/src/components/LiveChartSeries.tsx +128 -16
  50. package/src/components/PerSeriesTooltipOverlay.tsx +287 -0
  51. package/src/components/ReferenceLineOverlay.tsx +274 -141
  52. package/src/components/YAxisOverlay.tsx +5 -1
  53. package/src/core/liveIndicatorVisibility.ts +25 -0
  54. package/src/core/resolveConfig.ts +86 -0
  55. package/src/hooks/crosshairSeries.ts +262 -33
  56. package/src/hooks/crosshairShared.ts +36 -2
  57. package/src/hooks/delayedPanGuard.ts +111 -6
  58. package/src/hooks/useChartPaths.ts +25 -15
  59. package/src/hooks/useCrosshair.ts +57 -4
  60. package/src/hooks/useCrosshairSeries.ts +95 -7
  61. package/src/hooks/useMomentum.ts +8 -1
  62. package/src/hooks/usePanScroll.ts +46 -5
  63. package/src/index.ts +1 -0
  64. package/src/math/lerp.ts +7 -0
  65. package/src/math/momentum.ts +22 -5
  66. package/src/math/referenceLines.ts +38 -0
  67. package/src/types.ts +168 -18
@@ -1,7 +1,10 @@
1
1
  import { type SkPath } from "@shopify/react-native-skia";
2
2
  import { type SharedValue } from "react-native-reanimated";
3
- import type { SingleEngineState } from "../core/useLiveChartEngine";
3
+ import type { ChartEngineEdge, ChartEngineScroll, SingleEngineState } from "../core/useLiveChartEngine";
4
4
  import { type ChartPadding } from "../draw/line";
5
+ /** Selects the synthetic right-edge line tip without coupling chart geometry
6
+ * to badge or live-indicator presentation options. */
7
+ export declare function resolveLineTipValue(displayValue: number, edgeValue: number, viewEnd: number | null): number;
5
8
  /**
6
9
  * Builds the `linePath` / `fillPath` with `Skia.PathBuilder`s reused across
7
10
  * frames (one per curve, held in a SharedValue) and finalized with `detach()` —
@@ -13,19 +16,12 @@ import { type ChartPadding } from "../draw/line";
13
16
  * `flatPts` derived value changes reference each frame and re-runs linePath /
14
17
  * fillPath.
15
18
  */
16
- export declare function useChartPaths(engine: SingleEngineState, padding: ChartPadding, morphT?: SharedValue<number>,
19
+ export declare function useChartPaths(engine: SingleEngineState & ChartEngineScroll & ChartEngineEdge, padding: ChartPadding, morphT?: SharedValue<number>,
17
20
  /** When set, also build `thresholdFillPath` — the band between the line and this
18
21
  * pixel-Y, closed at the threshold instead of the chart baseline. */
19
22
  thresholdY?: SharedValue<number>,
20
23
  /** Draw the line/fill as a straight polyline instead of the monotone cubic. */
21
24
  linear?: boolean,
22
- /**
23
- * Value at the visible window's right edge (engine `edgeValue`). With
24
- * `followViewEdge`, the line's right-edge tip uses this instead of the live
25
- * `displayValue` — so while time-scrolled the line ends at the last visible
26
- * price rather than dropping to the (off-screen) live value.
27
- */
28
- edgeValue?: SharedValue<number>, followViewEdge?: boolean,
29
25
  /** Loading squiggle wave amplitude (px) for the reveal morph. Default 14. */
30
26
  squiggleAmplitude?: number,
31
27
  /** Loading squiggle wave speed multiplier for the reveal morph. Default 1. */
@@ -1 +1 @@
1
- {"version":3,"file":"useChartPaths.d.ts","sourceRoot":"","sources":["../../src/hooks/useChartPaths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAmB,KAAK,WAAW,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M,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC;AAC5B;sEACsE;AACtE,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC;AAChC,+EAA+E;AAC/E,MAAM,UAAQ;AACd,6EAA6E;AAC7E,iBAAiB,SAAK;AACtB,8EAA8E;AAC9E,aAAa,SAAI;AACjB;;;yDAGyD;AACzD,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC;;;;EAyKzC"}
@@ -45,5 +45,11 @@ tooltipMargin?: number,
45
45
  * scrubbing (and a vertical drag falls through to the parent). `0` = no
46
46
  * exclusion (the default; scrub covers the whole plot).
47
47
  */
48
- scrubBottomExclude?: number): CrosshairState;
48
+ scrubBottomExclude?: number,
49
+ /**
50
+ * True while the time-scroll pan owns the touch. The hold-to-scrub pan refuses
51
+ * to activate while set, so a drag that already started scrolling can never
52
+ * mature into a scrub (see `delayedPanGuard.shouldStartDelayedPan`).
53
+ */
54
+ scrollActive?: SharedValue<boolean>): CrosshairState;
49
55
  //# sourceMappingURL=useCrosshair.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCrosshair.d.ts","sourceRoot":"","sources":["../../src/hooks/useCrosshair.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,KAAK,EACV,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACX,MAAM,UAAU,CAAC;AAClB,OAAO,EAgBL,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAmD3B,YAAY,EAAE,cA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AC;CACzB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,gBAAgB,EAC1B,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,EAClC,UAAU,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,EACjC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,EAC5C,UAAU,CAAC,EAAE,mBAAmB;AAChC,2EAA2E;AAC3E,eAAe,SAAI,EACnB,cAAc,CAAC,EAAE,MAAM,IAAI,EAC3B,YAAY,CAAC,EAAE,MAAM,IAAI;AACzB,+EAA+E;AAC/E,WAAW,CAAC,EAAE,yBAAyB,GAAG,IAAI,EAC9C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI;AACjD,iEAAiE;AACjE,YAAY,GAAE,YAAqC;AACnD;;;;;GAKG;AACH,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO;AAC/C,gFAAgF;AAChF,gBAAgB,GAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAgB;AAC9D,mEAAmE;AACnE,gBAAgB,UAAO;AACvB,kEAAkE;AAClE,eAAe,UAAO;AACtB,kFAAkF;AAClF,aAAa,SAAI;AACjB;;;;;GAKG;AACH,kBAAkB,SAAI;AACtB;;;;GAIG;AACH,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,GAClC,cAAc,CAynBhB"}
@@ -1,12 +1,31 @@
1
+ import type { SkFont } from "@shopify/react-native-skia";
2
+ import { type DerivedValue, type SharedValue } from "react-native-reanimated";
3
+ import type { ResolvedPerSeriesTooltipConfig } from "../core/resolveConfig";
1
4
  import type { MultiEngineState } from "../core/useLiveChartEngine";
2
5
  import { type ChartPadding } from "../draw/line";
3
6
  import type { ScrubPointMulti } from "../types";
4
7
  import { type CrosshairState } from "./crosshairShared";
5
8
  /**
6
- * LiveChartSeries crosshair + scrub. No tooltip data is delivered via
7
- * `onScrub` worklet callback on the UI thread.
9
+ * LiveChartSeries crosshair + scrub. The optional per-series tooltip is
10
+ * calculated on the UI thread alongside the callback payload.
8
11
  */
12
+ interface CrosshairSeriesTooltipOptions {
13
+ config: ResolvedPerSeriesTooltipConfig;
14
+ formatValue: (value: number) => string;
15
+ formatTime: (time: number) => string;
16
+ font: SkFont;
17
+ colors: string[];
18
+ /** Current-time anchor used to clamp the live bucket's range end. */
19
+ maxTime: SharedValue<number> | DerivedValue<number>;
20
+ }
9
21
  export declare function useCrosshairSeries(engine: MultiEngineState, padding: ChartPadding, enabled: boolean, onScrub?: (point: ScrubPointMulti | null) => void,
10
22
  /** Press-and-hold delay (ms) before scrubbing activates. 0 = immediate. */
11
- panGestureDelay?: number, onGestureStart?: () => void, onGestureEnd?: () => void): CrosshairState;
23
+ panGestureDelay?: number, onGestureStart?: () => void, onGestureEnd?: () => void,
24
+ /**
25
+ * True while the time-scroll pan owns the touch. The hold-to-scrub pan refuses
26
+ * to activate while set, so a drag that already started scrolling can never
27
+ * mature into a scrub (see `delayedPanGuard.shouldStartDelayedPan`).
28
+ */
29
+ scrollActive?: SharedValue<boolean>, tooltip?: CrosshairSeriesTooltipOptions): CrosshairState;
30
+ export {};
12
31
  //# sourceMappingURL=useCrosshairSeries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCrosshairSeries.d.ts","sourceRoot":"","sources":["../../src/hooks/useCrosshairSeries.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAKhD,OAAO,EAOL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kB,CAChC,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,KAAK,IAAI;AACjD,2EAA2E;AAC3E,eAAe,SAAI,EACnB,cAAc,CAAC,EAAE,MAAM,IAAI,EAC3B,YAAY,CAAC,EAAE,MAAM,IAAI;AACzB;;;;GAIG;AACH,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,EACnC,OAAO,CAAC,EAAE,6BAA6B,GACtC,cAAc,CA+QhB"}
@@ -11,6 +11,6 @@ import type { Momentum, MomentumConfig } from "../types";
11
11
  export declare function resolveMomentumProp(prop: boolean | Momentum | MomentumConfig, data: readonly {
12
12
  time: number;
13
13
  value: number;
14
- }[]): Momentum;
14
+ }[], endTime?: number): Momentum;
15
15
  export declare function useMomentum(engine: SingleEngineState, momentumProp?: boolean | Momentum | MomentumConfig): SharedValue<Momentum>;
16
16
  //# sourceMappingURL=useMomentum.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useMomentum.d.ts","sourceRoot":"","sources":["../../src/hooks/useMomentum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEzD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,cAAc,EACzC,IAAI,EAAE,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,GAC/C,QAAQ,CAYV;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,iBAAiB,EACzB,YAAY,GAAE,OAAO,GAAG,QAAQ,GAAG,cAAqB,GACvD,WAAW,CAAC,QAAQ,CAAC,CAIvB"}
1
+ {"version":3,"file":"useMomentum.d.ts","sourceRoot":"","sources":["../../src/hooks/useMomentum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEzD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,cAAc,EACzC,IAAI,EAAE,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,EAChD,OAAO,CAAC,EAAE,MAAM,GACf,QAAQ,CAkBV;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,iBAAiB,EACzB,YAAY,GAAE,OAAO,GAAG,QAAQ,GAAG,cAAqB,GACvD,WAAW,CAAC,QAAQ,CAAC,CAIvB"}
@@ -43,6 +43,20 @@ export interface UsePanScrollOptions {
43
43
  * a stray scrub doesn't linger behind the pan.
44
44
  */
45
45
  onScrollStart?: () => void;
46
+ /**
47
+ * Set true for as long as this gesture owns the touch, cleared on finalize.
48
+ * The hold-to-scrub pan reads it and refuses to activate mid-scroll — RNGH's
49
+ * `Gesture.Race` declares no relation between the two pans, so this latch is
50
+ * the only thing stopping the scrub's long-press timer from firing while the
51
+ * chart is already being dragged. See `delayedPanGuard.shouldStartDelayedPan`.
52
+ */
53
+ scrollActive?: SharedValue<boolean>;
54
+ /**
55
+ * True while the scrub crosshair owns the touch. Scrolling is inert while set,
56
+ * so an engaged scrub locks the chart in place and the finger only moves the
57
+ * price indicator. Cleared when the finger lifts (the scrub pan's finalize).
58
+ */
59
+ scrubActive?: SharedValue<boolean>;
46
60
  }
47
61
  /**
48
62
  * Smallest valid right-edge time: keeps the window's left edge
@@ -78,5 +92,5 @@ export declare function axisBandTop(canvasHeight: number, padBottom: number): nu
78
92
  * edge; `null` means "follow live". Dragging (or flinging) back to the live edge
79
93
  * resumes following.
80
94
  */
81
- export declare function usePanScroll({ engine, padding, minTime, enabled, mode, onScrollStart, }: UsePanScrollOptions): ReturnType<typeof Gesture.Pan>;
95
+ export declare function usePanScroll({ engine, padding, minTime, enabled, mode, onScrollStart, scrollActive, scrubActive, }: UsePanScrollOptions): ReturnType<typeof Gesture.Pan>;
82
96
  //# sourceMappingURL=usePanScroll.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePanScroll.d.ts","sourceRoot":"","sources":["../../src/hooks/usePanScroll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,sFAAsF;AACtF,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAMnC,6CAA6C;AAC7C,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG,UAAU,CAAC;AAE9D,4FAA4F;AAC5F,MAAM,WAAW,mBAAmB;IAClC,gFAAgF;IAChF,OAAO,EAAE,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACpC,oFAAoF;IACpF,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC9B,iDAAiD;IACjD,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,0BAA0B;IAC1B,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACjC,6DAA6D;IAC7D,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,OAAO,EAAE,YAAY,CAAC;IACtB;;;;OAIG;IACH,OAAO,E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T,MAAM,GAAG,IAAI,CAMf;AAED,mFAAmF;AACnF,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,GACjB,MAAM,CAGR;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAG3E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,IAAoB,EACpB,aAAa,EACb,YAAY,EACZ,WAAW,GACZ,EAAE,mBAAmB,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,GAAG,CAAC,CA6ItD"}
package/dist/index.d.ts CHANGED
@@ -15,5 +15,5 @@ export { MONO_FONT_FAMILY } from "./lib/monoFontFamily";
15
15
  export { useDegen } from "./hooks/useDegen";
16
16
  export { useTradeStream } from "./hooks/useTradeStream";
17
17
  export { usePriceY, useTimeX } from "./hooks/useChartOverlayContext";
18
- export type { AreaDotsConfig, AxisLabelConfig, BadgeConfig, BadgeMetrics, BadgeStyleConfig, BadgeVariant, CandleMetrics, CandlePoint, CanvasMode, ChartInsets, ChartOverlayContext, ChartPlotRect, ChartScale, ChartSegment, DegenOptions, DegenShakePayload, EmptyStateMetrics, FontConfig, FontWeight, GradientConfig, GridMetrics, GridStyleConfig, LeftEdgeFadeConfig, LegendConfig, LegendStyle, LineConfig, LiveChartCoreProps, LiveChartMetrics, LiveChartMetricsOverride, LiveChartPalette, LiveChartPoint, LiveChartProps, LiveChartSeriesProps, LoadingConfig, Marker, MarkerClusterConfig, MarkerGroupBadge, MarkerKind, MarkerPressEvent, MarkerRenderContext, MarkerSide, Momentum, MomentumConfig, MotionMetrics, MultiSeriesDotConfig, PulseConfig, ReferenceLine, ReferenceLineBadgeConfig, ReferenceLineGroupingConfig, ReferenceLineRenderProps, ReturnToLiveConfig, ScrubActionConfig, ScrubActionPoint, ScrubConfig, ScrubPoint, ScrubPointCore, ScrubPointMulti, ScrubSeriesValue, SelectionDotConfig, SelectionDotProps, SelectionDotRingConfig, SeriesConfig, ThemeMode, ThresholdConfig, ThresholdLineConfig, TooltipRenderProps, TradeEvent, TransitionConfig, ValueLineConfig, VisibleRange, VolumeConfig, XAxisConfig, YAxisConfig, ZoomConfig, } from "./types";
18
+ export type { AreaDotsConfig, AxisLabelConfig, BadgeConfig, BadgeMetrics, BadgeStyleConfig, BadgeVariant, CandleMetrics, CandlePoint, CanvasMode, ChartInsets, ChartOverlayContext, ChartPlotRect, ChartScale, ChartSegment, DegenOptions, DegenShakePayload, EmptyStateMetrics, FontConfig, FontWeight, GradientConfig, GridMetrics, GridStyleConfig, LeftEdgeFadeConfig, LegendConfig, LegendStyle, LineConfig, LiveChartCoreProps, LiveChartMetrics, LiveChartMetricsOverride, LiveChartPalette, LiveChartPoint, LiveChartProps, LiveChartSeriesProps, LoadingConfig, Marker, MarkerClusterConfig, MarkerGroupBadge, MarkerKind, MarkerPressEvent, MarkerRenderContext, MarkerSide, Momentum, MomentumConfig, MotionMetrics, MultiSeriesDotConfig, PerSeriesTooltipConfig, PulseConfig, ReferenceLine, ReferenceLineBadgeConfig, ReferenceLineGroupingConfig, ReferenceLineRenderProps, ReturnToLiveConfig, ScrubActionConfig, ScrubActionPoint, ScrubConfig, ScrubPoint, ScrubPointCore, ScrubPointMulti, ScrubSeriesValue, SelectionDotConfig, SelectionDotProps, SelectionDotRingConfig, SeriesConfig, ThemeMode, ThresholdConfig, ThresholdLineConfig, TooltipRenderProps, TradeEvent, TransitionConfig, ValueLineConfig, VisibleRange, VolumeConfig, XAxisConfig, YAxisConfig, ZoomConfig, } from "./types";
19
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,SAAS,EAAE,MAAM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ChB,wBAAwB,EACxB,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,MAAM,EACN,mBAAmB,EACnB,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACV,QAAQ,EACR,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,sBAAsB,EACtB,WAAW,EACX,aAAa,EACb,wBAAwB,EACxB,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,YAAY,EACZ,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,GACX,MAAM,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"lerp.d.ts","sourceRoot":"","sources":["../../src/math/lerp.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,IAAI,CAClB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,EAAE,SAAqB,GACtB,MAAM,CAIR"}
1
+ {"version":3,"file":"lerp.d.ts","sourceRoot":"","sources":["../../src/math/lerp.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,IAAI,CAClB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,EAAE,SAAqB,GACtB,MAAM,CAWR"}
@@ -4,5 +4,5 @@ import type { LiveChartPoint, Momentum } from "../types";
4
4
  * Uses the full lookback window for threshold calculation
5
5
  * but only the last 5 points for active velocity.
6
6
  */
7
- export declare function detectMomentum(points: LiveChartPoint[], lookback?: number, threshold?: number): Momentum;
7
+ export declare function detectMomentum(points: LiveChartPoint[], lookback?: number, threshold?: number, endTime?: number): Momentum;
8
8
  //# sourceMappingURL=momentum.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"momentum.d.ts","sourceRoot":"","sources":["../../src/math/momentum.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzD;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,cAAc,EAAE,EACxB,QAAQ,SAAK,EACb,SAAS,SAAO,GACf,QAAQ,CA0BV"}
1
+ {"version":3,"file":"momentum.d.ts","sourceRoot":"","sources":["../../src/math/momentum.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzD;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,cAAc,EAAE,EACxB,QAAQ,SAAK,EACb,SAAS,SAAO,EAChB,OAAO,CAAC,EAAE,MAAM,GACf,QAAQ,CA0CV"}
@@ -12,6 +12,13 @@ export declare function referenceLineForm(rl: ReferenceLine): ReferenceLineForm;
12
12
  * time bands (Form C) which constrain time, not value.
13
13
  */
14
14
  export declare function collectReferenceValues(lines: ReferenceLine[]): number[];
15
+ /**
16
+ * Stable React keys for an ordered reference-line list. A caller-supplied `id`
17
+ * keeps the key stable across reordering; the visual config is a deterministic
18
+ * fallback for legacy lines. Equal fallback signatures receive a suffix so they
19
+ * remain distinct siblings.
20
+ */
21
+ export declare function referenceLineReactKeys(lines: readonly ReferenceLine[]): string[];
15
22
  /**
16
23
  * Fully-resolved badge **style/shape** + anchor — the resolved counterpart of
17
24
  * {@link BadgeStyleConfig} (`position` / `icon` / `showText` plus the style knobs).
@@ -1 +1 @@
1
- {"version":3,"file":"referenceLines.d.ts","sourceRoot":"","sources":["../../src/math/referenceLines.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,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B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;IACnC,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;yDACyD;AACzD,MAAM,WAAW,sBAAuB,SAAQ,2BAA2B;IACzE,qGAAqG;IACrG,OAAO,EAAE,OAAO,CAAC;IACjB,uFAAuF;IACvF,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;yDACyD;AACzD,MAAM,MAAM,2BAA2B,GAAG,2BAA2B,CAAC;AA+BtE;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,CAAC,EAAE,wBAAwB,GAC/B,2BAA2B,CAE7B;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,aAAa,GAChB,sBAAsB,GAAG,IAAI,CAmB/B;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACV,IAAI,GAAG,OAAO,GAAG,OAAO,CAK1B"}
package/dist/types.d.ts CHANGED
@@ -39,6 +39,11 @@ export type BadgeVariant = "default" | "minimal";
39
39
  * - **Form C** — vertical time band between `from` and `to` (unix seconds).
40
40
  */
41
41
  export interface ReferenceLine {
42
+ /**
43
+ * Stable identifier for this line. Supply a unique value when `referenceLines`
44
+ * may be reordered so the chart preserves the line's rendered identity.
45
+ */
46
+ id?: string;
42
47
  /** Form A — the Y-axis value where the horizontal line is drawn. */
43
48
  value?: number;
44
49
  /** Form B — horizontal band lower Y bound (paired with `valueTo`). */
@@ -225,14 +230,16 @@ export interface ReferenceLineBadgeConfig extends BadgeStyleConfig {
225
230
  }
226
231
  /**
227
232
  * Context passed to a custom {@link LiveChartProps.renderReferenceLine} or
228
- * {@link LiveChartSeriesProps.renderReferenceLine}. The chart floats the element
229
- * you return over the canvas and pins it to the line's value on
230
- * the UI thread (vertically centered on the line, horizontally at the badge /
231
- * label position) — so it tracks the rescaling axis and any drag smoothly without
232
- * JS re-renders, just like {@link TooltipRenderProps}. Replaces the built-in pill
233
- * badge / gutter label for that line; return `null`/`undefined` to keep the
234
- * built-in. Bind the SharedValues to animated text (e.g. an animated `TextInput`)
235
- * for the value to update on the UI thread too.
233
+ * {@link LiveChartProps.renderOffAxisReferenceLine} (and their
234
+ * `LiveChartSeries` counterparts). The chart floats the element you return over
235
+ * the canvas and pins it to the line's value on the UI thread (vertically centered
236
+ * on the line, horizontally at the badge / label position) — so it tracks the
237
+ * rescaling axis and any drag smoothly without JS re-renders, just like
238
+ * {@link TooltipRenderProps}. `renderReferenceLine` replaces the built-in pill /
239
+ * gutter label in every state; `renderOffAxisReferenceLine` replaces it only while
240
+ * the value is pinned above or below the visible plot. Bind the SharedValues to
241
+ * animated text (e.g. an animated `TextInput`) for the value to update on the UI
242
+ * thread too.
236
243
  */
237
244
  export interface ReferenceLineRenderProps {
238
245
  /** The reference line being rendered. */
@@ -547,7 +554,9 @@ export interface BadgeConfig extends BadgeStyleConfig {
547
554
  * When the chart is scrolled back (see `timeScroll`), move the live-price
548
555
  * indicators — the badge, the value line, and the live dot — to the price at
549
556
  * the visible window's right edge instead of the live price, so they track the
550
- * last visible price as you pan. Default `false`.
557
+ * last visible price as you pan. The badge's momentum color is derived at that
558
+ * same historical edge, so incoming live ticks do not recolor it. Default
559
+ * `false`.
551
560
  *
552
561
  * @experimental
553
562
  */
@@ -666,10 +675,98 @@ export interface XAxisConfig {
666
675
  /** Minimum pixel gap between time labels. Default `60`. */
667
676
  minGap?: number;
668
677
  }
678
+ /**
679
+ * Morfi-style on-canvas tooltip for {@link LiveChartSeries}: a time-range pill
680
+ * above the guide plus one value pill at every visible series intersection.
681
+ *
682
+ * Enable it with `scrub={{ seriesTooltip: true }}` or pass this object to style
683
+ * and format the readout. It is ignored by the single-series {@link LiveChart}.
684
+ */
685
+ export interface PerSeriesTooltipConfig {
686
+ /**
687
+ * Keep the value pills pinned to the visible series endpoints while idle.
688
+ * The guide and time pill remain hidden until a scrub starts. Default `false`.
689
+ */
690
+ alwaysShow?: boolean;
691
+ /**
692
+ * Bucket width used by the time-range pill, in seconds. Omit to infer it from
693
+ * the latest positive interval in the first visible series.
694
+ */
695
+ bucketSeconds?: number;
696
+ /**
697
+ * Format a value pill. The second argument identifies the series so one chart
698
+ * can dispatch to different unit formatters. Defaults to the chart's
699
+ * `formatValue`.
700
+ *
701
+ * Runs on the UI thread and must be worklet-safe.
702
+ */
703
+ formatSeriesValue?: (value: number, seriesId: string) => string;
704
+ /**
705
+ * Format the time pill from the bucket's start/end unix seconds. The end is
706
+ * clamped to the chart's current-time anchor, so the live bucket never claims
707
+ * to end in the future. Defaults to two chart `formatTime` labels joined by
708
+ * an en dash.
709
+ *
710
+ * Runs on the UI thread and must be worklet-safe.
711
+ */
712
+ formatTimeRange?: (from: number, to: number) => string;
713
+ /** Truncate labels longer than this many characters with `…`. Default `14`. */
714
+ maxLabelChars?: number;
715
+ /** Guide color. Omit to use `scrub.crosshairLineColor`, then the theme. */
716
+ guideColor?: string;
717
+ /** Guide stroke width in px. Default `1`. */
718
+ guideWidth?: number;
719
+ /**
720
+ * Guide dash pattern. `true` uses `[3, 3]`; an array supplies explicit Skia
721
+ * dash intervals; `false` draws a solid guide. Default `[3, 3]`.
722
+ */
723
+ guideDashPattern?: boolean | number[];
724
+ /** Time-pill background. Omit to use `scrub.tooltipBackground`, then the theme. */
725
+ timePillBackground?: string;
726
+ /** Time-pill text color. Omit to use `scrub.tooltipColor`, then the theme. */
727
+ timePillColor?: string;
728
+ /** Time-pill border color. Omit to use `scrub.tooltipBorderColor`, then the theme. */
729
+ timePillBorderColor?: string;
730
+ /** Time-pill corner radius in px. Default `6`. */
731
+ timePillRadius?: number;
732
+ /** Time-pill horizontal padding in px. Default `8`. */
733
+ timePillPaddingX?: number;
734
+ /** Time-pill vertical padding in px. Default `4`. */
735
+ timePillPaddingY?: number;
736
+ /** Series-pill background. Omit to use `scrub.tooltipBackground`, then the theme. */
737
+ seriesPillBackground?: string;
738
+ /** Series label color. Omit to use the theme tooltip text. */
739
+ seriesPillLabelColor?: string;
740
+ /** Formatted series value color. Omit to use `seriesPillLabelColor`. */
741
+ seriesPillValueColor?: string;
742
+ /** Series-pill border color. Omit to use `scrub.tooltipBorderColor`, then the theme. */
743
+ seriesPillBorderColor?: string;
744
+ /** Series-pill corner radius in px. Default `6`. */
745
+ seriesPillRadius?: number;
746
+ /** Series-pill horizontal padding in px. Default `8`. */
747
+ seriesPillPaddingX?: number;
748
+ /** Series-pill vertical padding in px. Default `4`. */
749
+ seriesPillPaddingY?: number;
750
+ /** Diameter of the series-colour dot inside each pill, in px. Default `8`. */
751
+ seriesPillDotSize?: number;
752
+ /** Gap between the colour dot and label, in px. Default `6`. */
753
+ seriesPillDotGap?: number;
754
+ /** Gap between the label and formatted value, in px. Default `6`. */
755
+ seriesPillLabelValueGap?: number;
756
+ /** Diameter of the dot drawn at each line/guide intersection. Default `8`. */
757
+ intersectionDotSize?: number;
758
+ }
669
759
  /** Crosshair scrub configuration. */
670
760
  export interface ScrubConfig {
671
761
  /** Show the value/time tooltip pill while scrubbing. Default `true`. */
672
762
  tooltip?: boolean;
763
+ /**
764
+ * Opt into the Morfi-style per-series pill tooltip on `LiveChartSeries`.
765
+ * `true` uses defaults; an object enables and configures it; `false`/omitted
766
+ * preserves the existing guide-only multi-series scrub. Ignored by
767
+ * single-series `LiveChart`. Default `false`.
768
+ */
769
+ seriesTooltip?: boolean | PerSeriesTooltipConfig;
673
770
  /**
674
771
  * Opacity of the chart content to the *right* of the crosshair (the "future")
675
772
  * while scrubbing — `0` fully fades it out, `1` disables the dim. Implemented
@@ -908,7 +1005,8 @@ export interface ChartScale {
908
1005
  }
909
1006
  /**
910
1007
  * The price↔pixel / time↔pixel bridge handed to a custom
911
- * {@link LiveChartProps.renderOverlay}.
1008
+ * {@link LiveChartProps.renderOverlay} or
1009
+ * {@link LiveChartSeriesProps.renderOverlay}.
912
1010
  *
913
1011
  * **Easiest path — the `usePriceY` / `useTimeX` hooks.** They project a price / time
914
1012
  * to a `SharedValue<number>` that tracks the live axis for you; just read it in
@@ -1526,6 +1624,15 @@ export interface TimeScrollConfig {
1526
1624
  * if set, otherwise `500`.
1527
1625
  */
1528
1626
  scrubHoldMs?: number;
1627
+ /**
1628
+ * Hide the live badge, dot, and dashed value line while scrolled back through
1629
+ * history. Default `true`: all three mark the LIVE price, which is off-screen
1630
+ * once the window is frozen behind the live edge, so they'd point at a price
1631
+ * that isn't in view. Set `false` to keep them visible while scrolled back.
1632
+ * Ignored when `badge.followViewEdge` is on — there the group tracks the
1633
+ * visible edge price, which IS in view.
1634
+ */
1635
+ hideLiveOnScrollBack?: boolean;
1529
1636
  }
1530
1637
  /**
1531
1638
  * Tunes the "return to live" glide — the eased animation that carries the window
@@ -1905,8 +2012,9 @@ export interface LiveChartCoreProps {
1905
2012
  *
1906
2013
  * Defaults differ per chart: `LiveChart` shows it (`true`); `LiveChartSeries`
1907
2014
  * hides it (`false`) — with multiple lines the dot can only track the leading
1908
- * series, so the crosshair + per-series tooltips mark the scrub point instead.
1909
- * Pass `true` / a config to opt a multi-series chart in.
2015
+ * series. The crosshair and, when enabled, the per-series tooltip's own
2016
+ * intersection dots — mark the scrub point instead. Pass `true` / a config to
2017
+ * opt a multi-series chart in.
1910
2018
  */
1911
2019
  selectionDot?: boolean | SelectionDotConfig;
1912
2020
  /** Called once when the user starts scrubbing/panning the chart. */
@@ -2053,17 +2161,32 @@ export interface LiveChartProps extends LiveChartCoreProps {
2053
2161
  * pins it to the line's value on the UI thread (see {@link ReferenceLineRenderProps}),
2054
2162
  * so it tracks the rescaling axis and any drag without JS re-renders. Called per
2055
2163
  * Form-A line; return `null`/`undefined` to keep that line's built-in tag. Works
2056
- * with `badge: false` too (replace the plain gutter label). Single-series only.
2164
+ * with `badge: false` too (replace the plain gutter label). For a left- or
2165
+ * right-pinned `badge`, the chart retains the dashed connector and measures the
2166
+ * custom tag so the connector starts at its outer edge. Single-series only.
2057
2167
  */
2058
2168
  renderReferenceLine?: (ctx: ReferenceLineRenderProps) => ReactElement | null | undefined;
2169
+ /**
2170
+ * Render only a Form-A line's **off-axis** tag as a custom React Native element.
2171
+ * The chart keeps the standard Skia tag / gutter label while the value is in
2172
+ * range, then switches to this element when it pins above or below the plot.
2173
+ * With a left- or right-pinned `badge` (or legacy `offAxisBadge`), its dashed
2174
+ * connector stays native and begins after the measured custom tag. Return
2175
+ * `null`/`undefined` to opt a line out based on its static `line` / `index`;
2176
+ * use the `edge` SharedValue inside the returned element to animate a caret.
2177
+ * `renderReferenceLine` takes precedence if both callbacks handle one line.
2178
+ * Single-series only.
2179
+ */
2180
+ renderOffAxisReferenceLine?: (ctx: ReferenceLineRenderProps) => ReactElement | null | undefined;
2059
2181
  /**
2060
2182
  * Collapse Form-A reference lines whose handles sit near the same value into a
2061
2183
  * single count handle (e.g. a stack of working orders at adjacent prices reads
2062
2184
  * as one "×3" tag). `true` = defaults, `false`/omitted = off, or pass a
2063
2185
  * {@link ReferenceLineGroupingConfig} to tune the proximity radius. Lines a
2064
- * {@link LiveChartProps.renderReferenceLine} owns are excluded (their custom tag
2065
- * draws itself), so the count reflects only collapsed built-in tags. Single-series
2066
- * only. Default off.
2186
+ * {@link LiveChartProps.renderReferenceLine} or
2187
+ * {@link LiveChartProps.renderOffAxisReferenceLine} owns are excluded (their
2188
+ * custom tag draws itself), so the count reflects only collapsed built-in tags.
2189
+ * Single-series only. Default off.
2067
2190
  */
2068
2191
  referenceLineGrouping?: boolean | ReferenceLineGroupingConfig;
2069
2192
  /**
@@ -2084,16 +2207,35 @@ export interface LiveChartProps extends LiveChartCoreProps {
2084
2207
  export interface LiveChartSeriesProps extends LiveChartCoreProps {
2085
2208
  /** Array of series definitions. Must be a SharedValue for UI-thread reads. */
2086
2209
  series: SharedValue<SeriesConfig[]>;
2210
+ /**
2211
+ * Render a custom overlay floated over the canvas, handed the live
2212
+ * price↔pixel / time↔pixel {@link ChartOverlayContext}. Use its `scale` snapshot
2213
+ * and mapping worklets to position React Native UI against this chart's resolved
2214
+ * plot bounds (including any axis or explicit inset). The tree mounts full-bleed
2215
+ * with `pointerEvents="box-none"`; return `null`/`undefined` for no overlay.
2216
+ */
2217
+ renderOverlay?: (ctx: ChartOverlayContext) => ReactElement | null | undefined;
2087
2218
  /**
2088
2219
  * Render a Form-A reference line's tag as a custom **React Native** element
2089
2220
  * instead of the built-in Skia pill / gutter label. The chart pins the returned
2090
2221
  * element to the line's live Y position on the UI thread (see
2091
2222
  * {@link ReferenceLineRenderProps}), including off-axis edge pinning. Return
2092
2223
  * `null`/`undefined` to keep that line's built-in tag. The line stroke always
2093
- * remains visible, and `badge.position` / `labelPosition` controls the custom
2094
- * tag's left, center, or right anchor.
2224
+ * remains visible; a left- or right-pinned badge also keeps its dashed connector,
2225
+ * starting after the measured custom tag. `badge.position` / `labelPosition`
2226
+ * controls the custom tag's left, center, or right anchor.
2095
2227
  */
2096
2228
  renderReferenceLine?: (ctx: ReferenceLineRenderProps) => ReactElement | null | undefined;
2229
+ /**
2230
+ * Render only a Form-A line's **off-axis** tag as a custom React Native element.
2231
+ * The normal in-range Skia tag / gutter label stays visible, while an edge-pinned
2232
+ * custom tag replaces it above or below the plot. A left- or right-pinned
2233
+ * `badge` (or legacy `offAxisBadge`) retains its native dashed connector, measured
2234
+ * against the custom tag. Return `null`/`undefined` to opt a static `line` /
2235
+ * `index` out; use the `edge` SharedValue inside the returned element to animate
2236
+ * its caret. `renderReferenceLine` takes precedence for the same line.
2237
+ */
2238
+ renderOffAxisReferenceLine?: (ctx: ReferenceLineRenderProps) => ReactElement | null | undefined;
2097
2239
  /** Called when a series toggle chip is tapped. */
2098
2240
  onSeriesToggle?: (id: string, visible: boolean) => void;
2099
2241
  /**