react-native-livechart 1.0.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/LICENSE +33 -0
- package/README.md +198 -0
- package/dist/components/AnimatedLabel.d.ts +21 -0
- package/dist/components/AnimatedLabel.d.ts.map +1 -0
- package/dist/components/BadgeOverlay.d.ts +16 -0
- package/dist/components/BadgeOverlay.d.ts.map +1 -0
- package/dist/components/CrosshairLine.d.ts +20 -0
- package/dist/components/CrosshairLine.d.ts.map +1 -0
- package/dist/components/CrosshairOverlay.d.ts +29 -0
- package/dist/components/CrosshairOverlay.d.ts.map +1 -0
- package/dist/components/DegenParticlesOverlay.d.ts +16 -0
- package/dist/components/DegenParticlesOverlay.d.ts.map +1 -0
- package/dist/components/DotOverlay.d.ts +17 -0
- package/dist/components/DotOverlay.d.ts.map +1 -0
- package/dist/components/LeftEdgeFade.d.ts +9 -0
- package/dist/components/LeftEdgeFade.d.ts.map +1 -0
- package/dist/components/LiveChart.d.ts +3 -0
- package/dist/components/LiveChart.d.ts.map +1 -0
- package/dist/components/LiveChartSeries.d.ts +3 -0
- package/dist/components/LiveChartSeries.d.ts.map +1 -0
- package/dist/components/LiveChartTransition.d.ts +28 -0
- package/dist/components/LiveChartTransition.d.ts.map +1 -0
- package/dist/components/LoadingOverlay.d.ts +24 -0
- package/dist/components/LoadingOverlay.d.ts.map +1 -0
- package/dist/components/MarkerOverlay.d.ts +25 -0
- package/dist/components/MarkerOverlay.d.ts.map +1 -0
- package/dist/components/MultiSeriesDots.d.ts +11 -0
- package/dist/components/MultiSeriesDots.d.ts.map +1 -0
- package/dist/components/MultiSeriesStroke.d.ts +14 -0
- package/dist/components/MultiSeriesStroke.d.ts.map +1 -0
- package/dist/components/MultiSeriesTooltipStack.d.ts +10 -0
- package/dist/components/MultiSeriesTooltipStack.d.ts.map +1 -0
- package/dist/components/MultiSeriesValueLabels.d.ts +11 -0
- package/dist/components/MultiSeriesValueLabels.d.ts.map +1 -0
- package/dist/components/MultiSeriesValueLines.d.ts +10 -0
- package/dist/components/MultiSeriesValueLines.d.ts.map +1 -0
- package/dist/components/ReferenceLineOverlay.d.ts +19 -0
- package/dist/components/ReferenceLineOverlay.d.ts.map +1 -0
- package/dist/components/SeriesToggleChips.d.ts +15 -0
- package/dist/components/SeriesToggleChips.d.ts.map +1 -0
- package/dist/components/TradeStreamOverlay.d.ts +14 -0
- package/dist/components/TradeStreamOverlay.d.ts.map +1 -0
- package/dist/components/ValueLineOverlay.d.ts +16 -0
- package/dist/components/ValueLineOverlay.d.ts.map +1 -0
- package/dist/components/ValueTextOverlay.d.ts +20 -0
- package/dist/components/ValueTextOverlay.d.ts.map +1 -0
- package/dist/components/XAxisOverlay.d.ts +14 -0
- package/dist/components/XAxisOverlay.d.ts.map +1 -0
- package/dist/components/YAxisOverlay.d.ts +23 -0
- package/dist/components/YAxisOverlay.d.ts.map +1 -0
- package/dist/components/seriesMetaSig.d.ts +4 -0
- package/dist/components/seriesMetaSig.d.ts.map +1 -0
- package/dist/constants.d.ts +38 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/core/liveChartEngineTick.d.ts +45 -0
- package/dist/core/liveChartEngineTick.d.ts.map +1 -0
- package/dist/core/liveChartSeriesEngineTick.d.ts +38 -0
- package/dist/core/liveChartSeriesEngineTick.d.ts.map +1 -0
- package/dist/core/multiSeriesLayout.d.ts +22 -0
- package/dist/core/multiSeriesLayout.d.ts.map +1 -0
- package/dist/core/resolveConfig.d.ts +188 -0
- package/dist/core/resolveConfig.d.ts.map +1 -0
- package/dist/core/useLiveChartEngine.d.ts +79 -0
- package/dist/core/useLiveChartEngine.d.ts.map +1 -0
- package/dist/core/useLiveChartSeriesEngine.d.ts +68 -0
- package/dist/core/useLiveChartSeriesEngine.d.ts.map +1 -0
- package/dist/draw/candle.d.ts +25 -0
- package/dist/draw/candle.d.ts.map +1 -0
- package/dist/draw/grid.d.ts +24 -0
- package/dist/draw/grid.d.ts.map +1 -0
- package/dist/draw/line.d.ts +86 -0
- package/dist/draw/line.d.ts.map +1 -0
- package/dist/draw/trade.d.ts +38 -0
- package/dist/draw/trade.d.ts.map +1 -0
- package/dist/hooks/crosshairSeries.d.ts +13 -0
- package/dist/hooks/crosshairSeries.d.ts.map +1 -0
- package/dist/hooks/crosshairShared.d.ts +72 -0
- package/dist/hooks/crosshairShared.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +24 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/resolveChartLayout.d.ts +42 -0
- package/dist/hooks/resolveChartLayout.d.ts.map +1 -0
- package/dist/hooks/useBadge.d.ts +14 -0
- package/dist/hooks/useBadge.d.ts.map +1 -0
- package/dist/hooks/useCandlePaths.d.ts +19 -0
- package/dist/hooks/useCandlePaths.d.ts.map +1 -0
- package/dist/hooks/useCanvasLayout.d.ts +12 -0
- package/dist/hooks/useCanvasLayout.d.ts.map +1 -0
- package/dist/hooks/useChartColors.d.ts +20 -0
- package/dist/hooks/useChartColors.d.ts.map +1 -0
- package/dist/hooks/useChartPaths.d.ts +19 -0
- package/dist/hooks/useChartPaths.d.ts.map +1 -0
- package/dist/hooks/useChartReveal.d.ts +30 -0
- package/dist/hooks/useChartReveal.d.ts.map +1 -0
- package/dist/hooks/useChartSkiaFont.d.ts +8 -0
- package/dist/hooks/useChartSkiaFont.d.ts.map +1 -0
- package/dist/hooks/useCrosshair.d.ts +20 -0
- package/dist/hooks/useCrosshair.d.ts.map +1 -0
- package/dist/hooks/useCrosshairSeries.d.ts +10 -0
- package/dist/hooks/useCrosshairSeries.d.ts.map +1 -0
- package/dist/hooks/useDegen.d.ts +17 -0
- package/dist/hooks/useDegen.d.ts.map +1 -0
- package/dist/hooks/useLiveChartHasData.d.ts +17 -0
- package/dist/hooks/useLiveChartHasData.d.ts.map +1 -0
- package/dist/hooks/useLiveDot.d.ts +12 -0
- package/dist/hooks/useLiveDot.d.ts.map +1 -0
- package/dist/hooks/useMarkers.d.ts +15 -0
- package/dist/hooks/useMarkers.d.ts.map +1 -0
- package/dist/hooks/useModeBlend.d.ts +18 -0
- package/dist/hooks/useModeBlend.d.ts.map +1 -0
- package/dist/hooks/useMomentum.d.ts +16 -0
- package/dist/hooks/useMomentum.d.ts.map +1 -0
- package/dist/hooks/useMultiSeriesDegen.d.ts +25 -0
- package/dist/hooks/useMultiSeriesDegen.d.ts.map +1 -0
- package/dist/hooks/useMultiSeriesLinePaths.d.ts +15 -0
- package/dist/hooks/useMultiSeriesLinePaths.d.ts.map +1 -0
- package/dist/hooks/useReferenceLine.d.ts +32 -0
- package/dist/hooks/useReferenceLine.d.ts.map +1 -0
- package/dist/hooks/useReverseMorphEngineInputs.d.ts +24 -0
- package/dist/hooks/useReverseMorphEngineInputs.d.ts.map +1 -0
- package/dist/hooks/useTradeStream.d.ts +12 -0
- package/dist/hooks/useTradeStream.d.ts.map +1 -0
- package/dist/hooks/useXAxis.d.ts +32 -0
- package/dist/hooks/useXAxis.d.ts.map +1 -0
- package/dist/hooks/useYAxis.d.ts +13 -0
- package/dist/hooks/useYAxis.d.ts.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/lib/format.d.ts +5 -0
- package/dist/lib/format.d.ts.map +1 -0
- package/dist/lib/measureFontTextWidth.d.ts +7 -0
- package/dist/lib/measureFontTextWidth.d.ts.map +1 -0
- package/dist/lib/monoFontFamily.d.ts +6 -0
- package/dist/lib/monoFontFamily.d.ts.map +1 -0
- package/dist/math/color.d.ts +5 -0
- package/dist/math/color.d.ts.map +1 -0
- package/dist/math/degenTick.d.ts +57 -0
- package/dist/math/degenTick.d.ts.map +1 -0
- package/dist/math/interpolate.d.ts +7 -0
- package/dist/math/interpolate.d.ts.map +1 -0
- package/dist/math/intervals.d.ts +3 -0
- package/dist/math/intervals.d.ts.map +1 -0
- package/dist/math/lerp.d.ts +7 -0
- package/dist/math/lerp.d.ts.map +1 -0
- package/dist/math/markers.d.ts +44 -0
- package/dist/math/markers.d.ts.map +1 -0
- package/dist/math/momentum.d.ts +8 -0
- package/dist/math/momentum.d.ts.map +1 -0
- package/dist/math/pickCandle.d.ts +8 -0
- package/dist/math/pickCandle.d.ts.map +1 -0
- package/dist/math/range.d.ts +10 -0
- package/dist/math/range.d.ts.map +1 -0
- package/dist/math/referenceLines.d.ts +20 -0
- package/dist/math/referenceLines.d.ts.map +1 -0
- package/dist/math/spline.d.ts +45 -0
- package/dist/math/spline.d.ts.map +1 -0
- package/dist/math/squiggly.d.ts +36 -0
- package/dist/math/squiggly.d.ts.map +1 -0
- package/dist/theme.d.ts +30 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/types.d.ts +720 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +72 -0
- package/src/components/AnimatedLabel.tsx +41 -0
- package/src/components/BadgeOverlay.tsx +39 -0
- package/src/components/CrosshairLine.tsx +90 -0
- package/src/components/CrosshairOverlay.tsx +170 -0
- package/src/components/DegenParticlesOverlay.tsx +141 -0
- package/src/components/DotOverlay.tsx +69 -0
- package/src/components/LeftEdgeFade.tsx +36 -0
- package/src/components/LiveChart.tsx +821 -0
- package/src/components/LiveChartSeries.tsx +607 -0
- package/src/components/LiveChartTransition.tsx +135 -0
- package/src/components/LoadingOverlay.tsx +301 -0
- package/src/components/MarkerOverlay.tsx +331 -0
- package/src/components/MultiSeriesDots.tsx +117 -0
- package/src/components/MultiSeriesStroke.tsx +79 -0
- package/src/components/MultiSeriesTooltipStack.tsx +78 -0
- package/src/components/MultiSeriesValueLabels.tsx +103 -0
- package/src/components/MultiSeriesValueLines.tsx +115 -0
- package/src/components/ReferenceLineOverlay.tsx +317 -0
- package/src/components/SeriesToggleChips.tsx +201 -0
- package/src/components/TradeStreamOverlay.tsx +117 -0
- package/src/components/ValueLineOverlay.tsx +63 -0
- package/src/components/ValueTextOverlay.tsx +43 -0
- package/src/components/XAxisOverlay.tsx +109 -0
- package/src/components/YAxisOverlay.tsx +135 -0
- package/src/components/seriesMetaSig.ts +13 -0
- package/src/constants.ts +44 -0
- package/src/core/liveChartEngineTick.ts +185 -0
- package/src/core/liveChartSeriesEngineTick.ts +163 -0
- package/src/core/multiSeriesLayout.ts +80 -0
- package/src/core/resolveConfig.ts +538 -0
- package/src/core/useLiveChartEngine.ts +207 -0
- package/src/core/useLiveChartSeriesEngine.ts +215 -0
- package/src/draw/candle.ts +210 -0
- package/src/draw/grid.ts +174 -0
- package/src/draw/line.ts +257 -0
- package/src/draw/trade.ts +202 -0
- package/src/hooks/crosshairSeries.ts +78 -0
- package/src/hooks/crosshairShared.ts +296 -0
- package/src/hooks/index.ts +26 -0
- package/src/hooks/resolveChartLayout.ts +144 -0
- package/src/hooks/useBadge.ts +192 -0
- package/src/hooks/useCandlePaths.ts +165 -0
- package/src/hooks/useCanvasLayout.ts +22 -0
- package/src/hooks/useChartColors.ts +48 -0
- package/src/hooks/useChartPaths.ts +121 -0
- package/src/hooks/useChartReveal.ts +123 -0
- package/src/hooks/useChartSkiaFont.ts +34 -0
- package/src/hooks/useCrosshair.ts +250 -0
- package/src/hooks/useCrosshairSeries.ts +163 -0
- package/src/hooks/useDegen.ts +262 -0
- package/src/hooks/useLiveChartHasData.ts +31 -0
- package/src/hooks/useLiveDot.ts +31 -0
- package/src/hooks/useMarkers.ts +95 -0
- package/src/hooks/useModeBlend.ts +52 -0
- package/src/hooks/useMomentum.ts +37 -0
- package/src/hooks/useMultiSeriesDegen.ts +260 -0
- package/src/hooks/useMultiSeriesLinePaths.ts +76 -0
- package/src/hooks/useReferenceLine.ts +212 -0
- package/src/hooks/useReverseMorphEngineInputs.ts +154 -0
- package/src/hooks/useTradeStream.ts +64 -0
- package/src/hooks/useXAxis.ts +200 -0
- package/src/hooks/useYAxis.ts +48 -0
- package/src/index.ts +69 -0
- package/src/lib/format.ts +36 -0
- package/src/lib/measureFontTextWidth.ts +10 -0
- package/src/lib/monoFontFamily.ts +8 -0
- package/src/math/color.ts +31 -0
- package/src/math/degenTick.ts +151 -0
- package/src/math/interpolate.ts +32 -0
- package/src/math/intervals.ts +17 -0
- package/src/math/lerp.ts +17 -0
- package/src/math/markers.ts +175 -0
- package/src/math/momentum.ts +38 -0
- package/src/math/pickCandle.ts +42 -0
- package/src/math/range.ts +54 -0
- package/src/math/referenceLines.ts +56 -0
- package/src/math/spline.ts +183 -0
- package/src/math/squiggly.ts +108 -0
- package/src/theme.ts +231 -0
- package/src/types.ts +789 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,720 @@
|
|
|
1
|
+
import type { ViewStyle } from "react-native";
|
|
2
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
3
|
+
import type { DataSourceParam, SkFontMgr, SkImage } from "@shopify/react-native-skia";
|
|
4
|
+
/** A single data point on the chart timeline. */
|
|
5
|
+
export interface LiveChartPoint {
|
|
6
|
+
/** Unix timestamp in seconds. */
|
|
7
|
+
time: number;
|
|
8
|
+
/** Numeric value at this point in time. */
|
|
9
|
+
value: number;
|
|
10
|
+
}
|
|
11
|
+
/** Direction of recent price movement, used for dot/badge coloring and degen effects. */
|
|
12
|
+
export type Momentum = "up" | "down" | "flat";
|
|
13
|
+
/** Fine-tune auto-detected momentum sensitivity. */
|
|
14
|
+
export interface MomentumConfig {
|
|
15
|
+
/** Fraction of the lookback range the tail delta must exceed to register as directional. Default `0.12`. */
|
|
16
|
+
threshold?: number;
|
|
17
|
+
/** Number of recent data points used for range calculation. Default `20`. */
|
|
18
|
+
lookback?: number;
|
|
19
|
+
}
|
|
20
|
+
/** Font weight values matching React Native's supported set. */
|
|
21
|
+
export type FontWeight = "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900";
|
|
22
|
+
/** Color scheme for the chart background, grid, and derived palette colors. */
|
|
23
|
+
export type ThemeMode = "light" | "dark";
|
|
24
|
+
/**
|
|
25
|
+
* Badge pill style.
|
|
26
|
+
* - `"default"` — accent-colored background with white text.
|
|
27
|
+
* - `"minimal"` — white/grey background with subdued text.
|
|
28
|
+
*/
|
|
29
|
+
export type BadgeVariant = "default" | "minimal";
|
|
30
|
+
/**
|
|
31
|
+
* A reference line or band drawn into the chart. Three mutually-exclusive forms,
|
|
32
|
+
* with precedence A > B > C when fields from more than one are present:
|
|
33
|
+
* - **Form A** — horizontal line at `value`.
|
|
34
|
+
* - **Form B** — horizontal band between `valueFrom` and `valueTo`.
|
|
35
|
+
* - **Form C** — vertical time band between `from` and `to` (unix seconds).
|
|
36
|
+
*/
|
|
37
|
+
export interface ReferenceLine {
|
|
38
|
+
/** Form A — the Y-axis value where the horizontal line is drawn. */
|
|
39
|
+
value?: number;
|
|
40
|
+
/** Form B — horizontal band lower Y bound (paired with `valueTo`). */
|
|
41
|
+
valueFrom?: number;
|
|
42
|
+
/** Form B — horizontal band upper Y bound (paired with `valueFrom`). */
|
|
43
|
+
valueTo?: number;
|
|
44
|
+
/** Form C — vertical time-band start, unix seconds (paired with `to`). */
|
|
45
|
+
from?: number;
|
|
46
|
+
/** Form C — vertical time-band end, unix seconds (paired with `from`). */
|
|
47
|
+
to?: number;
|
|
48
|
+
/** Optional right-gutter label (e.g. `"Entry"`). */
|
|
49
|
+
label?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Stroke thickness in pixels. For a line it's the line width (default `1`).
|
|
52
|
+
* For a band, setting this also renders a dashed border along the band edges
|
|
53
|
+
* (top/bottom for value bands, left/right for time bands); omit for no border.
|
|
54
|
+
*/
|
|
55
|
+
strokeWidth?: number;
|
|
56
|
+
/** Dash pattern as `[dashLength, gapLength]` in pixels (line stroke + band border). */
|
|
57
|
+
intervals?: [number, number];
|
|
58
|
+
/** Line / band color override. Defaults to palette `refLine`. */
|
|
59
|
+
color?: string;
|
|
60
|
+
/** Fill opacity for a value / time band (0–1). Default `0.16`. */
|
|
61
|
+
fillOpacity?: number;
|
|
62
|
+
/** Label text color. Defaults to `color`, then palette `refLabel`. */
|
|
63
|
+
labelColor?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Horizontal label placement. For a Form-A line: `"left" | "center" | "right"`
|
|
66
|
+
* (default `"right"`, the legacy gutter position). For a band: `"left" | "right"`
|
|
67
|
+
* (default `"left"`).
|
|
68
|
+
*/
|
|
69
|
+
labelPosition?: "left" | "center" | "right";
|
|
70
|
+
/** Append the formatted `value` to the label (Form A only). Default `false`. */
|
|
71
|
+
showValue?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Exclude this line's value(s) from the Y-axis range computation, so it may sit
|
|
74
|
+
* off-axis instead of forcing the axis to expand. Per-line; other lines are
|
|
75
|
+
* unaffected. Default `false`.
|
|
76
|
+
*/
|
|
77
|
+
excludeFromRange?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* When a Form-A `value` falls outside the visible plot, render a pinned edge
|
|
80
|
+
* badge with a directional chevron instead of culling the off-screen line.
|
|
81
|
+
* Typically paired with `excludeFromRange`. Default `false`.
|
|
82
|
+
*/
|
|
83
|
+
offAxisBadge?: boolean;
|
|
84
|
+
/** Localized word shown in the off-axis badge (e.g. "Target"). Falls back to `label`. */
|
|
85
|
+
offAxisBadgeLabel?: string;
|
|
86
|
+
/** Off-axis badge pill background. Default: theme `tooltipBg`. */
|
|
87
|
+
badgeBackground?: string;
|
|
88
|
+
/** Off-axis badge pill border color. Default: the line `color`. */
|
|
89
|
+
badgeBorderColor?: string;
|
|
90
|
+
/** Off-axis badge pill corner radius in pixels. Default `5`. */
|
|
91
|
+
badgeRadius?: number;
|
|
92
|
+
}
|
|
93
|
+
/** Per-instance grid-line styling for the horizontal value-axis grid. */
|
|
94
|
+
export interface GridStyleConfig {
|
|
95
|
+
/** Stroke color. Defaults to palette `gridLine`. */
|
|
96
|
+
color?: string;
|
|
97
|
+
/** Stroke width in pixels. Default `1`. */
|
|
98
|
+
strokeWidth?: number;
|
|
99
|
+
/** Dash pattern as `[dash, gap, …]`. Default `[1, 3]` (dotted). Pass `[]` for solid. */
|
|
100
|
+
intervals?: number[];
|
|
101
|
+
/** Global alpha multiplier (0–1). Default `1`. */
|
|
102
|
+
opacity?: number;
|
|
103
|
+
}
|
|
104
|
+
/** Configuration for the horizontal dashed line at the current live value. */
|
|
105
|
+
export interface ValueLineConfig {
|
|
106
|
+
/** Line thickness in pixels. Default `1`. */
|
|
107
|
+
strokeWidth?: number;
|
|
108
|
+
/** Dash pattern as `[dashLength, gapLength]` in pixels. */
|
|
109
|
+
intervals?: [number, number];
|
|
110
|
+
/** Line color override. Defaults to palette `dashLine`. */
|
|
111
|
+
color?: string;
|
|
112
|
+
}
|
|
113
|
+
/** Main chart line styling. */
|
|
114
|
+
export interface LineConfig {
|
|
115
|
+
/** Stroke width of the main line in pixels. Default `2`. */
|
|
116
|
+
width?: number;
|
|
117
|
+
/** Line color override. Defaults to palette-derived accent. */
|
|
118
|
+
color?: string;
|
|
119
|
+
}
|
|
120
|
+
/** Area fill gradient beneath the chart line. */
|
|
121
|
+
export interface GradientConfig {
|
|
122
|
+
/** Opacity at the top of the gradient (near the line). Default `0.35`. */
|
|
123
|
+
topOpacity?: number;
|
|
124
|
+
/** Opacity at the bottom of the gradient. Default `0`. */
|
|
125
|
+
bottomOpacity?: number;
|
|
126
|
+
}
|
|
127
|
+
/** Value badge pill configuration. */
|
|
128
|
+
export interface BadgeConfig {
|
|
129
|
+
/** Visual style of the badge pill. Default `"default"`. */
|
|
130
|
+
variant?: BadgeVariant;
|
|
131
|
+
/** Show the pointed tail toward the live dot. Default `true`. */
|
|
132
|
+
tail?: boolean;
|
|
133
|
+
/** Badge background color override. */
|
|
134
|
+
background?: string;
|
|
135
|
+
/** Which side of the chart the badge appears on. Default `"right"`. */
|
|
136
|
+
position?: "right" | "left";
|
|
137
|
+
}
|
|
138
|
+
/** Y-axis grid configuration. */
|
|
139
|
+
export interface YAxisConfig {
|
|
140
|
+
/** Minimum pixel gap between grid lines. Default `36`. */
|
|
141
|
+
minGap?: number;
|
|
142
|
+
}
|
|
143
|
+
/** X-axis (time) configuration. */
|
|
144
|
+
export interface XAxisConfig {
|
|
145
|
+
/** Minimum pixel gap between time labels. Default `60`. */
|
|
146
|
+
minGap?: number;
|
|
147
|
+
}
|
|
148
|
+
/** Crosshair scrub configuration. */
|
|
149
|
+
export interface ScrubConfig {
|
|
150
|
+
/** Show the value/time tooltip pill while scrubbing. Default `true`. */
|
|
151
|
+
tooltip?: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Opacity of the chart content to the *right* of the crosshair (the "future")
|
|
154
|
+
* while scrubbing — `0` fully fades it out, `1` disables the dim. Implemented
|
|
155
|
+
* by erasing the content's alpha (`dstOut`), so it reveals the real background
|
|
156
|
+
* and works on any background color. Default `0.3`. Ignored when
|
|
157
|
+
* `crosshairDimColor` is set (that uses the legacy colored mask instead).
|
|
158
|
+
*/
|
|
159
|
+
dimOpacity?: number;
|
|
160
|
+
/** Vertical crosshair line stroke. Omit to use theme `crosshairLine`. */
|
|
161
|
+
crosshairLineColor?: string;
|
|
162
|
+
/**
|
|
163
|
+
* Legacy: fill the region right of the crosshair with this solid (usually
|
|
164
|
+
* semi-transparent) color — a mask painted *over* the chart, so it only looks
|
|
165
|
+
* right when it matches the background. Prefer `dimOpacity`. When set, it
|
|
166
|
+
* overrides the `dimOpacity` fade.
|
|
167
|
+
*/
|
|
168
|
+
crosshairDimColor?: string;
|
|
169
|
+
/** Tooltip pill background. Omit to use theme `tooltipBg`. */
|
|
170
|
+
tooltipBackground?: string;
|
|
171
|
+
/** Tooltip text color. Omit to use theme `tooltipText`. */
|
|
172
|
+
tooltipColor?: string;
|
|
173
|
+
/** Tooltip pill border color. Omit to use theme `tooltipBorder`. */
|
|
174
|
+
tooltipBorderColor?: string;
|
|
175
|
+
}
|
|
176
|
+
/** Left-edge fade — soft erase so the chart blends into the left gutter (web liveline parity). */
|
|
177
|
+
export interface LeftEdgeFadeConfig {
|
|
178
|
+
/**
|
|
179
|
+
* Horizontal fade band in pixels; gradient runs from the chart inner edge (`padding.left`)
|
|
180
|
+
* across this width. Default `40` (same as liveline).
|
|
181
|
+
*/
|
|
182
|
+
width?: number;
|
|
183
|
+
/**
|
|
184
|
+
* Gradient color at the left (canvas edge side). With default `dstOut` blending, **alpha**
|
|
185
|
+
* controls how strongly content is erased (opaque = full fade). When omitted, defaults match
|
|
186
|
+
* the chart background RGB (`palette.bgRgb`) at alpha 1.
|
|
187
|
+
*/
|
|
188
|
+
startColor?: string;
|
|
189
|
+
/**
|
|
190
|
+
* Gradient color at the right (chart side). When omitted, defaults to the same RGB as the
|
|
191
|
+
* chart background at alpha 0 (no erase).
|
|
192
|
+
*/
|
|
193
|
+
endColor?: string;
|
|
194
|
+
}
|
|
195
|
+
/** Pulsing ring animation on the live dot. */
|
|
196
|
+
export interface PulseConfig {
|
|
197
|
+
/** Time between pulse starts in milliseconds. Default `2400`. */
|
|
198
|
+
interval?: number;
|
|
199
|
+
/** Duration of each pulse expansion in milliseconds. Default `1600`. */
|
|
200
|
+
duration?: number;
|
|
201
|
+
/** Maximum radius the pulse ring expands to in pixels. Default `20`. */
|
|
202
|
+
maxRadius?: number;
|
|
203
|
+
/** Peak opacity of the pulse ring (0–1). Default `0.4`. */
|
|
204
|
+
opacity?: number;
|
|
205
|
+
/** Stroke width of the pulse ring in pixels. Default `1.5`. */
|
|
206
|
+
strokeWidth?: number;
|
|
207
|
+
}
|
|
208
|
+
/** Font configuration for chart labels, badges, and axis text. */
|
|
209
|
+
export interface FontConfig {
|
|
210
|
+
/** Font family name. Default `"Menlo"`. */
|
|
211
|
+
fontFamily?: string;
|
|
212
|
+
/** Base font size in pixels. Default `11`. */
|
|
213
|
+
fontSize?: number;
|
|
214
|
+
/** Font weight. Default `"normal"`. */
|
|
215
|
+
fontWeight?: FontWeight;
|
|
216
|
+
/**
|
|
217
|
+
* Load this typeface from a Metro asset or URI (`require("./Font.ttf")`, path string, or
|
|
218
|
+
* `Uint8Array`). When set, Skia uses `useFont` for that file; `fontWeight` does not alter the
|
|
219
|
+
* outlines (use a bold file or `fontManager` for multiple weights). While the asset loads,
|
|
220
|
+
* the chart falls back to `matchFont` with `fontFamily` / defaults. Prefer either this or
|
|
221
|
+
* `fontManager`, not both, unless you intentionally want a registered family as fallback.
|
|
222
|
+
*/
|
|
223
|
+
typeface?: DataSourceParam;
|
|
224
|
+
/**
|
|
225
|
+
* Custom Skia font manager from `useFonts` (e.g. bundled `.ttf` files registered under family
|
|
226
|
+
* names). Passed as the second argument to `matchFont`. When `null` or omitted, the system
|
|
227
|
+
* font manager is used.
|
|
228
|
+
*/
|
|
229
|
+
fontManager?: SkFontMgr | null;
|
|
230
|
+
}
|
|
231
|
+
/** Padding insets for the chart drawing area. */
|
|
232
|
+
export interface ChartInsets {
|
|
233
|
+
/** Top padding in pixels. Default `12`. */
|
|
234
|
+
top?: number;
|
|
235
|
+
/** Right padding in pixels. Auto-calculated based on badge/grid presence. */
|
|
236
|
+
right?: number;
|
|
237
|
+
/** Bottom padding in pixels. Default `28`. */
|
|
238
|
+
bottom?: number;
|
|
239
|
+
/** Left padding in pixels. Default `12`. */
|
|
240
|
+
left?: number;
|
|
241
|
+
}
|
|
242
|
+
/** A single trade fill event for on-chart markers. */
|
|
243
|
+
export interface TradeEvent {
|
|
244
|
+
/** Trade direction. */
|
|
245
|
+
side: "buy" | "sell";
|
|
246
|
+
/** Execution price. */
|
|
247
|
+
price: number;
|
|
248
|
+
/** Trade size / quantity. */
|
|
249
|
+
size: number;
|
|
250
|
+
/** Unix timestamp in seconds. */
|
|
251
|
+
time: number;
|
|
252
|
+
/** Optional ticker symbol for simulated / custom feeds. */
|
|
253
|
+
symbol?: string;
|
|
254
|
+
}
|
|
255
|
+
/** Built-in marker glyph kinds drawn into the chart canvas. */
|
|
256
|
+
export type MarkerKind = "trade" | "boost" | "graduation" | "winner" | "clawback";
|
|
257
|
+
/**
|
|
258
|
+
* A marker rendered into the chart at `(time, y)`. Exactly one of `seriesId`
|
|
259
|
+
* (anchor y to a series line at the marker's time, multi-series only) or
|
|
260
|
+
* `value` (absolute y in data space) should be provided.
|
|
261
|
+
*/
|
|
262
|
+
export interface Marker {
|
|
263
|
+
/** Stable identifier. */
|
|
264
|
+
id: string;
|
|
265
|
+
/** Unix timestamp in seconds. */
|
|
266
|
+
time: number;
|
|
267
|
+
/** Glyph kind. */
|
|
268
|
+
kind: MarkerKind;
|
|
269
|
+
/** Anchor y to this series' line at `time` (multi-series). */
|
|
270
|
+
seriesId?: string;
|
|
271
|
+
/**
|
|
272
|
+
* Absolute y value in data space. Takes precedence over `seriesId`. Omit it on
|
|
273
|
+
* a single-series chart to anchor the marker to the line at `time`
|
|
274
|
+
* (interpolated from the chart's `data`) — so the glyph always sits on the line.
|
|
275
|
+
*/
|
|
276
|
+
value?: number;
|
|
277
|
+
/** Glyph color override. Defaults to a kind-specific palette accent. */
|
|
278
|
+
color?: string;
|
|
279
|
+
/**
|
|
280
|
+
* Text / emoji glyph drawn centered at the marker, overriding the built-in
|
|
281
|
+
* `kind` shape. Rendered with the chart font, so pass an emoji-capable font
|
|
282
|
+
* (via `font`) if you use emoji.
|
|
283
|
+
*/
|
|
284
|
+
icon?: string;
|
|
285
|
+
/**
|
|
286
|
+
* Image icon drawn centered at the marker (e.g. from Skia `useImage`). Takes
|
|
287
|
+
* precedence over `icon` and the built-in `kind` shape.
|
|
288
|
+
*/
|
|
289
|
+
image?: SkImage;
|
|
290
|
+
/**
|
|
291
|
+
* Draw the `icon` inside a filled circular badge in the marker `color` (icon
|
|
292
|
+
* rendered in white) — e.g. a green `+` buy / red `−` sell tag. Requires
|
|
293
|
+
* `icon`; ignored without it. The badge sizes itself to the icon glyph.
|
|
294
|
+
*/
|
|
295
|
+
pill?: boolean;
|
|
296
|
+
/** Icon / image box size in px (icon font size or image width+height). Default `16`. */
|
|
297
|
+
size?: number;
|
|
298
|
+
/** Pass-through payload surfaced on `onMarkerHover`. */
|
|
299
|
+
data?: unknown;
|
|
300
|
+
}
|
|
301
|
+
/** Payload for `onMarkerHover` — the marker and its screen position. */
|
|
302
|
+
export interface MarkerHoverEvent {
|
|
303
|
+
marker: Marker;
|
|
304
|
+
point: {
|
|
305
|
+
x: number;
|
|
306
|
+
y: number;
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
/** Particle burst + screen shake on momentum swings ("degen mode"). */
|
|
310
|
+
export interface DegenOptions {
|
|
311
|
+
/** Scale multiplier for particle size and speed. Default `1`. */
|
|
312
|
+
scale?: number;
|
|
313
|
+
/** Also trigger on downward momentum (not just upward). Default `false`. */
|
|
314
|
+
downMomentum?: boolean;
|
|
315
|
+
/** When `false`, particle bursts still run but the chart does not shake. Default `true`. */
|
|
316
|
+
shake?: boolean;
|
|
317
|
+
/** Multiplier on default shake amplitude (`1` matches built-in behavior). */
|
|
318
|
+
shakeIntensity?: number;
|
|
319
|
+
/** How long the shake envelope runs, in seconds. Default `0.45`. */
|
|
320
|
+
shakeDurationSec?: number;
|
|
321
|
+
/** Ring-buffer slots (clamped 4–80). Default `60`. */
|
|
322
|
+
particleSlotCount?: number;
|
|
323
|
+
/** How long each particle stays visible, in seconds. Default `1.0`. */
|
|
324
|
+
particleBurstDurationSec?: number;
|
|
325
|
+
/** Particles spawned per momentum burst (clamped 1–`particleSlotCount`). Default `20`. */
|
|
326
|
+
burstParticleCount?: number;
|
|
327
|
+
/** Velocity drag per frame (0–1, higher = less drag). Default `0.95`. */
|
|
328
|
+
drag?: number;
|
|
329
|
+
/** Minimum particle radius in pixels. Default `1`. */
|
|
330
|
+
particleSizeMin?: number;
|
|
331
|
+
/** Maximum particle radius in pixels. Default `2.2`. */
|
|
332
|
+
particleSizeMax?: number;
|
|
333
|
+
/** Peak particle opacity (0–1). Default `0.55`. */
|
|
334
|
+
particleOpacity?: number;
|
|
335
|
+
/** Angular spread in radians for the burst semicircle. Default `π * 1.2`. */
|
|
336
|
+
spreadAngle?: number;
|
|
337
|
+
/** Horizontal position jitter in pixels (±half). Default `24`. */
|
|
338
|
+
positionJitterX?: number;
|
|
339
|
+
/** Vertical position jitter in pixels (±half). Default `8`. */
|
|
340
|
+
positionJitterY?: number;
|
|
341
|
+
/** Minimum initial speed in px/s. Default `60`. */
|
|
342
|
+
speedMin?: number;
|
|
343
|
+
/** Maximum initial speed in px/s. Default `160`. */
|
|
344
|
+
speedMax?: number;
|
|
345
|
+
/**
|
|
346
|
+
* Particle color(s). A single string or an array of colors.
|
|
347
|
+
* When an array is provided, each particle picks one at random.
|
|
348
|
+
* Default: chart accent / `palette.line`.
|
|
349
|
+
*/
|
|
350
|
+
colors?: string | string[];
|
|
351
|
+
}
|
|
352
|
+
/** Payload for {@link LiveChartProps.onDegenShake}. */
|
|
353
|
+
export interface DegenShakePayload {
|
|
354
|
+
direction: "up" | "down";
|
|
355
|
+
}
|
|
356
|
+
/** Live dot configuration for multi-series charts. */
|
|
357
|
+
export interface MultiSeriesDotConfig {
|
|
358
|
+
/** Dot radius in pixels. Default `3.5`. */
|
|
359
|
+
radius?: number;
|
|
360
|
+
/** Pulsing ring animation on each series dot. `true` = defaults, or pass `PulseConfig`. Default `true`. */
|
|
361
|
+
pulse?: boolean | PulseConfig;
|
|
362
|
+
/** Horizontal dashed line at each series' live value. `true` = defaults, or pass `ValueLineConfig`. Default `false`. */
|
|
363
|
+
valueLine?: boolean | ValueLineConfig;
|
|
364
|
+
/** Show series label (e.g. "Yes", "No") to the right of each dot. Default `true`. */
|
|
365
|
+
valueLabel?: boolean;
|
|
366
|
+
}
|
|
367
|
+
/** Visual style overrides for the legend (toggle chips). All fields optional. */
|
|
368
|
+
export interface LegendStyle {
|
|
369
|
+
/** Font size for chip labels (px). Default `13` (`11` when compact). */
|
|
370
|
+
fontSize?: number;
|
|
371
|
+
/** Chip corner radius (px). Default `8`. */
|
|
372
|
+
borderRadius?: number;
|
|
373
|
+
/** Colored swatch diameter (px). Default `8`. */
|
|
374
|
+
dotSize?: number;
|
|
375
|
+
/** Chip background when the series is visible. */
|
|
376
|
+
activeBackground?: string;
|
|
377
|
+
/** Chip background when the series is hidden. */
|
|
378
|
+
hiddenBackground?: string;
|
|
379
|
+
/** Label color when the series is visible. */
|
|
380
|
+
activeColor?: string;
|
|
381
|
+
/** Label color when the series is hidden. */
|
|
382
|
+
hiddenColor?: string;
|
|
383
|
+
}
|
|
384
|
+
/** Legend (toggle chips) configuration for multi-series charts. */
|
|
385
|
+
export interface LegendConfig {
|
|
386
|
+
/** Show the legend. Default `true`. */
|
|
387
|
+
visible?: boolean;
|
|
388
|
+
/** Use a smaller, denser chip layout (tighter padding + font). Default `false`. */
|
|
389
|
+
compact?: boolean;
|
|
390
|
+
/** Position of the legend relative to the chart. Default `"top"`. */
|
|
391
|
+
position?: "top" | "bottom";
|
|
392
|
+
/** Visual style overrides for the chip row. */
|
|
393
|
+
style?: LegendStyle;
|
|
394
|
+
}
|
|
395
|
+
/** Configuration for a single series in a multi-series chart. */
|
|
396
|
+
export interface SeriesConfig {
|
|
397
|
+
/** Unique identifier for this series. */
|
|
398
|
+
id: string;
|
|
399
|
+
/** Array of data points for this series. */
|
|
400
|
+
data: LiveChartPoint[];
|
|
401
|
+
/** Latest (live) value for smooth interpolation. */
|
|
402
|
+
value: number;
|
|
403
|
+
/** Line color. Defaults to the built-in series color palette. */
|
|
404
|
+
color?: string;
|
|
405
|
+
/** Display label shown in toggle chips. */
|
|
406
|
+
label?: string;
|
|
407
|
+
/** Whether this series is visible. Default `true`. */
|
|
408
|
+
visible?: boolean;
|
|
409
|
+
/** Stroke style. `"dashed"` applies `intervals`. Default `"solid"`. */
|
|
410
|
+
style?: "solid" | "dashed";
|
|
411
|
+
/** Dash pattern as `[dashLength, gapLength]` when `style` is `"dashed"`. Default `[6, 4]`. */
|
|
412
|
+
intervals?: [number, number];
|
|
413
|
+
/** Per-series stroke width override (px). Falls back to the chart line width. */
|
|
414
|
+
strokeWidth?: number;
|
|
415
|
+
/** Render a soft glow behind this series' line. Default `false`. */
|
|
416
|
+
glow?: boolean;
|
|
417
|
+
/**
|
|
418
|
+
* Semantic role. `"derived"` series (e.g. a conviction trajectory) render a
|
|
419
|
+
* subdued / dashed legend chip. Default `"outcome"`.
|
|
420
|
+
*/
|
|
421
|
+
kind?: "outcome" | "derived";
|
|
422
|
+
/** Value text shown next to the label inside the legend chip. */
|
|
423
|
+
valueLabel?: string;
|
|
424
|
+
}
|
|
425
|
+
/** Per-series value at a scrub position, used in the multi-series `onScrub` callback. */
|
|
426
|
+
export interface ScrubSeriesValue {
|
|
427
|
+
/** Series identifier matching `SeriesConfig.id`. */
|
|
428
|
+
id: string;
|
|
429
|
+
/** Series label, if provided. */
|
|
430
|
+
label?: string;
|
|
431
|
+
/** Interpolated value at the scrub time for this series. */
|
|
432
|
+
value: number;
|
|
433
|
+
}
|
|
434
|
+
/** Base fields shared by single and multi-series scrub callback payloads. */
|
|
435
|
+
export interface ScrubPointCore {
|
|
436
|
+
/** Unix timestamp in seconds at the scrub position. */
|
|
437
|
+
time: number;
|
|
438
|
+
/** Interpolated value at the scrub position. */
|
|
439
|
+
value: number;
|
|
440
|
+
/** Canvas X coordinate of the crosshair. */
|
|
441
|
+
x: number;
|
|
442
|
+
/** Canvas Y coordinate of the interpolated value. */
|
|
443
|
+
y: number;
|
|
444
|
+
}
|
|
445
|
+
/** Scrub callback payload for single-series charts. */
|
|
446
|
+
export interface ScrubPoint extends ScrubPointCore {
|
|
447
|
+
/** In candle mode, the OHLC data of the candle under the crosshair. */
|
|
448
|
+
candle?: CandlePoint;
|
|
449
|
+
}
|
|
450
|
+
/** Scrub callback payload for multi-series charts. */
|
|
451
|
+
export interface ScrubPointMulti extends ScrubPointCore {
|
|
452
|
+
/** Interpolated values for each visible series at the scrub time. */
|
|
453
|
+
seriesValues: ScrubSeriesValue[];
|
|
454
|
+
}
|
|
455
|
+
/** OHLC candlestick data for a single time bucket. */
|
|
456
|
+
export interface CandlePoint {
|
|
457
|
+
/** Bucket start time as Unix timestamp in seconds. */
|
|
458
|
+
time: number;
|
|
459
|
+
/** Opening price. */
|
|
460
|
+
open: number;
|
|
461
|
+
/** Highest price during the bucket. */
|
|
462
|
+
high: number;
|
|
463
|
+
/** Lowest price during the bucket. */
|
|
464
|
+
low: number;
|
|
465
|
+
/** Closing price. */
|
|
466
|
+
close: number;
|
|
467
|
+
}
|
|
468
|
+
/** Props shared between `LiveChart` and `LiveChartSeries`. */
|
|
469
|
+
export interface LiveChartCoreProps {
|
|
470
|
+
/** Color scheme. Default `"dark"`. */
|
|
471
|
+
theme?: ThemeMode;
|
|
472
|
+
/** Primary accent color — the full palette is derived from this. Default `"#3323E6"`. */
|
|
473
|
+
accentColor?: string;
|
|
474
|
+
/** Font configuration for all chart text (axes, badges, tooltips). */
|
|
475
|
+
font?: FontConfig;
|
|
476
|
+
/** Padding overrides for the chart drawing area. */
|
|
477
|
+
insets?: ChartInsets;
|
|
478
|
+
/** Container View style. */
|
|
479
|
+
style?: ViewStyle;
|
|
480
|
+
/** Visible time window in seconds. Default `30`. */
|
|
481
|
+
timeWindow?: number;
|
|
482
|
+
/** Freeze chart scrolling. Resume catches up to real time. Default `false`. */
|
|
483
|
+
paused?: boolean;
|
|
484
|
+
/**
|
|
485
|
+
* Breathing-line loading shell. When this becomes `false`, the chart reveals
|
|
486
|
+
* only if there is data (≥2 line points or ≥2 committed candles).
|
|
487
|
+
*/
|
|
488
|
+
loading?: boolean;
|
|
489
|
+
/**
|
|
490
|
+
* Value-lerp speed — how quickly the drawn value, time window, and Y-range chase
|
|
491
|
+
* their targets each frame (0 = frozen, 1 = instant). Equivalent to liveline's
|
|
492
|
+
* `lerpSpeed`. Default `0.08`.
|
|
493
|
+
*/
|
|
494
|
+
smoothing?: number;
|
|
495
|
+
/** Tight Y-axis — small value moves fill the full chart height. Default `false`. */
|
|
496
|
+
exaggerate?: boolean;
|
|
497
|
+
/**
|
|
498
|
+
* Clamp the Y-axis lower bound at 0 (prices, market caps, volumes) so the axis
|
|
499
|
+
* never shows negative ticks when data collapses toward zero. Default `false`.
|
|
500
|
+
*/
|
|
501
|
+
nonNegative?: boolean;
|
|
502
|
+
/**
|
|
503
|
+
* Hard upper bound for the Y-axis range. Use for axes with a ceiling (e.g. market
|
|
504
|
+
* share ≤ `1`); the margin added above the data is capped here. Omit for unbounded
|
|
505
|
+
* axes (prices, market caps).
|
|
506
|
+
*/
|
|
507
|
+
maxValue?: number;
|
|
508
|
+
/**
|
|
509
|
+
* Label in the empty state when `loading` is false and there are fewer than
|
|
510
|
+
* two samples (line points or committed candles). Default `"No data"`.
|
|
511
|
+
*/
|
|
512
|
+
emptyText?: string;
|
|
513
|
+
/** Custom formatter for value labels (axes, badge, tooltips). Default `v => v.toFixed(2)`. */
|
|
514
|
+
formatValue?: (v: number) => string;
|
|
515
|
+
/** Custom formatter for time labels. Default renders `HH:MM:SS`. */
|
|
516
|
+
formatTime?: (t: number) => string;
|
|
517
|
+
/** Y-axis grid lines + labels. `true` = defaults, `false` = hidden, or pass `YAxisConfig`. Default `true`. */
|
|
518
|
+
yAxis?: boolean | YAxisConfig;
|
|
519
|
+
/** X-axis time labels. `true` = defaults, `false` = hidden, or pass `XAxisConfig`. Default `true`. */
|
|
520
|
+
xAxis?: boolean | XAxisConfig;
|
|
521
|
+
/** Reference lines / bands drawn into the chart. Supports all three `ReferenceLine` forms. */
|
|
522
|
+
referenceLines?: ReferenceLine[];
|
|
523
|
+
/** Per-instance grid-line styling. Pass an object to override color / width / dash / opacity. */
|
|
524
|
+
gridStyle?: GridStyleConfig;
|
|
525
|
+
/**
|
|
526
|
+
* Markers drawn into the chart canvas. Read on the UI thread — pass a
|
|
527
|
+
* `SharedValue` and update via `.value` (same pattern as `data`).
|
|
528
|
+
*/
|
|
529
|
+
markers?: SharedValue<Marker[]>;
|
|
530
|
+
/** Fires when a marker is tapped; `null` when a tap misses every marker. */
|
|
531
|
+
onMarkerHover?: (event: MarkerHoverEvent | null) => void;
|
|
532
|
+
/** Tap hit-test radius in px. Default `16` (≈ 44px touch target with the glyph). */
|
|
533
|
+
markerHitRadius?: number;
|
|
534
|
+
/**
|
|
535
|
+
* Override individual resolved-palette keys on top of the palette derived from
|
|
536
|
+
* `accentColor` + `theme`. Only the keys you set are replaced.
|
|
537
|
+
*/
|
|
538
|
+
palette?: Partial<LiveChartPalette>;
|
|
539
|
+
/**
|
|
540
|
+
* Right-edge buffer as a fraction of `timeWindow`. Pushes the live edge past the
|
|
541
|
+
* current time so the latest point has breathing room; pass `0` to land the latest
|
|
542
|
+
* point exactly at the right edge. Default `0`.
|
|
543
|
+
*/
|
|
544
|
+
windowBuffer?: number;
|
|
545
|
+
/**
|
|
546
|
+
* Override the engine's "now" (unix seconds). Pass the latest data timestamp to
|
|
547
|
+
* treat the most recent point as the current time — combine with `windowBuffer={0}`
|
|
548
|
+
* and `timeWindow = maxT - minT` to fill the canvas edge-to-edge with historical data.
|
|
549
|
+
*/
|
|
550
|
+
nowOverride?: number;
|
|
551
|
+
/** Accessibility label for the chart container. */
|
|
552
|
+
accessibilityLabel?: string;
|
|
553
|
+
/** Accessibility role for the chart container. Default `"image"`. */
|
|
554
|
+
accessibilityRole?: "image" | "none" | "adjustable" | "summary";
|
|
555
|
+
/** Crosshair scrubbing on hover/drag. `true` = defaults, `false` = disabled, or pass `ScrubConfig`. Default `true`. */
|
|
556
|
+
scrub?: boolean | ScrubConfig;
|
|
557
|
+
/**
|
|
558
|
+
* Fade out chart content on the left (destination-out style). `true` = defaults, `false` = off,
|
|
559
|
+
* or pass `LeftEdgeFadeConfig`. Default `true`.
|
|
560
|
+
*/
|
|
561
|
+
leftEdgeFade?: boolean | LeftEdgeFadeConfig;
|
|
562
|
+
/** Main chart line styling. */
|
|
563
|
+
line?: LineConfig;
|
|
564
|
+
}
|
|
565
|
+
/** Props for the single-series `LiveChart` component. */
|
|
566
|
+
export interface LiveChartProps extends LiveChartCoreProps {
|
|
567
|
+
/** Area gradient fill under the line. `true` = defaults, or pass `GradientConfig`. Default `true`. */
|
|
568
|
+
gradient?: boolean | GradientConfig;
|
|
569
|
+
/** Value badge pill at the chart tip. `true` = defaults, or pass `BadgeConfig`. Default `true`. */
|
|
570
|
+
badge?: boolean | BadgeConfig;
|
|
571
|
+
/**
|
|
572
|
+
* Momentum-based dot/badge coloring.
|
|
573
|
+
* - `true` — auto-detect from data (default).
|
|
574
|
+
* - `false` — disabled, always flat.
|
|
575
|
+
* - `"up"` / `"down"` / `"flat"` — forced value.
|
|
576
|
+
* - `MomentumConfig` — auto-detect with custom sensitivity.
|
|
577
|
+
*/
|
|
578
|
+
momentum?: boolean | Momentum | MomentumConfig;
|
|
579
|
+
/** Pulsing ring animation on the live dot. `true` = defaults, or pass `PulseConfig`. Default `true`. */
|
|
580
|
+
pulse?: boolean | PulseConfig;
|
|
581
|
+
/** Horizontal dashed line at the current live value. `true` = defaults, or pass `ValueLineConfig`. */
|
|
582
|
+
valueLine?: boolean | ValueLineConfig;
|
|
583
|
+
/** Render the live value as a large text overlay in the top-left. Default `false`. */
|
|
584
|
+
showValue?: boolean;
|
|
585
|
+
/** Tint the `showValue` text by momentum (green up / red down). Default `false`. */
|
|
586
|
+
valueMomentumColor?: boolean;
|
|
587
|
+
/** Chart display mode (default `"line"`). `"candle"` renders OHLC bars. */
|
|
588
|
+
mode?: "line" | "candle";
|
|
589
|
+
/** Committed OHLC bars, sorted by `time`. Must be a SharedValue for UI-thread reads. */
|
|
590
|
+
candles?: SharedValue<CandlePoint[]>;
|
|
591
|
+
/** Seconds per candle bucket (e.g. 60 for 1-minute bars). */
|
|
592
|
+
candleWidth?: number;
|
|
593
|
+
/** In-progress candle updated each tick. Must be a SharedValue for UI-thread reads. */
|
|
594
|
+
liveCandle?: SharedValue<CandlePoint | null>;
|
|
595
|
+
/**
|
|
596
|
+
* Live trade fills for optional on-chart markers. Read on the UI thread only —
|
|
597
|
+
* pass a `SharedValue` and update from JS via `.value` (same pattern as `data` / `value`).
|
|
598
|
+
*/
|
|
599
|
+
tradeStream?: SharedValue<TradeEvent[]>;
|
|
600
|
+
/** Particle burst + chart shake on momentum swings (`true` = defaults, or pass `DegenOptions`). */
|
|
601
|
+
degen?: boolean | DegenOptions;
|
|
602
|
+
/** Growing array of data points. Must be a SharedValue for UI-thread reads. */
|
|
603
|
+
data: SharedValue<LiveChartPoint[]>;
|
|
604
|
+
/** Latest live value for smooth interpolation between data updates. */
|
|
605
|
+
value: SharedValue<number>;
|
|
606
|
+
/** Called when the user scrubs the crosshair. `null` when scrub ends. */
|
|
607
|
+
onScrub?: (point: ScrubPoint | null) => void;
|
|
608
|
+
/**
|
|
609
|
+
* Called on the JS thread when degen chart shake starts (momentum swing with shake enabled).
|
|
610
|
+
* Not called when `degen` is off or `DegenOptions.shake` is `false`.
|
|
611
|
+
*/
|
|
612
|
+
onDegenShake?: (payload: DegenShakePayload) => void;
|
|
613
|
+
}
|
|
614
|
+
/** Props for the multi-series `LiveChartSeries` component. */
|
|
615
|
+
export interface LiveChartSeriesProps extends LiveChartCoreProps {
|
|
616
|
+
/** Array of series definitions. Must be a SharedValue for UI-thread reads. */
|
|
617
|
+
series: SharedValue<SeriesConfig[]>;
|
|
618
|
+
/** Called when a series toggle chip is tapped. */
|
|
619
|
+
onSeriesToggle?: (id: string, visible: boolean) => void;
|
|
620
|
+
/** Live dot configuration (radius, pulse, value line, inline labels). */
|
|
621
|
+
dot?: MultiSeriesDotConfig;
|
|
622
|
+
/** Legend (toggle chips) configuration. `true` = defaults, `false` = hidden, or pass `LegendConfig`. Default `true`. */
|
|
623
|
+
legend?: boolean | LegendConfig;
|
|
624
|
+
/**
|
|
625
|
+
* Degen mode — chart shake + a spark burst off the leading series' dot on an
|
|
626
|
+
* upward momentum swing. `true` = defaults, or pass `DegenOptions`. Default off.
|
|
627
|
+
*/
|
|
628
|
+
degen?: boolean | DegenOptions;
|
|
629
|
+
/** Called on the JS thread when a degen chart shake starts. */
|
|
630
|
+
onDegenShake?: (payload: DegenShakePayload) => void;
|
|
631
|
+
/**
|
|
632
|
+
* Worklet callback fired on the UI thread each frame while scrubbing.
|
|
633
|
+
* `null` when scrub ends. Update shared values directly — no bridge overhead.
|
|
634
|
+
*
|
|
635
|
+
* ```ts
|
|
636
|
+
* const scrubData = useSharedValue<ScrubPointMulti | null>(null);
|
|
637
|
+
* <LiveChartSeries
|
|
638
|
+
* scrub
|
|
639
|
+
* onScrub={(point) => {
|
|
640
|
+
* "worklet";
|
|
641
|
+
* scrubData.value = point;
|
|
642
|
+
* }}
|
|
643
|
+
* />
|
|
644
|
+
* ```
|
|
645
|
+
*/
|
|
646
|
+
onScrub?: (point: ScrubPointMulti | null) => void;
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Full resolved color palette derived from `accentColor` + `theme`.
|
|
650
|
+
* Exposed for advanced theming — most users do not need this directly.
|
|
651
|
+
*/
|
|
652
|
+
export interface LiveChartPalette {
|
|
653
|
+
/** Main chart line color. */
|
|
654
|
+
line: string;
|
|
655
|
+
/** Chart line stroke width. */
|
|
656
|
+
lineWidth: number;
|
|
657
|
+
/** Gradient fill top color (with opacity). */
|
|
658
|
+
fillTop: string;
|
|
659
|
+
/** Gradient fill bottom color (with opacity). */
|
|
660
|
+
fillBottom: string;
|
|
661
|
+
/** Grid line color. */
|
|
662
|
+
gridLine: string;
|
|
663
|
+
/** Grid / axis label color. */
|
|
664
|
+
gridLabel: string;
|
|
665
|
+
/** Live dot color when momentum is up. */
|
|
666
|
+
dotUp: string;
|
|
667
|
+
/** Live dot color when momentum is down. */
|
|
668
|
+
dotDown: string;
|
|
669
|
+
/** Live dot color when momentum is flat. */
|
|
670
|
+
dotFlat: string;
|
|
671
|
+
/** Dot glow color when momentum is up. */
|
|
672
|
+
glowUp: string;
|
|
673
|
+
/** Dot glow color when momentum is down. */
|
|
674
|
+
glowDown: string;
|
|
675
|
+
/** Dot glow color when momentum is flat. */
|
|
676
|
+
glowFlat: string;
|
|
677
|
+
/** Badge outer background (ring behind the pill). */
|
|
678
|
+
badgeOuterBg: string;
|
|
679
|
+
/** Badge outer shadow color. */
|
|
680
|
+
badgeOuterShadow: string;
|
|
681
|
+
/** Badge pill background color. */
|
|
682
|
+
badgeBg: string;
|
|
683
|
+
/** Badge text color. */
|
|
684
|
+
badgeText: string;
|
|
685
|
+
/** Bullish candle body color. */
|
|
686
|
+
candleUp: string;
|
|
687
|
+
/** Bearish candle body color. */
|
|
688
|
+
candleDown: string;
|
|
689
|
+
/** Bullish wick color. */
|
|
690
|
+
wickUp: string;
|
|
691
|
+
/** Bearish wick color. */
|
|
692
|
+
wickDown: string;
|
|
693
|
+
/** Value line (dashed) color. */
|
|
694
|
+
dashLine: string;
|
|
695
|
+
/** Reference line color. */
|
|
696
|
+
refLine: string;
|
|
697
|
+
/** Reference line label color. */
|
|
698
|
+
refLabel: string;
|
|
699
|
+
/** X-axis time label color. */
|
|
700
|
+
timeLabel: string;
|
|
701
|
+
/** Crosshair vertical line color. */
|
|
702
|
+
crosshairLine: string;
|
|
703
|
+
/** Dimmed overlay to the right of the crosshair while scrubbing. */
|
|
704
|
+
crosshairDim: string;
|
|
705
|
+
/** Tooltip pill background color. */
|
|
706
|
+
tooltipBg: string;
|
|
707
|
+
/** Tooltip text color. */
|
|
708
|
+
tooltipText: string;
|
|
709
|
+
/** Tooltip border/outline color. */
|
|
710
|
+
tooltipBorder: string;
|
|
711
|
+
/** Chart background as RGB triple (for color mixing). */
|
|
712
|
+
bgRgb: [number, number, number];
|
|
713
|
+
/** Font size for axis labels. */
|
|
714
|
+
labelFontSize: number;
|
|
715
|
+
/** Font size for the large value overlay. */
|
|
716
|
+
valueFontSize: number;
|
|
717
|
+
/** Font size for badge text. */
|
|
718
|
+
badgeFontSize: number;
|
|
719
|
+
}
|
|
720
|
+
//# sourceMappingURL=types.d.ts.map
|