react-native-vroom-chart 0.13.1 → 0.15.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/cpp/VroomChartHostObject.cpp +133 -8
- package/cpp/_core_include/vroom/vroom_chart.h +90 -7
- package/cpp/_core_src/candles.h +7 -5
- package/cpp/_core_src/chart.cpp +287 -152
- package/cpp/_core_src/chart.h +29 -3
- package/cpp/_core_src/chart_facade.cpp +113 -1
- package/cpp/_core_src/footprints.cpp +226 -0
- package/cpp/_core_src/footprints.h +45 -0
- package/cpp/_core_src/footprints_layout.cpp +140 -0
- package/cpp/_core_src/footprints_layout.h +94 -0
- package/cpp/_core_src/tip_pulse.h +4 -4
- package/cpp/_core_src/viewport.h +4 -0
- package/lib/index.d.mts +186 -6
- package/lib/index.d.ts +186 -6
- package/lib/index.js +89 -7
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +89 -7
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/VroomChart.tsx +89 -5
- package/src/index.ts +7 -0
- package/src/jsi.d.ts +45 -8
- package/src/types.ts +7 -0
- package/src/useChartCore.ts +56 -5
package/cpp/_core_src/viewport.h
CHANGED
|
@@ -104,6 +104,10 @@ inline std::size_t morph_from_count(const CandleSnapshot* from,
|
|
|
104
104
|
return (from && morph_t < 1.f) ? from_n : 0;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
// C facade `vroom_chart_begin_interval_morph` mode: 0 = slot-lerp transform,
|
|
108
|
+
// anything else = fade the outgoing snapshot out then the new scene in.
|
|
109
|
+
inline bool interval_morph_is_fade(int32_t mode) { return mode != 0; }
|
|
110
|
+
|
|
107
111
|
// Returns the indices of candles whose time_ms falls in [start_ms, end_ms].
|
|
108
112
|
// When both are 0, returns the full range (Phase 1 default-everything behavior).
|
|
109
113
|
// Candles must be sorted ascending by time_ms (invariant of the public API).
|
package/lib/index.d.mts
CHANGED
|
@@ -187,6 +187,13 @@ type ChartType = 'candles' | 'line';
|
|
|
187
187
|
* Defaults to `'ease-in-out'`.
|
|
188
188
|
*/
|
|
189
189
|
type TransitionEasing = 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out';
|
|
190
|
+
/**
|
|
191
|
+
* How a same-asset interval switch animates. `'transform'` (default) lerps
|
|
192
|
+
* each visible column into its counterpart. `'fade'` fades the old scene out
|
|
193
|
+
* then the new one in — use when the two windows don’t share a 1:1 pairing
|
|
194
|
+
* (e.g. a fixed lookback).
|
|
195
|
+
*/
|
|
196
|
+
type IntervalTransition = 'transform' | 'fade';
|
|
190
197
|
/** Active drawing tool while in `draw` mode. `null` draws nothing. */
|
|
191
198
|
type DrawTool = null | 'line' | 'box' | 'pencil' | 'path';
|
|
192
199
|
/** A drawing anchor in data space, so it stays glued to the candles on pan/zoom. */
|
|
@@ -200,9 +207,12 @@ type DrawPoint = {
|
|
|
200
207
|
type DrawingBase = {
|
|
201
208
|
/** Stable unique id (the chart generates one for drawings it creates). */
|
|
202
209
|
id: string;
|
|
203
|
-
/**
|
|
210
|
+
/**
|
|
211
|
+
* Stroke color (hex string or packed ARGB number). New drawings take
|
|
212
|
+
* `drawingStyle.color` when set; otherwise `#ff2962ff`.
|
|
213
|
+
*/
|
|
204
214
|
color?: VroomColor;
|
|
205
|
-
/** Stroke width in px.
|
|
215
|
+
/** Stroke width in px. New drawings take `drawingStyle.width` when set; otherwise 2. */
|
|
206
216
|
width?: number;
|
|
207
217
|
/**
|
|
208
218
|
* Protect the drawing from editing. A locked drawing still renders and can
|
|
@@ -295,6 +305,29 @@ type DrawingStyle = {
|
|
|
295
305
|
fill?: VroomColor;
|
|
296
306
|
locked?: boolean;
|
|
297
307
|
};
|
|
308
|
+
/**
|
|
309
|
+
* Default appearance for drawings the user creates — the live draft and the
|
|
310
|
+
* object handed to `onDrawingComplete`. Paste copies the source drawing's
|
|
311
|
+
* style instead of this default.
|
|
312
|
+
*
|
|
313
|
+
* Omitted fields keep the library defaults: a 2px `#ff2962ff` stroke, and for
|
|
314
|
+
* boxes a 10% tint of the stroke as fill.
|
|
315
|
+
*
|
|
316
|
+
* Prefer 6-digit hex for `color` (`'#00FFFF'`). vroom treats that as opaque,
|
|
317
|
+
* and CSS swatches preview it correctly. 8-digit hex is `#aarrggbb`, not CSS
|
|
318
|
+
* `#rrggbbaa`.
|
|
319
|
+
*/
|
|
320
|
+
type DefaultDrawingStyle = {
|
|
321
|
+
/** Stroke color, used for the live draft and stamped onto the committed drawing. */
|
|
322
|
+
color?: VroomColor;
|
|
323
|
+
/** Stroke width in px. Default 2. */
|
|
324
|
+
width?: number;
|
|
325
|
+
/**
|
|
326
|
+
* Box interior fill. Omitted, new boxes keep the default 10% stroke tint.
|
|
327
|
+
* Ignored by line, pencil, and path.
|
|
328
|
+
*/
|
|
329
|
+
fill?: VroomColor;
|
|
330
|
+
};
|
|
298
331
|
/**
|
|
299
332
|
* Storage adapter for **managed** drawing persistence. Provide it via the
|
|
300
333
|
* `drawingStore` prop and the chart owns the drawings array itself — loading and
|
|
@@ -618,6 +651,123 @@ type PriceLinesStyle = {
|
|
|
618
651
|
*/
|
|
619
652
|
hoverBoost?: number;
|
|
620
653
|
};
|
|
654
|
+
/** Which side of a position a footprint marks. */
|
|
655
|
+
type FootprintSide = 'buy' | 'sell';
|
|
656
|
+
/**
|
|
657
|
+
* A single filled trade, drawn as a circular badge above the candle it fell in —
|
|
658
|
+
* the "footprint" a trader leaves on the chart: `buy` marks an entry (a `+`
|
|
659
|
+
* badge in the bull color), `sell` marks an exit (a `−` badge in the bear color).
|
|
660
|
+
*
|
|
661
|
+
* `timeMs` is the raw execution time, *not* a bar-open time. The chart buckets
|
|
662
|
+
* each footprint into whichever candle's window contains it, so the same array
|
|
663
|
+
* renders correctly at every interval — switch from 1m to 1h and the badges
|
|
664
|
+
* re-group onto the wider bars on their own.
|
|
665
|
+
*
|
|
666
|
+
* At most two badges render per candle: one for that bar's buys and one for its
|
|
667
|
+
* sells, however many trades went into each. Hovering (or tapping) a badge hands
|
|
668
|
+
* every footprint on that candle back through `onFootprint`, so a bar holding
|
|
669
|
+
* twenty fills still shows one badge and still reports all twenty.
|
|
670
|
+
*/
|
|
671
|
+
type Footprint = {
|
|
672
|
+
/** Stable unique id, echoed back in `onFootprint`. */
|
|
673
|
+
id: string;
|
|
674
|
+
/** Execution time as Unix epoch milliseconds, unsnapped. */
|
|
675
|
+
timeMs: number;
|
|
676
|
+
/** Entry (`'buy'`) or exit (`'sell'`) — picks the badge color and glyph. */
|
|
677
|
+
side: FootprintSide;
|
|
678
|
+
/**
|
|
679
|
+
* Execution price. Ignored by the renderer (badges sit above the bar, not at
|
|
680
|
+
* the fill), and carried through to `onFootprint` for your own UI.
|
|
681
|
+
*/
|
|
682
|
+
price?: number;
|
|
683
|
+
};
|
|
684
|
+
/** Shared layout/style for every footprint badge, passed via `footprintsStyle`. */
|
|
685
|
+
type FootprintsStyle = {
|
|
686
|
+
/** Badge radius in px. Default 9. */
|
|
687
|
+
radius?: number;
|
|
688
|
+
/**
|
|
689
|
+
* Vertical gap between the two stacked badges on a candle that has both a buy
|
|
690
|
+
* and a sell. Default 4 — wide enough that each stays independently hoverable.
|
|
691
|
+
*/
|
|
692
|
+
gap?: number;
|
|
693
|
+
/** Gap between the candle's high and the first badge, in px. Default 8. */
|
|
694
|
+
margin?: number;
|
|
695
|
+
/**
|
|
696
|
+
* How much the hovered badge brightens, as a channel multiplier. 1 disables
|
|
697
|
+
* the highlight (the halo ring still draws). Default 1.25.
|
|
698
|
+
*/
|
|
699
|
+
hoverBoost?: number;
|
|
700
|
+
};
|
|
701
|
+
/**
|
|
702
|
+
* The chart's plot area in logical px relative to the chart element's top-left:
|
|
703
|
+
* the candles and everything drawn over them, with the price and time axis
|
|
704
|
+
* strips excluded.
|
|
705
|
+
*
|
|
706
|
+
* This is the rect to test a floating UI against, and it is deliberately *not*
|
|
707
|
+
* the element's own box — the element includes the axis strips, so measuring it
|
|
708
|
+
* overstates the room beside anything near an edge.
|
|
709
|
+
*/
|
|
710
|
+
type PlotRect = {
|
|
711
|
+
left: number;
|
|
712
|
+
top: number;
|
|
713
|
+
right: number;
|
|
714
|
+
bottom: number;
|
|
715
|
+
};
|
|
716
|
+
/**
|
|
717
|
+
* Fired when the pointer enters, moves between, or leaves footprint badges (on
|
|
718
|
+
* touch platforms, when one is tapped or dismissed).
|
|
719
|
+
*
|
|
720
|
+
* The chart draws no tooltip of its own — this event is the hook for yours.
|
|
721
|
+
* Position your UI off `badge` and `pane`, both in the same coordinate space as
|
|
722
|
+
* the chart element, and fill it from `footprints`.
|
|
723
|
+
*
|
|
724
|
+
* Panning or zooming fires a `'hide'`, since the bar the badge belongs to has
|
|
725
|
+
* moved: you don't need your own gesture listener to take the tooltip down.
|
|
726
|
+
*/
|
|
727
|
+
type FootprintEvent = {
|
|
728
|
+
/** True while a badge is hovered/tapped; false when it's dismissed. */
|
|
729
|
+
active: boolean;
|
|
730
|
+
/**
|
|
731
|
+
* Why this event fired:
|
|
732
|
+
* 'show' — a badge became hovered/tapped from nothing
|
|
733
|
+
* 'move' — the pointer moved to a *different* badge without leaving in between
|
|
734
|
+
* 'hide' — the badge was dismissed: the pointer left (or a tap missed), the
|
|
735
|
+
* chart was panned or zoomed out from under it, or the crosshair
|
|
736
|
+
* took the pane over
|
|
737
|
+
*/
|
|
738
|
+
reason: 'show' | 'move' | 'hide';
|
|
739
|
+
/** Which badge — its buys or its sells. Null when inactive. */
|
|
740
|
+
side: FootprintSide | null;
|
|
741
|
+
/** Bar-open time (epoch ms) of the candle the badge sits on. Null when inactive. */
|
|
742
|
+
timeMs: number | null;
|
|
743
|
+
/**
|
|
744
|
+
* Every footprint bucketed into that candle, *both* sides, ascending by
|
|
745
|
+
* `timeMs`. Empty when inactive. Filter on `side` to show only the hovered
|
|
746
|
+
* badge's trades, or render the whole bar's activity at once.
|
|
747
|
+
*/
|
|
748
|
+
footprints: Footprint[];
|
|
749
|
+
/**
|
|
750
|
+
* The badge's center and radius in logical px relative to the chart element's
|
|
751
|
+
* top-left — anchor your tooltip to it. Null when inactive.
|
|
752
|
+
*/
|
|
753
|
+
badge: {
|
|
754
|
+
x: number;
|
|
755
|
+
y: number;
|
|
756
|
+
radius: number;
|
|
757
|
+
} | null;
|
|
758
|
+
/**
|
|
759
|
+
* The plot area the badge sits in, for choosing which side of it your tooltip
|
|
760
|
+
* fits on. Null when inactive (there is nothing to place).
|
|
761
|
+
*
|
|
762
|
+
* Only you know how big your tooltip is, so the chart reports the rect rather
|
|
763
|
+
* than picking a side:
|
|
764
|
+
*
|
|
765
|
+
* ```ts
|
|
766
|
+
* const fitsRight = badge.x + badge.radius + 8 + width <= pane.right;
|
|
767
|
+
* ```
|
|
768
|
+
*/
|
|
769
|
+
pane: PlotRect | null;
|
|
770
|
+
};
|
|
621
771
|
/**
|
|
622
772
|
* MACD indicator config. Rendered in its own pane below the candles: the gap
|
|
623
773
|
* between a fast and a slow moving average, a signal line smoothing that gap,
|
|
@@ -720,16 +870,23 @@ type VroomChartCoreProps = {
|
|
|
720
870
|
chartType?: ChartType;
|
|
721
871
|
/**
|
|
722
872
|
* Duration (ms) of the animated transitions: the candle↔line switch when
|
|
723
|
-
* `chartType` changes, and the
|
|
873
|
+
* `chartType` changes, and the interval switch when the `candles` array is
|
|
724
874
|
* swapped for a different interval of the same asset. Default ~300. `0` snaps
|
|
725
|
-
* instantly. Ignored (snaps) when the OS requests reduced motion
|
|
726
|
-
* instead uses a plain cross-fade.
|
|
875
|
+
* instantly. Ignored (snaps) when the OS requests reduced motion.
|
|
727
876
|
*/
|
|
728
877
|
transitionMs?: number;
|
|
729
878
|
/**
|
|
730
879
|
* Easing curve applied to those transitions. Default `'ease-in-out'`.
|
|
731
880
|
*/
|
|
732
881
|
transitionEasing?: TransitionEasing;
|
|
882
|
+
/**
|
|
883
|
+
* How a same-asset interval switch animates. `'transform'` (default) lerps
|
|
884
|
+
* each visible column into its counterpart. `'fade'` fades the old scene out
|
|
885
|
+
* then the new one in — use when the two windows don’t share a 1:1 pairing
|
|
886
|
+
* (e.g. a fixed lookback). Same duration/easing as `transitionMs`. Reduced
|
|
887
|
+
* motion still snaps.
|
|
888
|
+
*/
|
|
889
|
+
intervalTransition?: IntervalTransition;
|
|
733
890
|
theme?: VroomTheme;
|
|
734
891
|
/** RSI indicator (pane below the candles). Omit/disable to hide it. */
|
|
735
892
|
rsi?: RSIConfig;
|
|
@@ -757,6 +914,23 @@ type VroomChartCoreProps = {
|
|
|
757
914
|
priceLines?: PriceLine[];
|
|
758
915
|
/** Shared layout/style for every entry in `priceLines`. */
|
|
759
916
|
priceLinesStyle?: PriceLinesStyle;
|
|
917
|
+
/**
|
|
918
|
+
* Executed trades to mark on the chart as circular badges above the bar they
|
|
919
|
+
* fell in — where a position was entered and exited.
|
|
920
|
+
*
|
|
921
|
+
* Pass raw fills with their real execution times; the chart groups them onto
|
|
922
|
+
* candles itself and re-groups on interval changes, so one array serves every
|
|
923
|
+
* timeframe. Order doesn't matter.
|
|
924
|
+
*/
|
|
925
|
+
footprints?: Footprint[];
|
|
926
|
+
/** Shared layout/style for every entry in `footprints`. */
|
|
927
|
+
footprintsStyle?: FootprintsStyle;
|
|
928
|
+
/**
|
|
929
|
+
* Fired when a footprint badge is hovered (tapped on touch platforms) or
|
|
930
|
+
* dismissed. The chart renders no tooltip itself — use this to place your own,
|
|
931
|
+
* anchored to `e.badge`, kept inside `e.pane`, and filled from `e.footprints`.
|
|
932
|
+
*/
|
|
933
|
+
onFootprint?: (e: FootprintEvent) => void;
|
|
760
934
|
/**
|
|
761
935
|
* Fired continuously while a draggable price line is being dragged, with the
|
|
762
936
|
* price under the pointer. Use it for a live readout (e.g. an order ticket);
|
|
@@ -802,6 +976,12 @@ type VroomChartCoreProps = {
|
|
|
802
976
|
mode?: ChartMode;
|
|
803
977
|
/** Active drawing tool while in `draw` mode. Default `null` (draws nothing). */
|
|
804
978
|
tool?: DrawTool;
|
|
979
|
+
/**
|
|
980
|
+
* Default appearance for drawings the user creates (live draft + the object
|
|
981
|
+
* handed to `onDrawingComplete`). Paste copies the source drawing's style
|
|
982
|
+
* instead of this. Omitted fields keep the library defaults.
|
|
983
|
+
*/
|
|
984
|
+
drawingStyle?: DefaultDrawingStyle;
|
|
805
985
|
/**
|
|
806
986
|
* Committed drawings to render, anchored to data so they track the candles on
|
|
807
987
|
* pan/zoom. This is a controlled prop: append the value the chart hands you in
|
|
@@ -945,4 +1125,4 @@ declare function classifyTransition(prev: Candle[] | null, next: Candle[], serie
|
|
|
945
1125
|
*/
|
|
946
1126
|
declare function timeframeWindow(oldWindow: VisibleRange, oldStepMs: number, oldLastMs: number, newStepMs: number, newLastMs: number): VisibleRange;
|
|
947
1127
|
|
|
948
|
-
export { type BollingerBandsConfig, type Candle, type ChartType, type CrosshairEvent, type DataTransition, type MACDConfig, type MAKind, type MASource, type MovingAverageOverlay, type PriceLine, type PriceLinesStyle, type RSIConfig, type TransitionEasing, type VWAPConfig, type VisibleRange, type VolumeConfig, VroomChart, type VroomChartProps, type VroomColor, type VroomTheme, classifyTransition, inferStepMs, timeframeWindow };
|
|
1128
|
+
export { type BollingerBandsConfig, type Candle, type ChartType, type CrosshairEvent, type DataTransition, type DefaultDrawingStyle, type Footprint, type FootprintEvent, type FootprintSide, type FootprintsStyle, type IntervalTransition, type MACDConfig, type MAKind, type MASource, type MovingAverageOverlay, type PlotRect, type PriceLine, type PriceLinesStyle, type RSIConfig, type TransitionEasing, type VWAPConfig, type VisibleRange, type VolumeConfig, VroomChart, type VroomChartProps, type VroomColor, type VroomTheme, classifyTransition, inferStepMs, timeframeWindow };
|
package/lib/index.d.ts
CHANGED
|
@@ -187,6 +187,13 @@ type ChartType = 'candles' | 'line';
|
|
|
187
187
|
* Defaults to `'ease-in-out'`.
|
|
188
188
|
*/
|
|
189
189
|
type TransitionEasing = 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out';
|
|
190
|
+
/**
|
|
191
|
+
* How a same-asset interval switch animates. `'transform'` (default) lerps
|
|
192
|
+
* each visible column into its counterpart. `'fade'` fades the old scene out
|
|
193
|
+
* then the new one in — use when the two windows don’t share a 1:1 pairing
|
|
194
|
+
* (e.g. a fixed lookback).
|
|
195
|
+
*/
|
|
196
|
+
type IntervalTransition = 'transform' | 'fade';
|
|
190
197
|
/** Active drawing tool while in `draw` mode. `null` draws nothing. */
|
|
191
198
|
type DrawTool = null | 'line' | 'box' | 'pencil' | 'path';
|
|
192
199
|
/** A drawing anchor in data space, so it stays glued to the candles on pan/zoom. */
|
|
@@ -200,9 +207,12 @@ type DrawPoint = {
|
|
|
200
207
|
type DrawingBase = {
|
|
201
208
|
/** Stable unique id (the chart generates one for drawings it creates). */
|
|
202
209
|
id: string;
|
|
203
|
-
/**
|
|
210
|
+
/**
|
|
211
|
+
* Stroke color (hex string or packed ARGB number). New drawings take
|
|
212
|
+
* `drawingStyle.color` when set; otherwise `#ff2962ff`.
|
|
213
|
+
*/
|
|
204
214
|
color?: VroomColor;
|
|
205
|
-
/** Stroke width in px.
|
|
215
|
+
/** Stroke width in px. New drawings take `drawingStyle.width` when set; otherwise 2. */
|
|
206
216
|
width?: number;
|
|
207
217
|
/**
|
|
208
218
|
* Protect the drawing from editing. A locked drawing still renders and can
|
|
@@ -295,6 +305,29 @@ type DrawingStyle = {
|
|
|
295
305
|
fill?: VroomColor;
|
|
296
306
|
locked?: boolean;
|
|
297
307
|
};
|
|
308
|
+
/**
|
|
309
|
+
* Default appearance for drawings the user creates — the live draft and the
|
|
310
|
+
* object handed to `onDrawingComplete`. Paste copies the source drawing's
|
|
311
|
+
* style instead of this default.
|
|
312
|
+
*
|
|
313
|
+
* Omitted fields keep the library defaults: a 2px `#ff2962ff` stroke, and for
|
|
314
|
+
* boxes a 10% tint of the stroke as fill.
|
|
315
|
+
*
|
|
316
|
+
* Prefer 6-digit hex for `color` (`'#00FFFF'`). vroom treats that as opaque,
|
|
317
|
+
* and CSS swatches preview it correctly. 8-digit hex is `#aarrggbb`, not CSS
|
|
318
|
+
* `#rrggbbaa`.
|
|
319
|
+
*/
|
|
320
|
+
type DefaultDrawingStyle = {
|
|
321
|
+
/** Stroke color, used for the live draft and stamped onto the committed drawing. */
|
|
322
|
+
color?: VroomColor;
|
|
323
|
+
/** Stroke width in px. Default 2. */
|
|
324
|
+
width?: number;
|
|
325
|
+
/**
|
|
326
|
+
* Box interior fill. Omitted, new boxes keep the default 10% stroke tint.
|
|
327
|
+
* Ignored by line, pencil, and path.
|
|
328
|
+
*/
|
|
329
|
+
fill?: VroomColor;
|
|
330
|
+
};
|
|
298
331
|
/**
|
|
299
332
|
* Storage adapter for **managed** drawing persistence. Provide it via the
|
|
300
333
|
* `drawingStore` prop and the chart owns the drawings array itself — loading and
|
|
@@ -618,6 +651,123 @@ type PriceLinesStyle = {
|
|
|
618
651
|
*/
|
|
619
652
|
hoverBoost?: number;
|
|
620
653
|
};
|
|
654
|
+
/** Which side of a position a footprint marks. */
|
|
655
|
+
type FootprintSide = 'buy' | 'sell';
|
|
656
|
+
/**
|
|
657
|
+
* A single filled trade, drawn as a circular badge above the candle it fell in —
|
|
658
|
+
* the "footprint" a trader leaves on the chart: `buy` marks an entry (a `+`
|
|
659
|
+
* badge in the bull color), `sell` marks an exit (a `−` badge in the bear color).
|
|
660
|
+
*
|
|
661
|
+
* `timeMs` is the raw execution time, *not* a bar-open time. The chart buckets
|
|
662
|
+
* each footprint into whichever candle's window contains it, so the same array
|
|
663
|
+
* renders correctly at every interval — switch from 1m to 1h and the badges
|
|
664
|
+
* re-group onto the wider bars on their own.
|
|
665
|
+
*
|
|
666
|
+
* At most two badges render per candle: one for that bar's buys and one for its
|
|
667
|
+
* sells, however many trades went into each. Hovering (or tapping) a badge hands
|
|
668
|
+
* every footprint on that candle back through `onFootprint`, so a bar holding
|
|
669
|
+
* twenty fills still shows one badge and still reports all twenty.
|
|
670
|
+
*/
|
|
671
|
+
type Footprint = {
|
|
672
|
+
/** Stable unique id, echoed back in `onFootprint`. */
|
|
673
|
+
id: string;
|
|
674
|
+
/** Execution time as Unix epoch milliseconds, unsnapped. */
|
|
675
|
+
timeMs: number;
|
|
676
|
+
/** Entry (`'buy'`) or exit (`'sell'`) — picks the badge color and glyph. */
|
|
677
|
+
side: FootprintSide;
|
|
678
|
+
/**
|
|
679
|
+
* Execution price. Ignored by the renderer (badges sit above the bar, not at
|
|
680
|
+
* the fill), and carried through to `onFootprint` for your own UI.
|
|
681
|
+
*/
|
|
682
|
+
price?: number;
|
|
683
|
+
};
|
|
684
|
+
/** Shared layout/style for every footprint badge, passed via `footprintsStyle`. */
|
|
685
|
+
type FootprintsStyle = {
|
|
686
|
+
/** Badge radius in px. Default 9. */
|
|
687
|
+
radius?: number;
|
|
688
|
+
/**
|
|
689
|
+
* Vertical gap between the two stacked badges on a candle that has both a buy
|
|
690
|
+
* and a sell. Default 4 — wide enough that each stays independently hoverable.
|
|
691
|
+
*/
|
|
692
|
+
gap?: number;
|
|
693
|
+
/** Gap between the candle's high and the first badge, in px. Default 8. */
|
|
694
|
+
margin?: number;
|
|
695
|
+
/**
|
|
696
|
+
* How much the hovered badge brightens, as a channel multiplier. 1 disables
|
|
697
|
+
* the highlight (the halo ring still draws). Default 1.25.
|
|
698
|
+
*/
|
|
699
|
+
hoverBoost?: number;
|
|
700
|
+
};
|
|
701
|
+
/**
|
|
702
|
+
* The chart's plot area in logical px relative to the chart element's top-left:
|
|
703
|
+
* the candles and everything drawn over them, with the price and time axis
|
|
704
|
+
* strips excluded.
|
|
705
|
+
*
|
|
706
|
+
* This is the rect to test a floating UI against, and it is deliberately *not*
|
|
707
|
+
* the element's own box — the element includes the axis strips, so measuring it
|
|
708
|
+
* overstates the room beside anything near an edge.
|
|
709
|
+
*/
|
|
710
|
+
type PlotRect = {
|
|
711
|
+
left: number;
|
|
712
|
+
top: number;
|
|
713
|
+
right: number;
|
|
714
|
+
bottom: number;
|
|
715
|
+
};
|
|
716
|
+
/**
|
|
717
|
+
* Fired when the pointer enters, moves between, or leaves footprint badges (on
|
|
718
|
+
* touch platforms, when one is tapped or dismissed).
|
|
719
|
+
*
|
|
720
|
+
* The chart draws no tooltip of its own — this event is the hook for yours.
|
|
721
|
+
* Position your UI off `badge` and `pane`, both in the same coordinate space as
|
|
722
|
+
* the chart element, and fill it from `footprints`.
|
|
723
|
+
*
|
|
724
|
+
* Panning or zooming fires a `'hide'`, since the bar the badge belongs to has
|
|
725
|
+
* moved: you don't need your own gesture listener to take the tooltip down.
|
|
726
|
+
*/
|
|
727
|
+
type FootprintEvent = {
|
|
728
|
+
/** True while a badge is hovered/tapped; false when it's dismissed. */
|
|
729
|
+
active: boolean;
|
|
730
|
+
/**
|
|
731
|
+
* Why this event fired:
|
|
732
|
+
* 'show' — a badge became hovered/tapped from nothing
|
|
733
|
+
* 'move' — the pointer moved to a *different* badge without leaving in between
|
|
734
|
+
* 'hide' — the badge was dismissed: the pointer left (or a tap missed), the
|
|
735
|
+
* chart was panned or zoomed out from under it, or the crosshair
|
|
736
|
+
* took the pane over
|
|
737
|
+
*/
|
|
738
|
+
reason: 'show' | 'move' | 'hide';
|
|
739
|
+
/** Which badge — its buys or its sells. Null when inactive. */
|
|
740
|
+
side: FootprintSide | null;
|
|
741
|
+
/** Bar-open time (epoch ms) of the candle the badge sits on. Null when inactive. */
|
|
742
|
+
timeMs: number | null;
|
|
743
|
+
/**
|
|
744
|
+
* Every footprint bucketed into that candle, *both* sides, ascending by
|
|
745
|
+
* `timeMs`. Empty when inactive. Filter on `side` to show only the hovered
|
|
746
|
+
* badge's trades, or render the whole bar's activity at once.
|
|
747
|
+
*/
|
|
748
|
+
footprints: Footprint[];
|
|
749
|
+
/**
|
|
750
|
+
* The badge's center and radius in logical px relative to the chart element's
|
|
751
|
+
* top-left — anchor your tooltip to it. Null when inactive.
|
|
752
|
+
*/
|
|
753
|
+
badge: {
|
|
754
|
+
x: number;
|
|
755
|
+
y: number;
|
|
756
|
+
radius: number;
|
|
757
|
+
} | null;
|
|
758
|
+
/**
|
|
759
|
+
* The plot area the badge sits in, for choosing which side of it your tooltip
|
|
760
|
+
* fits on. Null when inactive (there is nothing to place).
|
|
761
|
+
*
|
|
762
|
+
* Only you know how big your tooltip is, so the chart reports the rect rather
|
|
763
|
+
* than picking a side:
|
|
764
|
+
*
|
|
765
|
+
* ```ts
|
|
766
|
+
* const fitsRight = badge.x + badge.radius + 8 + width <= pane.right;
|
|
767
|
+
* ```
|
|
768
|
+
*/
|
|
769
|
+
pane: PlotRect | null;
|
|
770
|
+
};
|
|
621
771
|
/**
|
|
622
772
|
* MACD indicator config. Rendered in its own pane below the candles: the gap
|
|
623
773
|
* between a fast and a slow moving average, a signal line smoothing that gap,
|
|
@@ -720,16 +870,23 @@ type VroomChartCoreProps = {
|
|
|
720
870
|
chartType?: ChartType;
|
|
721
871
|
/**
|
|
722
872
|
* Duration (ms) of the animated transitions: the candle↔line switch when
|
|
723
|
-
* `chartType` changes, and the
|
|
873
|
+
* `chartType` changes, and the interval switch when the `candles` array is
|
|
724
874
|
* swapped for a different interval of the same asset. Default ~300. `0` snaps
|
|
725
|
-
* instantly. Ignored (snaps) when the OS requests reduced motion
|
|
726
|
-
* instead uses a plain cross-fade.
|
|
875
|
+
* instantly. Ignored (snaps) when the OS requests reduced motion.
|
|
727
876
|
*/
|
|
728
877
|
transitionMs?: number;
|
|
729
878
|
/**
|
|
730
879
|
* Easing curve applied to those transitions. Default `'ease-in-out'`.
|
|
731
880
|
*/
|
|
732
881
|
transitionEasing?: TransitionEasing;
|
|
882
|
+
/**
|
|
883
|
+
* How a same-asset interval switch animates. `'transform'` (default) lerps
|
|
884
|
+
* each visible column into its counterpart. `'fade'` fades the old scene out
|
|
885
|
+
* then the new one in — use when the two windows don’t share a 1:1 pairing
|
|
886
|
+
* (e.g. a fixed lookback). Same duration/easing as `transitionMs`. Reduced
|
|
887
|
+
* motion still snaps.
|
|
888
|
+
*/
|
|
889
|
+
intervalTransition?: IntervalTransition;
|
|
733
890
|
theme?: VroomTheme;
|
|
734
891
|
/** RSI indicator (pane below the candles). Omit/disable to hide it. */
|
|
735
892
|
rsi?: RSIConfig;
|
|
@@ -757,6 +914,23 @@ type VroomChartCoreProps = {
|
|
|
757
914
|
priceLines?: PriceLine[];
|
|
758
915
|
/** Shared layout/style for every entry in `priceLines`. */
|
|
759
916
|
priceLinesStyle?: PriceLinesStyle;
|
|
917
|
+
/**
|
|
918
|
+
* Executed trades to mark on the chart as circular badges above the bar they
|
|
919
|
+
* fell in — where a position was entered and exited.
|
|
920
|
+
*
|
|
921
|
+
* Pass raw fills with their real execution times; the chart groups them onto
|
|
922
|
+
* candles itself and re-groups on interval changes, so one array serves every
|
|
923
|
+
* timeframe. Order doesn't matter.
|
|
924
|
+
*/
|
|
925
|
+
footprints?: Footprint[];
|
|
926
|
+
/** Shared layout/style for every entry in `footprints`. */
|
|
927
|
+
footprintsStyle?: FootprintsStyle;
|
|
928
|
+
/**
|
|
929
|
+
* Fired when a footprint badge is hovered (tapped on touch platforms) or
|
|
930
|
+
* dismissed. The chart renders no tooltip itself — use this to place your own,
|
|
931
|
+
* anchored to `e.badge`, kept inside `e.pane`, and filled from `e.footprints`.
|
|
932
|
+
*/
|
|
933
|
+
onFootprint?: (e: FootprintEvent) => void;
|
|
760
934
|
/**
|
|
761
935
|
* Fired continuously while a draggable price line is being dragged, with the
|
|
762
936
|
* price under the pointer. Use it for a live readout (e.g. an order ticket);
|
|
@@ -802,6 +976,12 @@ type VroomChartCoreProps = {
|
|
|
802
976
|
mode?: ChartMode;
|
|
803
977
|
/** Active drawing tool while in `draw` mode. Default `null` (draws nothing). */
|
|
804
978
|
tool?: DrawTool;
|
|
979
|
+
/**
|
|
980
|
+
* Default appearance for drawings the user creates (live draft + the object
|
|
981
|
+
* handed to `onDrawingComplete`). Paste copies the source drawing's style
|
|
982
|
+
* instead of this. Omitted fields keep the library defaults.
|
|
983
|
+
*/
|
|
984
|
+
drawingStyle?: DefaultDrawingStyle;
|
|
805
985
|
/**
|
|
806
986
|
* Committed drawings to render, anchored to data so they track the candles on
|
|
807
987
|
* pan/zoom. This is a controlled prop: append the value the chart hands you in
|
|
@@ -945,4 +1125,4 @@ declare function classifyTransition(prev: Candle[] | null, next: Candle[], serie
|
|
|
945
1125
|
*/
|
|
946
1126
|
declare function timeframeWindow(oldWindow: VisibleRange, oldStepMs: number, oldLastMs: number, newStepMs: number, newLastMs: number): VisibleRange;
|
|
947
1127
|
|
|
948
|
-
export { type BollingerBandsConfig, type Candle, type ChartType, type CrosshairEvent, type DataTransition, type MACDConfig, type MAKind, type MASource, type MovingAverageOverlay, type PriceLine, type PriceLinesStyle, type RSIConfig, type TransitionEasing, type VWAPConfig, type VisibleRange, type VolumeConfig, VroomChart, type VroomChartProps, type VroomColor, type VroomTheme, classifyTransition, inferStepMs, timeframeWindow };
|
|
1128
|
+
export { type BollingerBandsConfig, type Candle, type ChartType, type CrosshairEvent, type DataTransition, type DefaultDrawingStyle, type Footprint, type FootprintEvent, type FootprintSide, type FootprintsStyle, type IntervalTransition, type MACDConfig, type MAKind, type MASource, type MovingAverageOverlay, type PlotRect, type PriceLine, type PriceLinesStyle, type RSIConfig, type TransitionEasing, type VWAPConfig, type VisibleRange, type VolumeConfig, VroomChart, type VroomChartProps, type VroomColor, type VroomTheme, classifyTransition, inferStepMs, timeframeWindow };
|