react-native-livechart 4.31.1 → 4.32.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/CrosshairOverlay.d.ts +3 -1
- package/dist/components/CrosshairOverlay.d.ts.map +1 -1
- package/dist/components/CustomMarkerOverlay.d.ts +2 -2
- package/dist/components/CustomMarkerOverlay.d.ts.map +1 -1
- package/dist/components/FreeCrosshairOverlay.d.ts +25 -0
- package/dist/components/FreeCrosshairOverlay.d.ts.map +1 -0
- package/dist/components/LiveChart.d.ts.map +1 -1
- package/dist/components/LiveChartSeries.d.ts.map +1 -1
- package/dist/components/MarkerOverlay.d.ts +2 -2
- package/dist/components/MarkerOverlay.d.ts.map +1 -1
- package/dist/components/ScrubActionOverlay.d.ts +7 -1
- package/dist/components/ScrubActionOverlay.d.ts.map +1 -1
- package/dist/core/liveChartEngineTick.d.ts +2 -0
- package/dist/core/liveChartEngineTick.d.ts.map +1 -1
- package/dist/core/liveChartSeriesEngineTick.d.ts +6 -0
- package/dist/core/liveChartSeriesEngineTick.d.ts.map +1 -1
- package/dist/core/resolveConfig.d.ts +4 -0
- package/dist/core/resolveConfig.d.ts.map +1 -1
- package/dist/core/useLiveChartEngine.d.ts +7 -2
- package/dist/core/useLiveChartEngine.d.ts.map +1 -1
- package/dist/core/useLiveChartSeriesEngine.d.ts +9 -1
- package/dist/core/useLiveChartSeriesEngine.d.ts.map +1 -1
- package/dist/hooks/crosshairSeries.d.ts +1 -1
- package/dist/hooks/crosshairSeries.d.ts.map +1 -1
- package/dist/hooks/crosshairShared.d.ts +4 -2
- package/dist/hooks/crosshairShared.d.ts.map +1 -1
- package/dist/hooks/useCrosshair.d.ts +5 -1
- package/dist/hooks/useCrosshair.d.ts.map +1 -1
- package/dist/hooks/useCrosshairSeries.d.ts.map +1 -1
- package/dist/hooks/useMarkers.d.ts +2 -2
- package/dist/hooks/useMarkers.d.ts.map +1 -1
- package/dist/hooks/usePanScroll.d.ts +2 -0
- package/dist/hooks/usePanScroll.d.ts.map +1 -1
- package/dist/hooks/usePinchZoom.d.ts +2 -0
- package/dist/hooks/usePinchZoom.d.ts.map +1 -1
- package/dist/hooks/useReferenceLineSeries.d.ts +1 -1
- package/dist/hooks/useReferenceLineSeries.d.ts.map +1 -1
- package/dist/hooks/useScrubMarkers.d.ts +2 -1
- package/dist/hooks/useScrubMarkers.d.ts.map +1 -1
- package/dist/hooks/useVisibleRange.d.ts +8 -17
- package/dist/hooks/useVisibleRange.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/math/markers.d.ts +6 -0
- package/dist/math/markers.d.ts.map +1 -1
- package/dist/math/referenceLineSeries.d.ts +1 -1
- package/dist/math/referenceLineSeries.d.ts.map +1 -1
- package/dist/math/scrubMarkers.d.ts +1 -1
- package/dist/math/scrubMarkers.d.ts.map +1 -1
- package/dist/math/spline.d.ts +3 -2
- package/dist/math/spline.d.ts.map +1 -1
- package/dist/types.d.ts +47 -6
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/CrosshairOverlay.tsx +7 -0
- package/src/components/CustomMarkerOverlay.tsx +5 -2
- package/src/components/FreeCrosshairOverlay.tsx +87 -0
- package/src/components/LiveChart.tsx +97 -73
- package/src/components/LiveChartSeries.tsx +33 -20
- package/src/components/MarkerOverlay.tsx +24 -14
- package/src/components/ScrubActionOverlay.tsx +24 -5
- package/src/core/liveChartEngineTick.ts +3 -0
- package/src/core/liveChartSeriesEngineTick.ts +25 -4
- package/src/core/resolveConfig.ts +13 -0
- package/src/core/useLiveChartEngine.ts +14 -2
- package/src/core/useLiveChartSeriesEngine.ts +44 -7
- package/src/hooks/crosshairSeries.ts +4 -4
- package/src/hooks/crosshairShared.ts +18 -12
- package/src/hooks/useCrosshair.ts +29 -5
- package/src/hooks/useCrosshairSeries.ts +10 -4
- package/src/hooks/useMarkers.ts +7 -4
- package/src/hooks/usePanScroll.ts +3 -1
- package/src/hooks/usePinchZoom.ts +8 -5
- package/src/hooks/useReferenceLineSeries.ts +8 -4
- package/src/hooks/useScrubMarkers.ts +5 -2
- package/src/hooks/useVisibleRange.ts +96 -66
- package/src/index.ts +1 -0
- package/src/math/markers.ts +25 -8
- package/src/math/referenceLineSeries.ts +4 -3
- package/src/math/scrubMarkers.ts +4 -1
- package/src/math/spline.ts +41 -25
- package/src/types.ts +45 -6
package/src/types.ts
CHANGED
|
@@ -1109,7 +1109,7 @@ export interface ScrubConfig {
|
|
|
1109
1109
|
* to the standard `"future"` behavior. When the finger is in a gap between
|
|
1110
1110
|
* candle buckets no candle is selected. Volume bars are unchanged. The
|
|
1111
1111
|
* vertical crosshair and scrub selection dot are hidden so the focused
|
|
1112
|
-
* candle is the sole position indicator.
|
|
1112
|
+
* candle is the sole position indicator unless `freeCrosshair` enables both guides.
|
|
1113
1113
|
*
|
|
1114
1114
|
* Default `"future"`.
|
|
1115
1115
|
*/
|
|
@@ -1244,6 +1244,30 @@ export interface ScrubConfig {
|
|
|
1244
1244
|
* candles keeps the raw finger X; no effect in line mode. Default `false`.
|
|
1245
1245
|
*/
|
|
1246
1246
|
snapToCandles?: boolean;
|
|
1247
|
+
/**
|
|
1248
|
+
* Free X/Y crosshair. While scrubbing, a horizontal line follows the
|
|
1249
|
+
* finger's Y with a price pill in the price-axis gutter (the price at that
|
|
1250
|
+
* Y, not the line value), and a time pill marks the crosshair X on the time
|
|
1251
|
+
* axis below any volume band. The price pill follows `yAxis.side`. Both guides
|
|
1252
|
+
* and pills follow the configured edge fade, including with `otherCandles`.
|
|
1253
|
+
* `onScrub` keeps the selected series value. The pills use `tooltipBackground`
|
|
1254
|
+
* and `tooltipColor`. The horizontal line uses the crosshair color, width
|
|
1255
|
+
* and dash. Pair with
|
|
1256
|
+
* `tooltip: false` and `selectionDot={false}` for a guide-only readout.
|
|
1257
|
+
* `true` formats the time pill with the chart's `formatTime`; an object can
|
|
1258
|
+
* pass its own worklet. Single-series `LiveChart` only. Default `false`.
|
|
1259
|
+
*/
|
|
1260
|
+
freeCrosshair?: boolean | FreeCrosshairConfig;
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
/** Options for {@link ScrubConfig.freeCrosshair}. */
|
|
1264
|
+
export interface FreeCrosshairConfig {
|
|
1265
|
+
/**
|
|
1266
|
+
* Worklet that formats the time pill (unix seconds in). Omit to use the
|
|
1267
|
+
* chart's `formatTime`, which is tuned for axis ticks and often too coarse
|
|
1268
|
+
* for a single point.
|
|
1269
|
+
*/
|
|
1270
|
+
formatTime?: (time: number) => string;
|
|
1247
1271
|
}
|
|
1248
1272
|
|
|
1249
1273
|
/**
|
|
@@ -1602,7 +1626,7 @@ export interface Marker {
|
|
|
1602
1626
|
time: number;
|
|
1603
1627
|
/** Glyph kind. */
|
|
1604
1628
|
kind: MarkerKind;
|
|
1605
|
-
/** Anchor y to this series' line at `time` (multi-series). */
|
|
1629
|
+
/** Anchor y to this series' line at `time` once its presentation head reaches that time (multi-series). */
|
|
1606
1630
|
seriesId?: string;
|
|
1607
1631
|
/**
|
|
1608
1632
|
* Absolute y value in data space. Takes precedence over `seriesId`. Omit it on
|
|
@@ -2350,7 +2374,7 @@ export interface VisibleRange {
|
|
|
2350
2374
|
startSec: number;
|
|
2351
2375
|
/** Right-edge time of the visible window (unix seconds). */
|
|
2352
2376
|
endSec: number;
|
|
2353
|
-
/** True
|
|
2377
|
+
/** True while following live, including after retained history evicts a parked edge. False while parked, paused or gliding back. */
|
|
2354
2378
|
following: boolean;
|
|
2355
2379
|
}
|
|
2356
2380
|
|
|
@@ -2811,7 +2835,9 @@ export interface LiveChartCoreProps {
|
|
|
2811
2835
|
/**
|
|
2812
2836
|
* Selection dot drawn at the scrub intersection while scrubbing. `true` =
|
|
2813
2837
|
* built-in dot, `false` = hidden, or pass `SelectionDotConfig` (`size`,
|
|
2814
|
-
* `color`, `ring`, or a custom `component`).
|
|
2838
|
+
* `color`, `ring`, or a custom `component`). With `scrub.freeCrosshair` it
|
|
2839
|
+
* marks the crosshair intersection under the finger instead of the series
|
|
2840
|
+
* value, in candle mode too.
|
|
2815
2841
|
*
|
|
2816
2842
|
* Defaults differ per chart: `LiveChart` shows it (`true`); `LiveChartSeries`
|
|
2817
2843
|
* hides it (`false`) — with multiple lines the dot can only track the leading
|
|
@@ -2827,6 +2853,8 @@ export interface LiveChartCoreProps {
|
|
|
2827
2853
|
/**
|
|
2828
2854
|
* Called as the visible time window changes (throttled to ~1 Hz), with the
|
|
2829
2855
|
* window's edges in unix seconds and whether the chart is at the live edge.
|
|
2856
|
+
* Rapid changes are coalesced and the final settled range is delivered.
|
|
2857
|
+
* A change that triggers onReachStart is reported immediately, before the paging callback.
|
|
2830
2858
|
* Useful for paging data sources alongside `timeScroll` / `zoom`.
|
|
2831
2859
|
*
|
|
2832
2860
|
* @experimental
|
|
@@ -2835,7 +2863,9 @@ export interface LiveChartCoreProps {
|
|
|
2835
2863
|
/**
|
|
2836
2864
|
* Called once when the visible window's left edge comes within one
|
|
2837
2865
|
* window-width of the earliest retained data — the cue to lazily load older
|
|
2838
|
-
* history.
|
|
2866
|
+
* history. The paging width excludes the future span added by `timeHorizon`.
|
|
2867
|
+
* Multi-series paging starts with the first measured viewport containing retained samples.
|
|
2868
|
+
* Re-arms after the edge moves back out.
|
|
2839
2869
|
*
|
|
2840
2870
|
* @experimental
|
|
2841
2871
|
*/
|
|
@@ -3165,7 +3195,8 @@ export interface LiveChartProps extends LiveChartCoreProps {
|
|
|
3165
3195
|
*/
|
|
3166
3196
|
renderOverlay?: (ctx: ChartOverlayContext) => ReactElement | null | undefined;
|
|
3167
3197
|
/**
|
|
3168
|
-
* JS-thread callback while scrubbing
|
|
3198
|
+
* JS-thread callback while scrubbing. Receives `null` when scrub ends.
|
|
3199
|
+
* With `scrub.freeCrosshair`, the point still carries the series value. With
|
|
3169
3200
|
* `scrub.markers` enabled, includes matching markers and also sends `null`
|
|
3170
3201
|
* when a valid point becomes unavailable (for example an unpriced gap).
|
|
3171
3202
|
*/
|
|
@@ -3275,6 +3306,14 @@ export interface LiveChartSeriesProps extends LiveChartCoreProps {
|
|
|
3275
3306
|
* restores following. A non-finite or future start falls back to timeWindow.
|
|
3276
3307
|
*/
|
|
3277
3308
|
historyStartTime?: number;
|
|
3309
|
+
/**
|
|
3310
|
+
* Reveal a future Unix-second timestamp while following live. Animate
|
|
3311
|
+
* `progress` from 0 (normal viewport) to 1 (right edge at `at`) and back.
|
|
3312
|
+
* The left edge follows its ordinary clock and the live tips stay at the
|
|
3313
|
+
* data head. Pan, pinch, pause and return-to-live take precedence.
|
|
3314
|
+
* To also expand Y on hold, use the same progress in `rangeAnimation.transform`.
|
|
3315
|
+
*/
|
|
3316
|
+
timeHorizon?: { at: number; progress: SharedValue<number> };
|
|
3278
3317
|
/**
|
|
3279
3318
|
* Shared-range easing plus an optional reversible UI-thread presentation
|
|
3280
3319
|
* transform. See {@link SeriesRangeAnimationConfig}; recorded values remain unchanged.
|