react-native-livechart 4.11.0 → 4.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/CrosshairLine.d.ts +12 -2
- package/dist/components/CrosshairLine.d.ts.map +1 -1
- package/dist/components/CrosshairOverlay.d.ts +12 -2
- package/dist/components/CrosshairOverlay.d.ts.map +1 -1
- package/dist/components/CustomReferenceLineOverlay.d.ts +15 -10
- package/dist/components/CustomReferenceLineOverlay.d.ts.map +1 -1
- package/dist/components/CustomTooltipOverlay.d.ts +5 -2
- package/dist/components/CustomTooltipOverlay.d.ts.map +1 -1
- package/dist/components/DotOverlay.d.ts +3 -5
- package/dist/components/DotOverlay.d.ts.map +1 -1
- package/dist/components/LiveChart.d.ts.map +1 -1
- package/dist/components/LiveChartSeries.d.ts.map +1 -1
- package/dist/components/PerSeriesTooltipOverlay.d.ts +21 -0
- package/dist/components/PerSeriesTooltipOverlay.d.ts.map +1 -0
- package/dist/components/ReferenceLineOverlay.d.ts +27 -6
- package/dist/components/ReferenceLineOverlay.d.ts.map +1 -1
- package/dist/components/YAxisOverlay.d.ts +8 -2
- package/dist/components/YAxisOverlay.d.ts.map +1 -1
- package/dist/core/liveIndicatorVisibility.d.ts +9 -0
- package/dist/core/liveIndicatorVisibility.d.ts.map +1 -0
- package/dist/core/resolveConfig.d.ts +45 -0
- package/dist/core/resolveConfig.d.ts.map +1 -1
- package/dist/draw/grid.d.ts +13 -0
- package/dist/draw/grid.d.ts.map +1 -1
- package/dist/hooks/crosshairSeries.d.ts +10 -2
- package/dist/hooks/crosshairSeries.d.ts.map +1 -1
- package/dist/hooks/crosshairShared.d.ts +55 -5
- package/dist/hooks/crosshairShared.d.ts.map +1 -1
- package/dist/hooks/delayedPanGuard.d.ts +66 -8
- package/dist/hooks/delayedPanGuard.d.ts.map +1 -1
- package/dist/hooks/useChartPaths.d.ts +5 -9
- package/dist/hooks/useChartPaths.d.ts.map +1 -1
- package/dist/hooks/useCrosshair.d.ts +13 -1
- package/dist/hooks/useCrosshair.d.ts.map +1 -1
- package/dist/hooks/useCrosshairSeries.d.ts +27 -3
- package/dist/hooks/useCrosshairSeries.d.ts.map +1 -1
- package/dist/hooks/useCrosshairVisibleOpacity.d.ts +8 -0
- package/dist/hooks/useCrosshairVisibleOpacity.d.ts.map +1 -0
- package/dist/hooks/useMomentum.d.ts +1 -1
- package/dist/hooks/useMomentum.d.ts.map +1 -1
- package/dist/hooks/usePanScroll.d.ts +15 -1
- package/dist/hooks/usePanScroll.d.ts.map +1 -1
- package/dist/hooks/useReferenceLine.d.ts +10 -1
- package/dist/hooks/useReferenceLine.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/math/lerp.d.ts.map +1 -1
- package/dist/math/momentum.d.ts +1 -1
- package/dist/math/momentum.d.ts.map +1 -1
- package/dist/math/referenceLines.d.ts +7 -0
- package/dist/math/referenceLines.d.ts.map +1 -1
- package/dist/types.d.ts +207 -18
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/CrosshairLine.tsx +39 -8
- package/src/components/CrosshairOverlay.tsx +49 -15
- package/src/components/CustomReferenceLineOverlay.tsx +42 -13
- package/src/components/CustomTooltipOverlay.tsx +15 -3
- package/src/components/DotOverlay.tsx +24 -8
- package/src/components/LiveChart.tsx +182 -39
- package/src/components/LiveChartSeries.tsx +195 -16
- package/src/components/PerSeriesTooltipOverlay.tsx +290 -0
- package/src/components/ReferenceLineOverlay.tsx +288 -141
- package/src/components/YAxisOverlay.tsx +39 -10
- package/src/core/liveIndicatorVisibility.ts +25 -0
- package/src/core/resolveConfig.ts +115 -0
- package/src/draw/grid.ts +33 -0
- package/src/hooks/crosshairSeries.ts +262 -33
- package/src/hooks/crosshairShared.ts +117 -6
- package/src/hooks/delayedPanGuard.ts +111 -6
- package/src/hooks/useChartPaths.ts +25 -15
- package/src/hooks/useCrosshair.ts +103 -32
- package/src/hooks/useCrosshairSeries.ts +126 -11
- package/src/hooks/useCrosshairVisibleOpacity.ts +57 -0
- package/src/hooks/useMomentum.ts +8 -1
- package/src/hooks/usePanScroll.ts +46 -5
- package/src/hooks/useReferenceLine.ts +26 -1
- package/src/index.ts +1 -0
- package/src/math/lerp.ts +7 -0
- package/src/math/momentum.ts +22 -5
- package/src/math/referenceLines.ts +38 -0
- package/src/types.ts +215 -18
package/src/types.ts
CHANGED
|
@@ -63,6 +63,11 @@ export type BadgeVariant = "default" | "minimal";
|
|
|
63
63
|
* - **Form C** — vertical time band between `from` and `to` (unix seconds).
|
|
64
64
|
*/
|
|
65
65
|
export interface ReferenceLine {
|
|
66
|
+
/**
|
|
67
|
+
* Stable identifier for this line. Supply a unique value when `referenceLines`
|
|
68
|
+
* may be reordered so the chart preserves the line's rendered identity.
|
|
69
|
+
*/
|
|
70
|
+
id?: string;
|
|
66
71
|
/** Form A — the Y-axis value where the horizontal line is drawn. */
|
|
67
72
|
value?: number;
|
|
68
73
|
/** Form B — horizontal band lower Y bound (paired with `valueTo`). */
|
|
@@ -254,14 +259,16 @@ export interface ReferenceLineBadgeConfig extends BadgeStyleConfig {
|
|
|
254
259
|
|
|
255
260
|
/**
|
|
256
261
|
* Context passed to a custom {@link LiveChartProps.renderReferenceLine} or
|
|
257
|
-
* {@link
|
|
258
|
-
*
|
|
259
|
-
* the
|
|
260
|
-
* label position) — so it tracks the
|
|
261
|
-
* JS re-renders, just like
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
262
|
+
* {@link LiveChartProps.renderOffAxisReferenceLine} (and their
|
|
263
|
+
* `LiveChartSeries` counterparts). The chart floats the element you return over
|
|
264
|
+
* the canvas and pins it to the line's value on the UI thread (vertically centered
|
|
265
|
+
* on the line, horizontally at the badge / label position) — so it tracks the
|
|
266
|
+
* rescaling axis and any drag smoothly without JS re-renders, just like
|
|
267
|
+
* {@link TooltipRenderProps}. `renderReferenceLine` replaces the built-in pill /
|
|
268
|
+
* gutter label in every state; `renderOffAxisReferenceLine` replaces it only while
|
|
269
|
+
* the value is pinned above or below the visible plot. Bind the SharedValues to
|
|
270
|
+
* animated text (e.g. an animated `TextInput`) for the value to update on the UI
|
|
271
|
+
* thread too.
|
|
265
272
|
*/
|
|
266
273
|
export interface ReferenceLineRenderProps {
|
|
267
274
|
/** The reference line being rendered. */
|
|
@@ -592,7 +599,9 @@ export interface BadgeConfig extends BadgeStyleConfig {
|
|
|
592
599
|
* When the chart is scrolled back (see `timeScroll`), move the live-price
|
|
593
600
|
* indicators — the badge, the value line, and the live dot — to the price at
|
|
594
601
|
* the visible window's right edge instead of the live price, so they track the
|
|
595
|
-
* last visible price as you pan.
|
|
602
|
+
* last visible price as you pan. The badge's momentum color is derived at that
|
|
603
|
+
* same historical edge, so incoming live ticks do not recolor it. Default
|
|
604
|
+
* `false`.
|
|
596
605
|
*
|
|
597
606
|
* @experimental
|
|
598
607
|
*/
|
|
@@ -638,6 +647,18 @@ export interface YAxisConfig {
|
|
|
638
647
|
* (the label pool size). Omit (or `0`) for the default dynamic grid.
|
|
639
648
|
*/
|
|
640
649
|
count?: number;
|
|
650
|
+
/**
|
|
651
|
+
* Place price labels in a shared left-aligned column whose right edge sits
|
|
652
|
+
* this many pixels from the canvas edge. When omitted, labels keep the
|
|
653
|
+
* default centered-gutter placement.
|
|
654
|
+
*/
|
|
655
|
+
labelRightMargin?: number;
|
|
656
|
+
/**
|
|
657
|
+
* Gap (px) between the shared price-label column and the end of each grid or
|
|
658
|
+
* plain reference line. Only applies when {@link labelRightMargin} is set.
|
|
659
|
+
* Default `0`.
|
|
660
|
+
*/
|
|
661
|
+
gridEndGap?: number;
|
|
641
662
|
/**
|
|
642
663
|
* Float the price axis over a full-width plot instead of reserving a right
|
|
643
664
|
* gutter for it. The line/candles run all the way to the right edge, and the
|
|
@@ -716,10 +737,102 @@ export interface XAxisConfig {
|
|
|
716
737
|
minGap?: number;
|
|
717
738
|
}
|
|
718
739
|
|
|
740
|
+
/**
|
|
741
|
+
* Morfi-style on-canvas tooltip for {@link LiveChartSeries}: a time-range pill
|
|
742
|
+
* above the guide plus one value pill at every visible series intersection.
|
|
743
|
+
*
|
|
744
|
+
* Enable it with `scrub={{ seriesTooltip: true }}` or pass this object to style
|
|
745
|
+
* and format the readout. It is ignored by the single-series {@link LiveChart}.
|
|
746
|
+
*/
|
|
747
|
+
export interface PerSeriesTooltipConfig {
|
|
748
|
+
/**
|
|
749
|
+
* Keep the value pills pinned to the visible series endpoints while idle.
|
|
750
|
+
* The guide and time pill remain hidden until a scrub starts. Default `false`.
|
|
751
|
+
*/
|
|
752
|
+
alwaysShow?: boolean;
|
|
753
|
+
/**
|
|
754
|
+
* Bucket width used by the time-range pill, in seconds. Omit to infer it from
|
|
755
|
+
* the latest positive interval in the first visible series.
|
|
756
|
+
*/
|
|
757
|
+
bucketSeconds?: number;
|
|
758
|
+
/**
|
|
759
|
+
* Format a value pill. The second argument identifies the series so one chart
|
|
760
|
+
* can dispatch to different unit formatters. Defaults to the chart's
|
|
761
|
+
* `formatValue`.
|
|
762
|
+
*
|
|
763
|
+
* Runs on the UI thread and must be worklet-safe.
|
|
764
|
+
*/
|
|
765
|
+
formatSeriesValue?: (value: number, seriesId: string) => string;
|
|
766
|
+
/**
|
|
767
|
+
* Format the time pill from the bucket's start/end unix seconds. The end is
|
|
768
|
+
* clamped to the chart's current-time anchor, so the live bucket never claims
|
|
769
|
+
* to end in the future. Defaults to two chart `formatTime` labels joined by
|
|
770
|
+
* an en dash.
|
|
771
|
+
*
|
|
772
|
+
* Runs on the UI thread and must be worklet-safe.
|
|
773
|
+
*/
|
|
774
|
+
formatTimeRange?: (from: number, to: number) => string;
|
|
775
|
+
/** Truncate labels longer than this many characters with `…`. Default `14`. */
|
|
776
|
+
maxLabelChars?: number;
|
|
777
|
+
|
|
778
|
+
/** Guide color. Omit to use `scrub.crosshairLineColor`, then the theme. */
|
|
779
|
+
guideColor?: string;
|
|
780
|
+
/** Guide stroke width in px. Default `1`. */
|
|
781
|
+
guideWidth?: number;
|
|
782
|
+
/**
|
|
783
|
+
* Guide dash pattern. `true` uses `[3, 3]`; an array supplies explicit Skia
|
|
784
|
+
* dash intervals; `false` draws a solid guide. Default `[3, 3]`.
|
|
785
|
+
*/
|
|
786
|
+
guideDashPattern?: boolean | number[];
|
|
787
|
+
|
|
788
|
+
/** Time-pill background. Omit to use `scrub.tooltipBackground`, then the theme. */
|
|
789
|
+
timePillBackground?: string;
|
|
790
|
+
/** Time-pill text color. Omit to use `scrub.tooltipColor`, then the theme. */
|
|
791
|
+
timePillColor?: string;
|
|
792
|
+
/** Time-pill border color. Omit to use `scrub.tooltipBorderColor`, then the theme. */
|
|
793
|
+
timePillBorderColor?: string;
|
|
794
|
+
/** Time-pill corner radius in px. Default `6`. */
|
|
795
|
+
timePillRadius?: number;
|
|
796
|
+
/** Time-pill horizontal padding in px. Default `8`. */
|
|
797
|
+
timePillPaddingX?: number;
|
|
798
|
+
/** Time-pill vertical padding in px. Default `4`. */
|
|
799
|
+
timePillPaddingY?: number;
|
|
800
|
+
|
|
801
|
+
/** Series-pill background. Omit to use `scrub.tooltipBackground`, then the theme. */
|
|
802
|
+
seriesPillBackground?: string;
|
|
803
|
+
/** Series label color. Omit to use the theme tooltip text. */
|
|
804
|
+
seriesPillLabelColor?: string;
|
|
805
|
+
/** Formatted series value color. Omit to use `seriesPillLabelColor`. */
|
|
806
|
+
seriesPillValueColor?: string;
|
|
807
|
+
/** Series-pill border color. Omit to use `scrub.tooltipBorderColor`, then the theme. */
|
|
808
|
+
seriesPillBorderColor?: string;
|
|
809
|
+
/** Series-pill corner radius in px. Default `6`. */
|
|
810
|
+
seriesPillRadius?: number;
|
|
811
|
+
/** Series-pill horizontal padding in px. Default `8`. */
|
|
812
|
+
seriesPillPaddingX?: number;
|
|
813
|
+
/** Series-pill vertical padding in px. Default `4`. */
|
|
814
|
+
seriesPillPaddingY?: number;
|
|
815
|
+
/** Diameter of the series-colour dot inside each pill, in px. Default `8`. */
|
|
816
|
+
seriesPillDotSize?: number;
|
|
817
|
+
/** Gap between the colour dot and label, in px. Default `6`. */
|
|
818
|
+
seriesPillDotGap?: number;
|
|
819
|
+
/** Gap between the label and formatted value, in px. Default `6`. */
|
|
820
|
+
seriesPillLabelValueGap?: number;
|
|
821
|
+
/** Diameter of the dot drawn at each line/guide intersection. Default `8`. */
|
|
822
|
+
intersectionDotSize?: number;
|
|
823
|
+
}
|
|
824
|
+
|
|
719
825
|
/** Crosshair scrub configuration. */
|
|
720
826
|
export interface ScrubConfig {
|
|
721
827
|
/** Show the value/time tooltip pill while scrubbing. Default `true`. */
|
|
722
828
|
tooltip?: boolean;
|
|
829
|
+
/**
|
|
830
|
+
* Opt into the Morfi-style per-series pill tooltip on `LiveChartSeries`.
|
|
831
|
+
* `true` uses defaults; an object enables and configures it; `false`/omitted
|
|
832
|
+
* preserves the existing guide-only multi-series scrub. Ignored by
|
|
833
|
+
* single-series `LiveChart`. Default `false`.
|
|
834
|
+
*/
|
|
835
|
+
seriesTooltip?: boolean | PerSeriesTooltipConfig;
|
|
723
836
|
/**
|
|
724
837
|
* Opacity of the chart content to the *right* of the crosshair (the "future")
|
|
725
838
|
* while scrubbing — `0` fully fades it out, `1` disables the dim. Implemented
|
|
@@ -730,6 +843,33 @@ export interface ScrubConfig {
|
|
|
730
843
|
dimOpacity?: number;
|
|
731
844
|
/** Vertical crosshair line stroke. Omit to use theme `crosshairLine`. */
|
|
732
845
|
crosshairLineColor?: string;
|
|
846
|
+
/** Vertical crosshair line width in px. Default `1`. */
|
|
847
|
+
crosshairStrokeWidth?: number;
|
|
848
|
+
/**
|
|
849
|
+
* Extend the vertical crosshair line past the plot's top and bottom edges by
|
|
850
|
+
* this many px. A measured top custom-tooltip stop remains unchanged so the
|
|
851
|
+
* line does not draw through the tooltip. Negative values are clamped to `0`.
|
|
852
|
+
* Default `0`.
|
|
853
|
+
*/
|
|
854
|
+
crosshairOvershoot?: number;
|
|
855
|
+
/**
|
|
856
|
+
* Fade the crosshair as it approaches the live edge. Set `false` to keep the
|
|
857
|
+
* line, selection dot, and tooltip fully opaque while scrubbing. The trailing
|
|
858
|
+
* content dim keeps its own edge fade. Default `true`.
|
|
859
|
+
*/
|
|
860
|
+
crosshairFade?: boolean;
|
|
861
|
+
/**
|
|
862
|
+
* Distance in px over which the visible crosshair fades as it approaches the
|
|
863
|
+
* live edge. Applies to the line, selection dot, and tooltip when
|
|
864
|
+
* `crosshairFade` is enabled; the trailing-content dim keeps its existing
|
|
865
|
+
* fade. Negative values are clamped to `0`. Default `4`.
|
|
866
|
+
*/
|
|
867
|
+
crosshairFadeDistance?: number;
|
|
868
|
+
/**
|
|
869
|
+
* Cap style for the vertical crosshair line. Omit to preserve the existing
|
|
870
|
+
* Skia default.
|
|
871
|
+
*/
|
|
872
|
+
crosshairLineCap?: "butt" | "round" | "square";
|
|
733
873
|
/**
|
|
734
874
|
* Dash the vertical crosshair line. `true` → a default `[4, 4]` dash; an array
|
|
735
875
|
* sets explicit Skia dash intervals `[on, off, …]` in px. Omit / `false` → a
|
|
@@ -797,6 +937,14 @@ export interface ScrubConfig {
|
|
|
797
937
|
* `false` / omitted keeps the overlays visible while scrubbing (default).
|
|
798
938
|
*/
|
|
799
939
|
hideOverlaysOnScrub?: boolean;
|
|
940
|
+
/**
|
|
941
|
+
* Keep plain scrubbing inside the horizontal plot bounds. A gesture that
|
|
942
|
+
* starts in the Y-axis gutter (or beyond either horizontal edge) is ignored;
|
|
943
|
+
* one that starts inside remains active and clamps to the nearest plot edge
|
|
944
|
+
* while dragging. Scrub-action gestures retain their existing behavior.
|
|
945
|
+
* Default `false`.
|
|
946
|
+
*/
|
|
947
|
+
clampToPlot?: boolean;
|
|
800
948
|
}
|
|
801
949
|
|
|
802
950
|
/**
|
|
@@ -965,7 +1113,8 @@ export interface ChartScale {
|
|
|
965
1113
|
|
|
966
1114
|
/**
|
|
967
1115
|
* The price↔pixel / time↔pixel bridge handed to a custom
|
|
968
|
-
* {@link LiveChartProps.renderOverlay}
|
|
1116
|
+
* {@link LiveChartProps.renderOverlay} or
|
|
1117
|
+
* {@link LiveChartSeriesProps.renderOverlay}.
|
|
969
1118
|
*
|
|
970
1119
|
* **Easiest path — the `usePriceY` / `useTimeX` hooks.** They project a price / time
|
|
971
1120
|
* to a `SharedValue<number>` that tracks the live axis for you; just read it in
|
|
@@ -1620,6 +1769,15 @@ export interface TimeScrollConfig {
|
|
|
1620
1769
|
* if set, otherwise `500`.
|
|
1621
1770
|
*/
|
|
1622
1771
|
scrubHoldMs?: number;
|
|
1772
|
+
/**
|
|
1773
|
+
* Hide the live badge, dot, and dashed value line while scrolled back through
|
|
1774
|
+
* history. Default `true`: all three mark the LIVE price, which is off-screen
|
|
1775
|
+
* once the window is frozen behind the live edge, so they'd point at a price
|
|
1776
|
+
* that isn't in view. Set `false` to keep them visible while scrolled back.
|
|
1777
|
+
* Ignored when `badge.followViewEdge` is on — there the group tracks the
|
|
1778
|
+
* visible edge price, which IS in view.
|
|
1779
|
+
*/
|
|
1780
|
+
hideLiveOnScrollBack?: boolean;
|
|
1623
1781
|
}
|
|
1624
1782
|
|
|
1625
1783
|
/**
|
|
@@ -2008,8 +2166,9 @@ export interface LiveChartCoreProps {
|
|
|
2008
2166
|
*
|
|
2009
2167
|
* Defaults differ per chart: `LiveChart` shows it (`true`); `LiveChartSeries`
|
|
2010
2168
|
* hides it (`false`) — with multiple lines the dot can only track the leading
|
|
2011
|
-
* series
|
|
2012
|
-
* Pass `true` / a config to
|
|
2169
|
+
* series. The crosshair — and, when enabled, the per-series tooltip's own
|
|
2170
|
+
* intersection dots — mark the scrub point instead. Pass `true` / a config to
|
|
2171
|
+
* opt a multi-series chart in.
|
|
2013
2172
|
*/
|
|
2014
2173
|
selectionDot?: boolean | SelectionDotConfig;
|
|
2015
2174
|
/** Called once when the user starts scrubbing/panning the chart. */
|
|
@@ -2161,19 +2320,36 @@ export interface LiveChartProps extends LiveChartCoreProps {
|
|
|
2161
2320
|
* pins it to the line's value on the UI thread (see {@link ReferenceLineRenderProps}),
|
|
2162
2321
|
* so it tracks the rescaling axis and any drag without JS re-renders. Called per
|
|
2163
2322
|
* Form-A line; return `null`/`undefined` to keep that line's built-in tag. Works
|
|
2164
|
-
* with `badge: false` too (replace the plain gutter label).
|
|
2323
|
+
* with `badge: false` too (replace the plain gutter label). For a left- or
|
|
2324
|
+
* right-pinned `badge`, the chart retains the dashed connector and measures the
|
|
2325
|
+
* custom tag so the connector starts at its outer edge. Single-series only.
|
|
2165
2326
|
*/
|
|
2166
2327
|
renderReferenceLine?: (
|
|
2167
2328
|
ctx: ReferenceLineRenderProps,
|
|
2168
2329
|
) => ReactElement | null | undefined;
|
|
2330
|
+
/**
|
|
2331
|
+
* Render only a Form-A line's **off-axis** tag as a custom React Native element.
|
|
2332
|
+
* The chart keeps the standard Skia tag / gutter label while the value is in
|
|
2333
|
+
* range, then switches to this element when it pins above or below the plot.
|
|
2334
|
+
* With a left- or right-pinned `badge` (or legacy `offAxisBadge`), its dashed
|
|
2335
|
+
* connector stays native and begins after the measured custom tag. Return
|
|
2336
|
+
* `null`/`undefined` to opt a line out based on its static `line` / `index`;
|
|
2337
|
+
* use the `edge` SharedValue inside the returned element to animate a caret.
|
|
2338
|
+
* `renderReferenceLine` takes precedence if both callbacks handle one line.
|
|
2339
|
+
* Single-series only.
|
|
2340
|
+
*/
|
|
2341
|
+
renderOffAxisReferenceLine?: (
|
|
2342
|
+
ctx: ReferenceLineRenderProps,
|
|
2343
|
+
) => ReactElement | null | undefined;
|
|
2169
2344
|
/**
|
|
2170
2345
|
* Collapse Form-A reference lines whose handles sit near the same value into a
|
|
2171
2346
|
* single count handle (e.g. a stack of working orders at adjacent prices reads
|
|
2172
2347
|
* as one "×3" tag). `true` = defaults, `false`/omitted = off, or pass a
|
|
2173
2348
|
* {@link ReferenceLineGroupingConfig} to tune the proximity radius. Lines a
|
|
2174
|
-
* {@link LiveChartProps.renderReferenceLine}
|
|
2175
|
-
*
|
|
2176
|
-
* only
|
|
2349
|
+
* {@link LiveChartProps.renderReferenceLine} or
|
|
2350
|
+
* {@link LiveChartProps.renderOffAxisReferenceLine} owns are excluded (their
|
|
2351
|
+
* custom tag draws itself), so the count reflects only collapsed built-in tags.
|
|
2352
|
+
* Single-series only. Default off.
|
|
2177
2353
|
*/
|
|
2178
2354
|
referenceLineGrouping?: boolean | ReferenceLineGroupingConfig;
|
|
2179
2355
|
/**
|
|
@@ -2195,18 +2371,39 @@ export interface LiveChartProps extends LiveChartCoreProps {
|
|
|
2195
2371
|
export interface LiveChartSeriesProps extends LiveChartCoreProps {
|
|
2196
2372
|
/** Array of series definitions. Must be a SharedValue for UI-thread reads. */
|
|
2197
2373
|
series: SharedValue<SeriesConfig[]>;
|
|
2374
|
+
/**
|
|
2375
|
+
* Render a custom overlay floated over the canvas, handed the live
|
|
2376
|
+
* price↔pixel / time↔pixel {@link ChartOverlayContext}. Use its `scale` snapshot
|
|
2377
|
+
* and mapping worklets to position React Native UI against this chart's resolved
|
|
2378
|
+
* plot bounds (including any axis or explicit inset). The tree mounts full-bleed
|
|
2379
|
+
* with `pointerEvents="box-none"`; return `null`/`undefined` for no overlay.
|
|
2380
|
+
*/
|
|
2381
|
+
renderOverlay?: (ctx: ChartOverlayContext) => ReactElement | null | undefined;
|
|
2198
2382
|
/**
|
|
2199
2383
|
* Render a Form-A reference line's tag as a custom **React Native** element
|
|
2200
2384
|
* instead of the built-in Skia pill / gutter label. The chart pins the returned
|
|
2201
2385
|
* element to the line's live Y position on the UI thread (see
|
|
2202
2386
|
* {@link ReferenceLineRenderProps}), including off-axis edge pinning. Return
|
|
2203
2387
|
* `null`/`undefined` to keep that line's built-in tag. The line stroke always
|
|
2204
|
-
* remains visible
|
|
2205
|
-
*
|
|
2388
|
+
* remains visible; a left- or right-pinned badge also keeps its dashed connector,
|
|
2389
|
+
* starting after the measured custom tag. `badge.position` / `labelPosition`
|
|
2390
|
+
* controls the custom tag's left, center, or right anchor.
|
|
2206
2391
|
*/
|
|
2207
2392
|
renderReferenceLine?: (
|
|
2208
2393
|
ctx: ReferenceLineRenderProps,
|
|
2209
2394
|
) => ReactElement | null | undefined;
|
|
2395
|
+
/**
|
|
2396
|
+
* Render only a Form-A line's **off-axis** tag as a custom React Native element.
|
|
2397
|
+
* The normal in-range Skia tag / gutter label stays visible, while an edge-pinned
|
|
2398
|
+
* custom tag replaces it above or below the plot. A left- or right-pinned
|
|
2399
|
+
* `badge` (or legacy `offAxisBadge`) retains its native dashed connector, measured
|
|
2400
|
+
* against the custom tag. Return `null`/`undefined` to opt a static `line` /
|
|
2401
|
+
* `index` out; use the `edge` SharedValue inside the returned element to animate
|
|
2402
|
+
* its caret. `renderReferenceLine` takes precedence for the same line.
|
|
2403
|
+
*/
|
|
2404
|
+
renderOffAxisReferenceLine?: (
|
|
2405
|
+
ctx: ReferenceLineRenderProps,
|
|
2406
|
+
) => ReactElement | null | undefined;
|
|
2210
2407
|
/** Called when a series toggle chip is tapped. */
|
|
2211
2408
|
onSeriesToggle?: (id: string, visible: boolean) => void;
|
|
2212
2409
|
/**
|