acttrader-charts 1.3.0-beta.27 → 1.3.0-beta.29

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/README.md CHANGED
@@ -2957,3 +2957,52 @@ npm run lint # ESLint
2957
2957
  ## License
2958
2958
 
2959
2959
  MIT
2960
+
2961
+ ## Bar Replay
2962
+
2963
+ Replay history bar by bar, as TradingView does. `enableReplay: true` adds a
2964
+ **Replay** button to the header (simple and advanced layouts); it opens a
2965
+ control strip under the chart:
2966
+
2967
+ ```
2968
+ ⇤ Select bar ▾ │ ▷ ▷| 1x 1D │ ▷▷| ✕
2969
+ ```
2970
+
2971
+ - **Select bar** — a cut line with a scissors badge follows the pointer; click
2972
+ a bar and everything from it onward is hidden. The ▾ menu also offers
2973
+ **Select date…**, **First available date** and **Random bar**.
2974
+ - **▷ / ▷|** — play at the chosen speed (`0.1x` – `10x` bars per second) or
2975
+ step one bar forward. Keyboard: `Shift+→` step, `Shift+↓` play/pause,
2976
+ `Esc` leaves select mode.
2977
+ - **▷▷|** — jump to real time: every hidden bar comes back, including live
2978
+ bars built while the replay ran. **✕** closes the strip.
2979
+
2980
+ Live ticks keep updating the hidden series during a replay, so nothing is
2981
+ lost; a `loadData()` during a replay (timeframe or symbol change) keeps the
2982
+ replay date. Default `false`; without it nothing changes.
2983
+
2984
+ ```ts
2985
+ const chart = new ChartEngine({ container, enableReplay: true });
2986
+
2987
+ // Drive it from code (works without the header button too):
2988
+ chart.openReplay(); // show the strip, arm "Select bar"
2989
+ chart.startReplay('2026-06-01'); // hide bars after this date (number | Date | string)
2990
+ chart.setReplaySpeed(3); // bars per second
2991
+ chart.playReplay(); chart.pauseReplay(); chart.replayStepForward();
2992
+ chart.exitReplay(); // back to real time, strip stays open
2993
+ chart.closeReplay(); // back to real time and close the strip
2994
+ chart.isReplayActive();
2995
+
2996
+ chart.on('replayStart', ({ time }) => { /* bars after `time` are hidden */ });
2997
+ chart.on('replayStep', ({ time }) => { /* one more bar revealed */ });
2998
+ chart.on('replayEnd', ({ time }) => { /* last hidden bar revealed */ });
2999
+ chart.on('replayExit', () => { /* live chart is back */ });
3000
+ ```
3001
+
3002
+ On Android and iOS the same controls are bridge commands — `openReplay`,
3003
+ `closeReplay`, `startReplay { time }`, `playReplay`, `pauseReplay`,
3004
+ `replayStepForward`, `setReplaySpeed { barsPerSecond }`, `exitReplay` — with
3005
+ `enableReplay` on `init`; the four events above arrive through the bridge and the
3006
+ mobile header gets its own Replay button. See the `charts-android` and
3007
+ `charts-ios` READMEs for the Kotlin / Swift calls.
3008
+
@@ -1865,6 +1865,21 @@ interface ChartConfig {
1865
1865
  * (a one-time `console.warn` is logged at init).
1866
1866
  */
1867
1867
  enableSnapshot?: boolean;
1868
+ /**
1869
+ * **Bar Replay** — replay history bar by bar, as TradingView does.
1870
+ *
1871
+ * Adds a "Replay" button to the header (simple and advanced layouts). It opens a control strip
1872
+ * under the chart: pick a start bar (click on the chart, a date, the first
1873
+ * available bar or a random one), then play, pause, step forward, change
1874
+ * speed, or jump back to real time. Bars after the replay point are hidden
1875
+ * until they are revealed; live ticks keep updating the hidden series, so
1876
+ * nothing is lost when the replay ends.
1877
+ *
1878
+ * Drive it from code with {@link ChartEngine.openReplay},
1879
+ * {@link ChartEngine.startReplay}, {@link ChartEngine.playReplay} and friends.
1880
+ * Default `false`.
1881
+ */
1882
+ enableReplay?: boolean;
1868
1883
  /**
1869
1884
  * Show the **Templates** section at the foot of the indicators flyout —
1870
1885
  * named, reusable indicator sets the user can save from the current chart
@@ -2979,6 +2994,20 @@ type ChartEventMap = {
2979
2994
  * browser action immediately after emitting; mobile wrappers can intercept
2980
2995
  * via the JS bridge to short-circuit and use platform APIs.
2981
2996
  */
2997
+ /** Bar Replay started (or restarted) at the bar with this open time. */
2998
+ replayStart: {
2999
+ time: number;
3000
+ };
3001
+ /** Bar Replay revealed the next bar. */
3002
+ replayStep: {
3003
+ time: number;
3004
+ };
3005
+ /** Bar Replay revealed the last hidden bar. */
3006
+ replayEnd: {
3007
+ time: number;
3008
+ };
3009
+ /** Bar Replay ended and the live chart is back. */
3010
+ replayExit: Record<string, never>;
2982
3011
  snapshot: {
2983
3012
  /** Full PNG data URL of the composited chart canvas. */
2984
3013
  dataUrl: string;
@@ -1865,6 +1865,21 @@ interface ChartConfig {
1865
1865
  * (a one-time `console.warn` is logged at init).
1866
1866
  */
1867
1867
  enableSnapshot?: boolean;
1868
+ /**
1869
+ * **Bar Replay** — replay history bar by bar, as TradingView does.
1870
+ *
1871
+ * Adds a "Replay" button to the header (simple and advanced layouts). It opens a control strip
1872
+ * under the chart: pick a start bar (click on the chart, a date, the first
1873
+ * available bar or a random one), then play, pause, step forward, change
1874
+ * speed, or jump back to real time. Bars after the replay point are hidden
1875
+ * until they are revealed; live ticks keep updating the hidden series, so
1876
+ * nothing is lost when the replay ends.
1877
+ *
1878
+ * Drive it from code with {@link ChartEngine.openReplay},
1879
+ * {@link ChartEngine.startReplay}, {@link ChartEngine.playReplay} and friends.
1880
+ * Default `false`.
1881
+ */
1882
+ enableReplay?: boolean;
1868
1883
  /**
1869
1884
  * Show the **Templates** section at the foot of the indicators flyout —
1870
1885
  * named, reusable indicator sets the user can save from the current chart
@@ -2979,6 +2994,20 @@ type ChartEventMap = {
2979
2994
  * browser action immediately after emitting; mobile wrappers can intercept
2980
2995
  * via the JS bridge to short-circuit and use platform APIs.
2981
2996
  */
2997
+ /** Bar Replay started (or restarted) at the bar with this open time. */
2998
+ replayStart: {
2999
+ time: number;
3000
+ };
3001
+ /** Bar Replay revealed the next bar. */
3002
+ replayStep: {
3003
+ time: number;
3004
+ };
3005
+ /** Bar Replay revealed the last hidden bar. */
3006
+ replayEnd: {
3007
+ time: number;
3008
+ };
3009
+ /** Bar Replay ended and the live chart is back. */
3010
+ replayExit: Record<string, never>;
2982
3011
  snapshot: {
2983
3012
  /** Full PNG data URL of the composited chart canvas. */
2984
3013
  dataUrl: string;