acttrader-charts 1.0.14 → 1.0.15

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
@@ -235,6 +235,10 @@ When `enableTrading` is on and live BID/ASK data is streaming, hovering / activa
235
235
  | `maxCandles` | | `200` | Max bars fetched per data-load request |
236
236
  | `prefetchThreshold` | | `80` | Bars from start of data at which historical fetch triggers (min 20) |
237
237
  | `mobileBarDivisor` | | `2` | Divide desktop visible bar count on touch devices (`2`, `3`, or `4`) |
238
+ | `momentumScrollEnabled` | | `true` | Enable momentum (kinetic) scrolling — chart coasts after a fast flick |
239
+ | `momentumDecay` | | `0.95` | Per-frame velocity decay, normalised to 60 fps. Clamped `[0.80, 0.99]`. Lower = stops faster |
240
+ | `momentumThreshold` | | `0.3` | Min release velocity (px/ms) to launch momentum. Raise to require a faster flick |
241
+ | `momentumMaxVelocity` | | `6.0` | Max launch velocity (px/ms) — caps hard-flick speed |
238
242
  | `targetCandleWidth` | | `10` | Target px width per candle for auto-calculating initial bar count |
239
243
  | `durationTimeframeMap` | | *(see below)* | Override duration → timeframe pairings |
240
244
  | `dataLoader` | | — | `(params) => Promise<OHLCVBar[]>` auto-called on load / change |
@@ -256,7 +260,10 @@ When `enableTrading` is on and live BID/ASK data is streaming, hovering / activa
256
260
  | `hideSymbolAndTick` | | `false` | Hide the symbol name, OHLC strip, and tick-activity dot overlay |
257
261
  | `showBottomBar` | | `false` | Show the bottom duration-selector bar |
258
262
  | `hideQtyButton` | | `false` | Hide the floating Qty input overlay on draft orders |
263
+ | `showQuantityField` | | `false` | Render an editable QTY pill at the left of the draft order info box. Clicking the pill opens a flyout input to edit the quantity before submitting |
264
+ | `quantityFieldConfig` | | — | Constraints for the draft order QTY field (only relevant when `showQuantityField` is `true`). Object: `{ minLots?: number, maxLots?: number }`. `minLots` also sets the initial quantity and the step value for the flyout input (default: `1`). `maxLots` caps the input (default: `100`) |
259
265
  | `tradesThresholdForHorizontalLine` | | `2` | Level count above which render auto-switches to `"dot"` mode |
266
+ | `timezone` | | `"UTC"` | IANA timezone string for time-axis and crosshair labels. `"UTC"` (default), `"local"` (browser/device timezone), or any IANA string (`"America/New_York"`, `"Europe/London"`, etc.) |
260
267
  | `canvasColors` | | — | Per-theme canvas background color overrides (persisted from Settings dialog) |
261
268
  | `aggregateFrom` | | — | Fetch finer-grained data and aggregate client-side per timeframe |
262
269
  | `onOrderSubmit` | | — | Called when user submits a trade via the floating button |
@@ -479,6 +486,17 @@ chart.loadData(bars: OHLCVBar[]): this
479
486
  chart.prependData(bars: OHLCVBar[]): this // prepend historical bars (infinite scroll back)
480
487
  chart.correctBar(barTime: number, bar: OHLCVBar): void // replace a bar with authoritative data after close
481
488
  chart.setLoading(loading: boolean): this
489
+
490
+ // Reset — clears all bars, the live price line, and any in-flight fetch.
491
+ // Call before switching to a new symbol so no previous symbol data bleeds in.
492
+ chart.resetData(): this
493
+ ```
494
+
495
+ **Symbol switch pattern:**
496
+ ```ts
497
+ chart.setSymbol('GBPUSD').resetData();
498
+ // … fetch new bars …
499
+ chart.loadData(newBars);
482
500
  ```
483
501
 
484
502
  ### Series & Appearance
@@ -488,6 +506,7 @@ chart.setSeries(series: SeriesType): this
488
506
  chart.setTheme('dark' | 'light'): this
489
507
  chart.setTimeframe(tf: Timeframe): this // change timeframe and reload data
490
508
  chart.setThemeOverrides(overrides: ThemeOverrides): this // update per-theme color overrides at runtime
509
+ chart.setTimezone(tz: string): this // change display timezone at runtime
491
510
  chart.setVolume(show: boolean): this
492
511
  ```
493
512
 
@@ -568,6 +568,22 @@ interface ChartConfig {
568
568
  * Minimum (and default) lot size for draft order submission. Default: `1`.
569
569
  */
570
570
  minLots?: number;
571
+ /**
572
+ * When true, renders an editable QTY pill at the left of the draft order
573
+ * info box. Clicking the pill opens a flyout to edit the quantity. Default: `false`.
574
+ */
575
+ showQuantityField?: boolean;
576
+ /**
577
+ * Constraints for the draft order QTY field. Only relevant when
578
+ * `showQuantityField` is true. `minLots` also sets the initial quantity
579
+ * and the step value for the flyout input.
580
+ */
581
+ quantityFieldConfig?: {
582
+ /** Minimum lot size, step size, and initial quantity (e.g. `0.01`). Default: `1` */
583
+ minLots?: number;
584
+ /** Maximum lot size (e.g. `100`). Default: `100` */
585
+ maxLots?: number;
586
+ };
571
587
  /** Called when user submits an order via the floating trade button */
572
588
  onOrderSubmit?: (order: OrderSubmit) => void;
573
589
  /**
@@ -621,6 +637,13 @@ interface ChartConfig {
621
637
  * }
622
638
  */
623
639
  themeOverrides?: ThemeOverrides;
640
+ /**
641
+ * IANA timezone string for all time-axis and crosshair labels.
642
+ * `"UTC"` (default) preserves existing behavior.
643
+ * `"local"` uses the browser/device timezone automatically.
644
+ * Any IANA string is accepted: `"America/New_York"`, `"Europe/London"`, etc.
645
+ */
646
+ timezone?: string;
624
647
  /**
625
648
  * Optional per-component UI configuration overrides (font sizes, icon
626
649
  * sizes, spacing). Only the keys you provide are overridden; all others
@@ -664,6 +687,33 @@ interface ChartConfig {
664
687
  * Default: `2`.
665
688
  */
666
689
  mobileBarDivisor?: 2 | 3 | 4;
690
+ /**
691
+ * Enable momentum (kinetic) scrolling on drag release. When `true`, releasing
692
+ * a fast pan gesture lets the chart continue scrolling with gradually
693
+ * decelerating speed — matching the feel of native iOS/Android scroll views.
694
+ * Default: `true`.
695
+ */
696
+ momentumScrollEnabled?: boolean;
697
+ /**
698
+ * Per-frame velocity decay factor for momentum scrolling, normalised to 60 fps.
699
+ * A value of `0.95` means the viewport retains 95% of its speed each 16.67 ms
700
+ * frame. Lower values stop faster; higher values coast longer.
701
+ * Clamped to `[0.80, 0.99]`. Default: `0.95`.
702
+ */
703
+ momentumDecay?: number;
704
+ /**
705
+ * Minimum release velocity (px/ms) required to trigger a momentum scroll.
706
+ * Swipes slower than this threshold stop immediately on finger-up.
707
+ * Raising this value suppresses momentum for slow drags while still triggering
708
+ * on fast flicks. Default: `0.3`.
709
+ */
710
+ momentumThreshold?: number;
711
+ /**
712
+ * Maximum initial launch velocity (px/ms) for momentum scrolling.
713
+ * Caps runaway fast-flick launches that would scroll hundreds of bars in one
714
+ * gesture. Default: `6.0`.
715
+ */
716
+ momentumMaxVelocity?: number;
667
717
  /**
668
718
  * Initial number of candles visible when the chart first loads (desktop).
669
719
  * On mobile this value is further divided by `mobileBarDivisor` unless
@@ -568,6 +568,22 @@ interface ChartConfig {
568
568
  * Minimum (and default) lot size for draft order submission. Default: `1`.
569
569
  */
570
570
  minLots?: number;
571
+ /**
572
+ * When true, renders an editable QTY pill at the left of the draft order
573
+ * info box. Clicking the pill opens a flyout to edit the quantity. Default: `false`.
574
+ */
575
+ showQuantityField?: boolean;
576
+ /**
577
+ * Constraints for the draft order QTY field. Only relevant when
578
+ * `showQuantityField` is true. `minLots` also sets the initial quantity
579
+ * and the step value for the flyout input.
580
+ */
581
+ quantityFieldConfig?: {
582
+ /** Minimum lot size, step size, and initial quantity (e.g. `0.01`). Default: `1` */
583
+ minLots?: number;
584
+ /** Maximum lot size (e.g. `100`). Default: `100` */
585
+ maxLots?: number;
586
+ };
571
587
  /** Called when user submits an order via the floating trade button */
572
588
  onOrderSubmit?: (order: OrderSubmit) => void;
573
589
  /**
@@ -621,6 +637,13 @@ interface ChartConfig {
621
637
  * }
622
638
  */
623
639
  themeOverrides?: ThemeOverrides;
640
+ /**
641
+ * IANA timezone string for all time-axis and crosshair labels.
642
+ * `"UTC"` (default) preserves existing behavior.
643
+ * `"local"` uses the browser/device timezone automatically.
644
+ * Any IANA string is accepted: `"America/New_York"`, `"Europe/London"`, etc.
645
+ */
646
+ timezone?: string;
624
647
  /**
625
648
  * Optional per-component UI configuration overrides (font sizes, icon
626
649
  * sizes, spacing). Only the keys you provide are overridden; all others
@@ -664,6 +687,33 @@ interface ChartConfig {
664
687
  * Default: `2`.
665
688
  */
666
689
  mobileBarDivisor?: 2 | 3 | 4;
690
+ /**
691
+ * Enable momentum (kinetic) scrolling on drag release. When `true`, releasing
692
+ * a fast pan gesture lets the chart continue scrolling with gradually
693
+ * decelerating speed — matching the feel of native iOS/Android scroll views.
694
+ * Default: `true`.
695
+ */
696
+ momentumScrollEnabled?: boolean;
697
+ /**
698
+ * Per-frame velocity decay factor for momentum scrolling, normalised to 60 fps.
699
+ * A value of `0.95` means the viewport retains 95% of its speed each 16.67 ms
700
+ * frame. Lower values stop faster; higher values coast longer.
701
+ * Clamped to `[0.80, 0.99]`. Default: `0.95`.
702
+ */
703
+ momentumDecay?: number;
704
+ /**
705
+ * Minimum release velocity (px/ms) required to trigger a momentum scroll.
706
+ * Swipes slower than this threshold stop immediately on finger-up.
707
+ * Raising this value suppresses momentum for slow drags while still triggering
708
+ * on fast flicks. Default: `0.3`.
709
+ */
710
+ momentumThreshold?: number;
711
+ /**
712
+ * Maximum initial launch velocity (px/ms) for momentum scrolling.
713
+ * Caps runaway fast-flick launches that would scroll hundreds of bars in one
714
+ * gesture. Default: `6.0`.
715
+ */
716
+ momentumMaxVelocity?: number;
667
717
  /**
668
718
  * Initial number of candles visible when the chart first loads (desktop).
669
719
  * On mobile this value is further divided by `mobileBarDivisor` unless