@tradecanvas/chart 1.3.0 → 1.7.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.
Files changed (205) hide show
  1. package/README.md +131 -49
  2. package/dist/Chart.d.ts +724 -18
  3. package/dist/Chart.d.ts.map +1 -1
  4. package/dist/DataManager.d.ts +5 -0
  5. package/dist/DataManager.d.ts.map +1 -1
  6. package/dist/HistoryPager.d.ts +58 -0
  7. package/dist/HistoryPager.d.ts.map +1 -0
  8. package/dist/LayoutSession-CTZB90NX.cjs +2 -0
  9. package/dist/LayoutSession-CTZB90NX.cjs.map +1 -0
  10. package/dist/LayoutSession-CWn3sdbs.js +3967 -0
  11. package/dist/LayoutSession-CWn3sdbs.js.map +1 -0
  12. package/dist/PaneManager.d.ts.map +1 -1
  13. package/dist/ThemeManager.d.ts +5 -1
  14. package/dist/ThemeManager.d.ts.map +1 -1
  15. package/dist/chartA11y.d.ts +59 -0
  16. package/dist/chartA11y.d.ts.map +1 -0
  17. package/dist/charts/ChartTypeStrategy.d.ts +11 -4
  18. package/dist/charts/ChartTypeStrategy.d.ts.map +1 -1
  19. package/dist/grid/ChartGrid.d.ts +7 -1
  20. package/dist/grid/ChartGrid.d.ts.map +1 -1
  21. package/dist/i18n-CiQ8EDVs.js +1469 -0
  22. package/dist/i18n-CiQ8EDVs.js.map +1 -0
  23. package/dist/i18n-WsLA9SmD.cjs +2 -0
  24. package/dist/i18n-WsLA9SmD.cjs.map +1 -0
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.ts +24 -3
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +74 -89
  30. package/dist/index.js.map +1 -1
  31. package/dist/indicatorLabel.d.ts +7 -0
  32. package/dist/indicatorLabel.d.ts.map +1 -0
  33. package/dist/layout/LayoutManager.d.ts +50 -0
  34. package/dist/layout/LayoutManager.d.ts.map +1 -1
  35. package/dist/layout/priceAxisWidth.d.ts +2 -0
  36. package/dist/layout/priceAxisWidth.d.ts.map +1 -1
  37. package/dist/regularHours.d.ts +10 -0
  38. package/dist/regularHours.d.ts.map +1 -0
  39. package/dist/state/LayoutSession.d.ts +101 -0
  40. package/dist/state/LayoutSession.d.ts.map +1 -0
  41. package/dist/state/layoutStorage.d.ts +46 -0
  42. package/dist/state/layoutStorage.d.ts.map +1 -0
  43. package/dist/trading/wireExecution.d.ts +7 -3
  44. package/dist/trading/wireExecution.d.ts.map +1 -1
  45. package/dist/widget/ChartWidget.d.ts +283 -10
  46. package/dist/widget/ChartWidget.d.ts.map +1 -1
  47. package/dist/widget/ChartWidgetGrid.d.ts +166 -0
  48. package/dist/widget/ChartWidgetGrid.d.ts.map +1 -0
  49. package/dist/widget/DrawingTemplateStore.d.ts +29 -8
  50. package/dist/widget/DrawingTemplateStore.d.ts.map +1 -1
  51. package/dist/widget/WatchlistStore.d.ts +65 -0
  52. package/dist/widget/WatchlistStore.d.ts.map +1 -0
  53. package/dist/widget/WidgetAccountPanel.d.ts +72 -0
  54. package/dist/widget/WidgetAccountPanel.d.ts.map +1 -0
  55. package/dist/widget/WidgetAlertsPanel.d.ts +50 -3
  56. package/dist/widget/WidgetAlertsPanel.d.ts.map +1 -1
  57. package/dist/widget/WidgetBracketBar.d.ts +3 -1
  58. package/dist/widget/WidgetBracketBar.d.ts.map +1 -1
  59. package/dist/widget/WidgetChartNav.d.ts +36 -0
  60. package/dist/widget/WidgetChartNav.d.ts.map +1 -0
  61. package/dist/widget/WidgetCommandPalette.d.ts +5 -1
  62. package/dist/widget/WidgetCommandPalette.d.ts.map +1 -1
  63. package/dist/widget/WidgetContextMenu.d.ts +40 -0
  64. package/dist/widget/WidgetContextMenu.d.ts.map +1 -0
  65. package/dist/widget/WidgetDataWindow.d.ts +3 -1
  66. package/dist/widget/WidgetDataWindow.d.ts.map +1 -1
  67. package/dist/widget/WidgetDepthLadder.d.ts +3 -1
  68. package/dist/widget/WidgetDepthLadder.d.ts.map +1 -1
  69. package/dist/widget/WidgetDrawingSettings.d.ts +108 -0
  70. package/dist/widget/WidgetDrawingSettings.d.ts.map +1 -0
  71. package/dist/widget/WidgetDrawingSidebar.d.ts +26 -1
  72. package/dist/widget/WidgetDrawingSidebar.d.ts.map +1 -1
  73. package/dist/widget/WidgetDrawingStyle.d.ts +3 -1
  74. package/dist/widget/WidgetDrawingStyle.d.ts.map +1 -1
  75. package/dist/widget/WidgetDropdown.d.ts.map +1 -1
  76. package/dist/widget/WidgetGoToDate.d.ts +46 -0
  77. package/dist/widget/WidgetGoToDate.d.ts.map +1 -0
  78. package/dist/widget/WidgetHistoryPill.d.ts +23 -0
  79. package/dist/widget/WidgetHistoryPill.d.ts.map +1 -0
  80. package/dist/widget/WidgetHotkeySheet.d.ts +3 -1
  81. package/dist/widget/WidgetHotkeySheet.d.ts.map +1 -1
  82. package/dist/widget/WidgetIndicatorLegend.d.ts +98 -0
  83. package/dist/widget/WidgetIndicatorLegend.d.ts.map +1 -0
  84. package/dist/widget/WidgetIndicatorSettings.d.ts +62 -7
  85. package/dist/widget/WidgetIndicatorSettings.d.ts.map +1 -1
  86. package/dist/widget/WidgetIntervalInput.d.ts +34 -0
  87. package/dist/widget/WidgetIntervalInput.d.ts.map +1 -0
  88. package/dist/widget/WidgetLayoutsDialog.d.ts +39 -0
  89. package/dist/widget/WidgetLayoutsDialog.d.ts.map +1 -0
  90. package/dist/widget/WidgetLayoutsUI.d.ts +37 -0
  91. package/dist/widget/WidgetLayoutsUI.d.ts.map +1 -0
  92. package/dist/widget/WidgetLoadingOverlay.d.ts.map +1 -1
  93. package/dist/widget/WidgetNamePrompt.d.ts +31 -0
  94. package/dist/widget/WidgetNamePrompt.d.ts.map +1 -0
  95. package/dist/widget/WidgetObjectTree.d.ts +21 -3
  96. package/dist/widget/WidgetObjectTree.d.ts.map +1 -1
  97. package/dist/widget/WidgetOrderTicket.d.ts +49 -0
  98. package/dist/widget/WidgetOrderTicket.d.ts.map +1 -0
  99. package/dist/widget/WidgetReplayBar.d.ts +52 -7
  100. package/dist/widget/WidgetReplayBar.d.ts.map +1 -1
  101. package/dist/widget/WidgetSettings.d.ts +26 -2
  102. package/dist/widget/WidgetSettings.d.ts.map +1 -1
  103. package/dist/widget/WidgetStatusBar.d.ts +19 -1
  104. package/dist/widget/WidgetStatusBar.d.ts.map +1 -1
  105. package/dist/widget/WidgetStyles.d.ts +3 -1
  106. package/dist/widget/WidgetStyles.d.ts.map +1 -1
  107. package/dist/widget/WidgetSymbolInfo.d.ts +64 -0
  108. package/dist/widget/WidgetSymbolInfo.d.ts.map +1 -0
  109. package/dist/widget/WidgetSymbolSearch.d.ts +28 -5
  110. package/dist/widget/WidgetSymbolSearch.d.ts.map +1 -1
  111. package/dist/widget/WidgetToolbar.d.ts +42 -4
  112. package/dist/widget/WidgetToolbar.d.ts.map +1 -1
  113. package/dist/widget/WidgetTooltip.d.ts +43 -0
  114. package/dist/widget/WidgetTooltip.d.ts.map +1 -0
  115. package/dist/widget/WidgetWatchlist.d.ts +53 -13
  116. package/dist/widget/WidgetWatchlist.d.ts.map +1 -1
  117. package/dist/widget/chartMenu.d.ts +40 -0
  118. package/dist/widget/chartMenu.d.ts.map +1 -0
  119. package/dist/widget/drawingMenu.d.ts +21 -0
  120. package/dist/widget/drawingMenu.d.ts.map +1 -0
  121. package/dist/widget/escapeHtml.d.ts +3 -0
  122. package/dist/widget/escapeHtml.d.ts.map +1 -0
  123. package/dist/widget/focusTrap.d.ts +8 -0
  124. package/dist/widget/focusTrap.d.ts.map +1 -0
  125. package/dist/widget/i18n.d.ts +20 -63
  126. package/dist/widget/i18n.d.ts.map +1 -1
  127. package/dist/widget/iconSet.d.ts +26 -0
  128. package/dist/widget/iconSet.d.ts.map +1 -0
  129. package/dist/widget/icons.d.ts +5 -0
  130. package/dist/widget/icons.d.ts.map +1 -1
  131. package/dist/widget/index.cjs +2145 -405
  132. package/dist/widget/index.cjs.map +1 -1
  133. package/dist/widget/index.d.ts +18 -1
  134. package/dist/widget/index.d.ts.map +1 -1
  135. package/dist/widget/index.js +7376 -1274
  136. package/dist/widget/index.js.map +1 -1
  137. package/dist/widget/indicatorTemplates.d.ts +24 -0
  138. package/dist/widget/indicatorTemplates.d.ts.map +1 -0
  139. package/dist/widget/keyTarget.d.ts +11 -0
  140. package/dist/widget/keyTarget.d.ts.map +1 -0
  141. package/dist/widget/legendValues.d.ts +19 -0
  142. package/dist/widget/legendValues.d.ts.map +1 -0
  143. package/dist/widget/locales/ar.d.ts +4 -0
  144. package/dist/widget/locales/ar.d.ts.map +1 -0
  145. package/dist/widget/locales/de.d.ts +4 -0
  146. package/dist/widget/locales/de.d.ts.map +1 -0
  147. package/dist/widget/locales/en.d.ts +722 -0
  148. package/dist/widget/locales/en.d.ts.map +1 -0
  149. package/dist/widget/locales/es.d.ts +4 -0
  150. package/dist/widget/locales/es.d.ts.map +1 -0
  151. package/dist/widget/locales/fr.d.ts +4 -0
  152. package/dist/widget/locales/fr.d.ts.map +1 -0
  153. package/dist/widget/locales/he.d.ts +4 -0
  154. package/dist/widget/locales/he.d.ts.map +1 -0
  155. package/dist/widget/locales/id.d.ts +4 -0
  156. package/dist/widget/locales/id.d.ts.map +1 -0
  157. package/dist/widget/locales/index.cjs +2 -0
  158. package/dist/widget/locales/index.cjs.map +1 -0
  159. package/dist/widget/locales/index.d.ts +33 -0
  160. package/dist/widget/locales/index.d.ts.map +1 -0
  161. package/dist/widget/locales/index.js +10089 -0
  162. package/dist/widget/locales/index.js.map +1 -0
  163. package/dist/widget/locales/ja.d.ts +4 -0
  164. package/dist/widget/locales/ja.d.ts.map +1 -0
  165. package/dist/widget/locales/ko.d.ts +4 -0
  166. package/dist/widget/locales/ko.d.ts.map +1 -0
  167. package/dist/widget/locales/pt.d.ts +4 -0
  168. package/dist/widget/locales/pt.d.ts.map +1 -0
  169. package/dist/widget/locales/ru.d.ts +4 -0
  170. package/dist/widget/locales/ru.d.ts.map +1 -0
  171. package/dist/widget/locales/th.d.ts +4 -0
  172. package/dist/widget/locales/th.d.ts.map +1 -0
  173. package/dist/widget/locales/tr.d.ts +4 -0
  174. package/dist/widget/locales/tr.d.ts.map +1 -0
  175. package/dist/widget/locales/vi.d.ts +4 -0
  176. package/dist/widget/locales/vi.d.ts.map +1 -0
  177. package/dist/widget/locales/zh.d.ts +4 -0
  178. package/dist/widget/locales/zh.d.ts.map +1 -0
  179. package/dist/widget/locales/zhHant.d.ts +4 -0
  180. package/dist/widget/locales/zhHant.d.ts.map +1 -0
  181. package/dist/widget/orderTicket.d.ts +27 -0
  182. package/dist/widget/orderTicket.d.ts.map +1 -0
  183. package/dist/widget/settingsControls.d.ts +24 -0
  184. package/dist/widget/settingsControls.d.ts.map +1 -0
  185. package/dist/widget/types.d.ts +215 -13
  186. package/dist/widget/types.d.ts.map +1 -1
  187. package/dist/widget/widgetConfig.d.ts +1 -5
  188. package/dist/widget/widgetConfig.d.ts.map +1 -1
  189. package/dist/widget/widgetLayout.d.ts +22 -0
  190. package/dist/widget/widgetLayout.d.ts.map +1 -0
  191. package/dist/widget/widgetLocales.d.ts +17 -0
  192. package/dist/widget/widgetLocales.d.ts.map +1 -0
  193. package/dist/widget/widgetTimeframes.d.ts +28 -0
  194. package/dist/widget/widgetTimeframes.d.ts.map +1 -0
  195. package/dist/widget/widgetTimezones.d.ts +32 -0
  196. package/dist/widget/widgetTimezones.d.ts.map +1 -0
  197. package/dist/widget/widgetUI.d.ts +126 -0
  198. package/dist/widget/widgetUI.d.ts.map +1 -0
  199. package/package.json +8 -3
  200. package/dist/DragDropImporter-BazeSQPD.cjs +0 -2
  201. package/dist/DragDropImporter-BazeSQPD.cjs.map +0 -1
  202. package/dist/DragDropImporter-cURSpfUb.js +0 -1883
  203. package/dist/DragDropImporter-cURSpfUb.js.map +0 -1
  204. package/dist/charts/IndicatorPriceRange.d.ts +0 -20
  205. package/dist/charts/IndicatorPriceRange.d.ts.map +0 -1
package/dist/Chart.d.ts CHANGED
@@ -1,6 +1,10 @@
1
- import { ChartOptions, ChartType, OHLCBar, DataSeries, Theme, ThemeName, ChartEventType, ChartEvent, ChartEventMap, TauriBridgeOptions, IndicatorPlugin, IndicatorDescriptor, IndicatorOutput, DrawingToolType, DrawingState, DrawingStyle, DrawingPlugin, PanelPosition, TradingOrder, TradingPosition, DepthData, TradingConfig, MarketConfig, Locale, StreamConfig, ConnectionState, ConnectionInfo, TimeFrame, FeaturesConfig, ExecutionAdapter, ExecutionConfig } from '@tradecanvas/commons';
1
+ import { ChartOptions, ChartType, OHLCBar, DataSeries, Theme, ThemeName, ChartEventType, ChartEvent, ChartEventMap, TauriBridgeOptions, IndicatorPlugin, IndicatorDescriptor, IndicatorOutput, ResolvedIndicatorStyle, DrawingToolType, DrawingState, DrawingStyle, DrawingOptions, DrawingOptionDefs, DrawingDescriptor, DrawingPlugin, PanelPosition, TradingOrder, TradingPosition, DepthData, TradingConfig, MarketConfig, Locale, StreamConfig, ConnectionState, ConnectionInfo, TimeFrame, TimeZoneSetting, SymbolInfo, OverlayScale, FeaturesConfig, ExecutionAdapter, ExecutionConfig, ChartTypeOptions, PriceFormatter, PriceFraction, ShapeConfig, TimeFormatter } from '@tradecanvas/commons';
2
+ import { BidAsk, ExportColumn, RangePreset, SessionHoursConfig, DrawingPatch, DrawingOrderMove } from '@tradecanvas/core';
3
+ import { HistoryLoader } from './HistoryPager.js';
2
4
  import { PluginManager } from './plugins/PluginManager.js';
3
5
  import { ChartPlugin } from './plugins/contracts.js';
6
+ /** `setTimezone(EXCHANGE_TIMEZONE)` shows the time zone of the symbol's exchange. */
7
+ export declare const EXCHANGE_TIMEZONE = "exchange";
4
8
  export declare class Chart {
5
9
  static version: string;
6
10
  private engine;
@@ -20,6 +24,8 @@ export declare class Chart {
20
24
  private execTeardown;
21
25
  private autoScrollOnNewBar;
22
26
  private displayDataCache;
27
+ /** Earliest bar of an `indicatorUpdate` waiting to be emitted; null = none pending. */
28
+ private indicatorUpdateFrom;
23
29
  private resolvedLayoutCache;
24
30
  private panelInfoCache;
25
31
  private renderScheduled;
@@ -34,8 +40,33 @@ export declare class Chart {
34
40
  private chartLegend;
35
41
  private watermark;
36
42
  private barCountdown;
43
+ /**
44
+ * Indicators of the loaded layout this chart could not add (an unknown or
45
+ * not yet registered id, a whitelist): saved back as they were, so saving
46
+ * the layout again doesn't drop them.
47
+ */
48
+ private unrestoredIndicators;
49
+ /** Above 0 while indicators change as a whole (a layout, an undo): no undo steps are recorded. */
50
+ private indicatorHistoryDepth;
51
+ /** Alerts of deleted drawings, put back if an undo brings the drawing back. */
52
+ private removedDrawingAlerts;
53
+ /** The zoom-area tool is waiting for its box. */
54
+ private zoomAreaMode;
55
+ /** The "+" by the price axis. */
56
+ private priceAxisAddButton;
57
+ /** Display timezone, minutes east of UTC; null = the browser's. */
58
+ /** The time zone shown: the setting, with 'exchange' resolved to the symbol's zone. */
59
+ private displayTz;
60
+ /** What `setTimezone` was given; 'exchange' follows the symbol. */
61
+ private timezoneSetting;
62
+ /** What the feed (or host) said about the symbol on the chart. */
63
+ private symbolInfo;
64
+ /** Bumped per symbol asked about: an answer about a symbol the chart left is dropped. */
65
+ private symbolInfoSeq;
37
66
  private sessionBreaks;
38
67
  private sessionShading;
68
+ /** The session hours the host set (or the default); a symbol's own hours show over them. */
69
+ private hostSessionHours;
39
70
  private compareRenderer;
40
71
  private countdownInterval;
41
72
  private volumeRenderer;
@@ -53,6 +84,15 @@ export declare class Chart {
53
84
  private replayBarUnsub;
54
85
  /** True while `replaySeek` runs: its bar is a jump, not a replay step. */
55
86
  private replaySeeking;
87
+ /**
88
+ * While a replay runs, the live series keeps moving here — stream and
89
+ * host updates land in `live` instead of the replayed slice — and comes
90
+ * back on `replayStop()`. `price` is the latest live tick.
91
+ */
92
+ private replaySession;
93
+ /** During a replay in finer steps: the steps, and the series they build. */
94
+ private replayStepsSeries;
95
+ private replayCoarse;
56
96
  private undoRedoManager;
57
97
  private autoSaveScheduler;
58
98
  private animator;
@@ -61,8 +101,29 @@ export declare class Chart {
61
101
  private interactionManager;
62
102
  private crosshairHandler;
63
103
  private chartRenderer;
104
+ /** Settings of the chart types that build their own bars. */
105
+ private chartTypeOptions;
106
+ private mainSeriesVisible;
107
+ /** The visible high and low, the bid and the ask. */
108
+ private priceLines;
109
+ /** Other symbols' bars, for the indicators that compare with them. */
110
+ private symbolSeries;
111
+ /** Bars outside the symbol's regular hours shown. */
112
+ private extendedHours;
113
+ /** A replay being restarted (or the chart going): its stop is not reported. */
114
+ private replayRestarting;
115
+ /** While they are hidden: the whole series, theirs included (the data manager has the rest). */
116
+ private fullSeries;
117
+ /** Symbols asked for (`symbolSeriesRequest`) and not given yet. */
118
+ private requestedSymbols;
64
119
  private gridRenderer;
65
120
  private priceAxis;
121
+ /** The left price scale: overlays put on it, else a mirror of the price scale. */
122
+ private leftPriceAxis;
123
+ private leftScaleRequested;
124
+ private leftAxisWidth;
125
+ /** The left scale's viewport this frame; null while it is hidden. */
126
+ private leftViewport;
66
127
  private timeAxis;
67
128
  private options;
68
129
  private features;
@@ -70,6 +131,13 @@ export declare class Chart {
70
131
  private container;
71
132
  private currentPriceLine;
72
133
  private numberLocale;
134
+ /** The market's price precision, when set: otherwise it follows the visible range. */
135
+ private marketPricePrecision;
136
+ /** The chart's price format (`priceFormat`), or null for decimals. */
137
+ private priceFormatter;
138
+ /** A fraction format's smallest step (a 32nd), or null. */
139
+ private priceUnit;
140
+ private paneTitles;
73
141
  /**
74
142
  * The `autoScale` the chart was constructed with — distinct from
75
143
  * `this.options.autoScale`, which drag-to-scale/vertical-pan mutate at
@@ -78,12 +146,68 @@ export declare class Chart {
78
146
  */
79
147
  private defaultAutoScale;
80
148
  private keyboardHandler;
149
+ private a11y;
81
150
  private onWindowKeyDown;
82
151
  private currentSymbol;
152
+ /** Timeframe and adapter of the connected stream, for paging its history. */
153
+ private streamTimeframe;
154
+ /** The symbol and timeframe last told (symbolChange, timeframeChange). */
155
+ private announcedSymbol;
156
+ private announcedTimeframe;
157
+ private streamAdapter;
158
+ /** Pages older bars in as the view nears the oldest one. */
159
+ private history;
160
+ /** Whether the history loader is the connected stream's (and goes with it). */
161
+ private historyFromStream;
162
+ /** Whether the host set a loader of its own: the stream's never replaces it. */
163
+ private hostHistoryLoader;
164
+ /** Symbol and timeframe of the series the last stream snapshot loaded. */
165
+ private snapshotKey;
166
+ private historyCheckQueued;
83
167
  constructor(container: HTMLElement, options: ChartOptions & {
84
168
  plugins?: ChartPlugin[];
85
169
  });
86
170
  setData(data: DataSeries): void;
171
+ /**
172
+ * `setData`; `restoring` puts the live series back after a replay, which
173
+ * goes on as it was for alerts (their bars and last values stay).
174
+ */
175
+ private loadSeries;
176
+ /**
177
+ * Add older bars in front of the data — e.g. a page of history loaded as
178
+ * the user scrolls back. Bars at or after the first loaded bar are skipped.
179
+ * The same bars stay on screen. Ignored during a replay. Returns how many
180
+ * bars were added.
181
+ */
182
+ prependBars(bars: OHLCBar[]): number;
183
+ /**
184
+ * A stream snapshot for the series already on the chart (a reconnect): keep
185
+ * the older bars paged in and the view, replace the rest.
186
+ */
187
+ private mergeSnapshot;
188
+ /**
189
+ * Load older bars as the user scrolls back: `loader(before, limit)` gets the
190
+ * oldest loaded bar's time and returns up to `limit` older bars (an empty
191
+ * array once the history starts). A connected stream whose adapter has
192
+ * `fetchHistoryBefore` sets this up by itself. Pass null to stop.
193
+ */
194
+ setHistoryLoader(loader: HistoryLoader | null, options?: {
195
+ pageSize?: number;
196
+ }): void;
197
+ /** Load one page of older bars now. Resolves to the number of bars added. */
198
+ loadMoreHistory(): Promise<number>;
199
+ /** Whether older bars can still be loaded (a loader is set and the start wasn't reached). */
200
+ hasMoreHistory(): boolean;
201
+ isLoadingHistory(): boolean;
202
+ /**
203
+ * Page older bars in when less than a screen of them is left of the view —
204
+ * after the current update, so a page that just landed reports itself
205
+ * before the next one starts. Not for chart types that reshape the bars
206
+ * (Renko, Kagi…): a handful of bricks can stand for a whole page.
207
+ */
208
+ private checkHistory;
209
+ /** Page the connected stream's history through its adapter, if it can. */
210
+ private useStreamHistory;
87
211
  appendBar(bar: OHLCBar): void;
88
212
  /**
89
213
  * Append multiple bars at once (e.g., catch-up after reconnect).
@@ -99,9 +223,140 @@ export declare class Chart {
99
223
  time: number;
100
224
  }): void;
101
225
  setChartType(type: ChartType | (string & {})): void;
102
- addIndicator(id: string, params?: Record<string, number | string | boolean>, position?: PanelPosition): string | null;
226
+ /**
227
+ * Settings of Renko, Line Break, Kagi, Point & Figure and range bars, by
228
+ * type: each type given replaces that type's settings (`{}` puts it back
229
+ * to the defaults). Values it can't use are left out.
230
+ */
231
+ setChartTypeOptions(options: ChartTypeOptions): void;
232
+ getChartTypeOptions(): ChartTypeOptions;
233
+ /**
234
+ * Show or hide the bars outside the symbol's regular hours
235
+ * (`SymbolInfo.sessions`, in its `timezone`): pre- and post-market. Hidden,
236
+ * they are kept aside and come back when shown again. Bars a day or longer,
237
+ * and symbols without hours, are left as they are.
238
+ */
239
+ setExtendedHours(show: boolean): void;
240
+ isExtendedHoursVisible(): boolean;
241
+ /** Which bar times to show, for bars like `data`'s; null: all of them. */
242
+ private sessionKeep;
243
+ /** The bars of `all` the chart shows (no state kept). */
244
+ private shownBars;
245
+ /** The bars of `all` the chart shows; while some are hidden, `all` is kept as the whole series. */
246
+ private regularOnly;
247
+ /** A new or updated bar into the whole series (while one is kept): whether the chart shows it. */
248
+ /** A stream bar onto the bars shown: the last one again or a new one after it; false for an older one. */
249
+ private placeStreamBar;
250
+ private takeBar;
251
+ /** The bars shown again after the extended hours or the symbol's hours changed. */
252
+ private reapplyExtendedHours;
253
+ /** The price lines for this frame: during a replay without the live bid and ask. */
254
+ private quoteLines;
255
+ /**
256
+ * The shapes the chart draws: `tagRadius` rounds its price tags, axis
257
+ * pills and order badges (0: square, 999: pills). Kept through theme
258
+ * changes.
259
+ */
260
+ setShapes(shapes: ShapeConfig): void;
261
+ getShapes(): ShapeConfig;
262
+ /** Show or hide the main series (its bars, candles or line); the rest of the chart stays. */
263
+ setMainSeriesVisible(visible: boolean): void;
264
+ isMainSeriesVisible(): boolean;
265
+ /** Mark the highest high and lowest low on screen with a line and a price tag. */
266
+ setHighLowLines(visible: boolean): void;
267
+ isHighLowLinesVisible(): boolean;
268
+ /**
269
+ * Mark the best bid and ask with lines and price tags (null takes them
270
+ * off). A connected feed whose ticks carry `bid` / `ask` keeps them up to date.
271
+ */
272
+ setBidAsk(quote: BidAsk | null): void;
273
+ getBidAsk(): BidAsk | null;
274
+ /**
275
+ * Add an indicator. Panel indicators get a pane of their own at `position`.
276
+ * `options.pane` draws it in another indicator's pane instead, on that
277
+ * pane's scale; a price-pane indicator computed from a pane indicator's
278
+ * line (`source: 'ind:<instanceId>:<key>'`) goes there by itself.
279
+ */
280
+ addIndicator(id: string, params?: Record<string, number | string | boolean>, position?: PanelPosition, options?: {
281
+ pane?: string;
282
+ scale?: OverlayScale;
283
+ }): string | null;
284
+ private addIndicatorNow;
285
+ /**
286
+ * Another symbol's bars, for the indicators that read it ('compareSymbol',
287
+ * 'spread'): they line them up with the chart's bars by time. Give them
288
+ * again after a timeframe change; null forgets them.
289
+ */
290
+ setSymbolSeries(symbol: string, bars: DataSeries | null): void;
291
+ /** A symbol no indicator reads any more may be asked for again later. */
292
+ private forgetUnreadSymbols;
293
+ /** The bars given for `symbol`, or null. */
294
+ getSymbolSeries(symbol: string): DataSeries | null;
295
+ /** The symbols the chart's indicators read, whether their bars are here or not. */
296
+ getRequiredSymbols(): string[];
297
+ /**
298
+ * Ask once for the symbol an indicator just added or changed reads, when
299
+ * the chart hasn't got it (not for symbols other indicators read: one
300
+ * whose fetch failed is asked for again only by an indicator on it).
301
+ */
302
+ private requestMissingSymbols;
303
+ /**
304
+ * Change an indicator's inputs. A source that would make it read from its
305
+ * own lines (through other indicators) is ignored.
306
+ */
103
307
  updateIndicator(instanceId: string, params: Record<string, number | string | boolean>): void;
308
+ private updateIndicatorNow;
309
+ /**
310
+ * The pane an indicator is drawn in, other than its own: the pane of the
311
+ * instance `requested`, or, for a price-pane indicator computed from a pane
312
+ * indicator's line, that indicator's pane. Null = the price pane (overlays)
313
+ * or a pane of its own (panels).
314
+ */
315
+ private paneFor;
316
+ /** The instance owning the pane `instanceId` is drawn in; null for the price pane. */
317
+ private paneHostOf;
318
+ /** An indicator's reference levels (RSI 30 / 70): its own, else its indicator's defaults. */
319
+ getIndicatorLevels(instanceId: string): number[];
320
+ /**
321
+ * Put a price-pane overlay on the left price scale (fit to its own values,
322
+ * the scale shows by itself) or back on the price scale. False when the
323
+ * indicator isn't a price-pane overlay.
324
+ */
325
+ setIndicatorScale(instanceId: string, scale: OverlayScale): boolean;
326
+ private setIndicatorScaleNow;
327
+ getIndicatorScale(instanceId: string): OverlayScale;
328
+ /** Show the left price scale even without overlays on it (it then mirrors the price scale). */
329
+ setLeftPriceScaleVisible(visible: boolean): void;
330
+ /** Whether the left price scale is on screen: asked for, or carrying an overlay. */
331
+ isLeftPriceScaleShown(): boolean;
332
+ /** The left price scale's range on screen, or null while it is hidden. */
333
+ getLeftPriceRange(): {
334
+ min: number;
335
+ max: number;
336
+ } | null;
337
+ /**
338
+ * The left scale's viewport for this frame: fit to the overlays on it over
339
+ * the visible bars (on a plain linear scale), or the price scale's when
340
+ * none is.
341
+ */
342
+ private computeLeftViewport;
343
+ /** Set an indicator's reference levels; `null` restores its indicator's defaults. */
344
+ setIndicatorLevels(instanceId: string, levels: readonly number[] | null): void;
345
+ private setIndicatorLevelsNow;
346
+ /**
347
+ * Remove an indicator, and the indicators computed from its lines with it.
348
+ * Others drawn in its pane keep the pane (a pane indicator takes it over)
349
+ * or go back to the price pane.
350
+ */
104
351
  removeIndicator(instanceId: string): void;
352
+ private removeIndicatorNow;
353
+ /**
354
+ * Remove one indicator. The first pane indicator drawn in its pane takes the
355
+ * pane over and the others stay in it.
356
+ */
357
+ private detachIndicator;
358
+ /** The colours, line widths and opacity an indicator draws with (a copy), or null. */
359
+ getIndicatorStyle(instanceId: string): ResolvedIndicatorStyle | null;
105
360
  getIndicatorOutput(instanceId: string): IndicatorOutput | null;
106
361
  registerIndicator(plugin: IndicatorPlugin): void;
107
362
  /** The chart's plugin registry — register custom indicators / drawings / chart types / overlays. */
@@ -109,8 +364,117 @@ export declare class Chart {
109
364
  static indicators(): IndicatorDescriptor[];
110
365
  setPanelPosition(instanceId: string, position: PanelPosition): void;
111
366
  setPanelSize(instanceId: string, size: number): void;
367
+ /**
368
+ * Move an indicator to another pane: `target` is an indicator drawn there
369
+ * (it joins that pane, on its scale), `'new'` a pane of its own (indicators
370
+ * that draw in a pane), or `'price'` the price pane (overlays). Indicators
371
+ * drawn in its own pane stay there (one of them takes the pane over) or
372
+ * follow it when they read its lines. False when it can't go there.
373
+ */
374
+ moveIndicatorToPane(instanceId: string, target: string): boolean;
375
+ /** Whether `moveIndicatorToPane(instanceId, target)` would move it. */
376
+ canMoveIndicatorToPane(instanceId: string, target: string): boolean;
377
+ /** Where a move would put the indicator: the pane's host, `null` (its own or the price pane), or `undefined` when it can't go. */
378
+ private paneMoveHost;
379
+ private moveIndicatorToPaneNow;
380
+ /**
381
+ * Fold a pane to its header, or open it again: the pane `instanceId` is
382
+ * drawn in. While a pane is maximised, this puts the panes back first.
383
+ */
384
+ setPaneCollapsed(instanceId: string, collapsed: boolean): boolean;
385
+ /** Whether the pane `instanceId` is drawn in shows folded (folded, or another pane is maximised). */
386
+ isPaneCollapsed(instanceId: string): boolean;
387
+ /** Let one pane take the room (the others fold, the price pane keeps a strip); `null` puts them back. */
388
+ setMaximizedPane(instanceId: string | null): boolean;
389
+ getMaximizedPane(): string | null;
390
+ /**
391
+ * A pane's value scale: logarithmic (used while all its values are above 0;
392
+ * linear otherwise), upside down. The pane `instanceId` is drawn in.
393
+ */
394
+ setPaneScale(instanceId: string, scale: {
395
+ log?: boolean;
396
+ invert?: boolean;
397
+ percent?: boolean;
398
+ }): boolean;
399
+ /** The pane's value scale as set (see `setPaneScale`). */
400
+ getPaneScale(instanceId: string): {
401
+ log: boolean;
402
+ invert: boolean;
403
+ percent: boolean;
404
+ };
405
+ /** A pane's first value on screen (its own indicator's first line), the 0% of a percent scale. */
406
+ private paneBaseline;
407
+ /** Move a pane one place up (`-1`) or down (`1`) among the panes on its side. */
408
+ movePane(instanceId: string, delta: -1 | 1): boolean;
409
+ /** Whether `movePane(instanceId, delta)` would move it. */
410
+ canMovePane(instanceId: string, delta: -1 | 1): boolean;
411
+ /** The pane an indicator is drawn in: its own, or the one it shares. */
412
+ private paneOf;
413
+ private paneChange;
414
+ /**
415
+ * Indicator panes, in CSS pixels relative to the container: the whole pane,
416
+ * its 20 px header (where the name is written) included.
417
+ */
418
+ getIndicatorPanes(): {
419
+ instanceId: string;
420
+ instanceIds: string[];
421
+ rect: {
422
+ x: number;
423
+ y: number;
424
+ width: number;
425
+ height: number;
426
+ };
427
+ }[];
428
+ /** Tag each indicator line's latest value on its value axis (default on). */
429
+ setIndicatorValueLabelsVisible(visible: boolean): void;
430
+ /** Write each pane's indicator name and hovered values in its header (default); off when you label panes yourself. */
431
+ setPaneTitlesVisible(visible: boolean): void;
432
+ /**
433
+ * The y (CSS px, container-relative) just below the OHLCV legend — where
434
+ * content stacked under it starts. The plot's top edge when it is hidden.
435
+ */
436
+ getLegendBottom(): number;
437
+ /**
438
+ * Whether each drawn bar is one data bar (candles, lines, Heikin-Ashi…).
439
+ * Renko, Kagi, point & figure, line break and range bars redraw the series,
440
+ * so a bar index on screen is not an index into the data.
441
+ */
442
+ isTimeAligned(): boolean;
443
+ /**
444
+ * A price on the market's grid: a multiple of its smallest step (`minTick`),
445
+ * else rounded to its precision, else to the decimals the axis shows.
446
+ */
447
+ roundPrice(price: number): number;
448
+ /**
449
+ * How prices read on the price scale and everything that prints one: a
450
+ * function of yours, fractions of a point (`{ denominator: 32 }` prints
451
+ * `101'16`), or null for decimals. Indicator panes keep their own numbers.
452
+ */
453
+ setPriceFormat(format: PriceFormatter | PriceFraction | null): void;
454
+ /** The chart's price format as a function (`priceFormat`), or null for decimals. */
455
+ getPriceFormatter(): PriceFormatter | null;
456
+ private applyPriceFormat;
457
+ /** How times read on the time axis, the crosshair and the tooltip; null for the chart's own. */
458
+ setTimeFormatter(formatter: TimeFormatter | null): void;
459
+ private applyTimeFormatter;
460
+ /**
461
+ * A price as the price axis writes it: in the chart's price format when it
462
+ * has one (`priceFormat`), else at the market's precision or the visible
463
+ * range's, in the number locale.
464
+ */
465
+ formatPrice(price: number): string;
112
466
  setDrawingTool(type: DrawingToolType | null): void;
113
467
  getDrawingTool(): DrawingToolType | null;
468
+ /** Keep the drawing tool after each drawing, to draw several in a row (Esc ends). */
469
+ setStayInDrawingMode(enabled: boolean): void;
470
+ isStayInDrawingMode(): boolean;
471
+ /** Copy the selected drawings (also Ctrl/⌘+C on the chart). Returns how many. */
472
+ copyDrawings(): number;
473
+ /**
474
+ * Paste copied drawings (also Ctrl/⌘+V) — from this chart or another one on
475
+ * the page. Returns the new drawings' ids.
476
+ */
477
+ pasteDrawings(): string[];
114
478
  setDrawingStyle(style: Partial<DrawingStyle>): void;
115
479
  getDrawingStyle(): DrawingStyle;
116
480
  getSelectedDrawingId(): string | null;
@@ -123,6 +487,8 @@ export declare class Chart {
123
487
  type: import('@tradecanvas/commons').DrawingToolType;
124
488
  anchors: import('@tradecanvas/commons').AnchorPoint[];
125
489
  style?: Partial<DrawingStyle>;
490
+ /** The tool's own settings (see `getDrawingOptionDefs`); its defaults fill the rest. */
491
+ options?: DrawingOptions;
126
492
  visible?: boolean;
127
493
  locked?: boolean;
128
494
  meta?: Record<string, unknown>;
@@ -133,43 +499,141 @@ export declare class Chart {
133
499
  */
134
500
  autoFib(): string | null;
135
501
  removeDrawing(id: string): void;
502
+ /** Remove several drawings as one undo step; locked ones stay. Returns how many went. */
503
+ removeDrawings(ids: readonly string[]): number;
504
+ /** A drawing tool's name, anchors, options and style fields; null for an unknown tool. */
505
+ getDrawingToolDescriptor(type: DrawingToolType): DrawingDescriptor | null;
506
+ /** The settings a drawing tool offers beyond the shared style (levels, extend…), with defaults. */
507
+ getDrawingOptionDefs(type: DrawingToolType): DrawingOptionDefs;
508
+ /** Every option of a drawing, its tool's defaults filled in. */
509
+ getDrawingOptions(id: string): DrawingOptions;
510
+ /** Change some of a drawing's options; invalid ones are dropped. False for an unknown drawing. */
511
+ setDrawingOptions(id: string, options: DrawingOptions): boolean;
512
+ /**
513
+ * Change a drawing's anchors (as many as it has), style or options, as one
514
+ * undo step — or as part of the edit begun with `beginDrawingEdit`.
515
+ * Applies to locked drawings too. False for an unknown drawing or wrong anchors.
516
+ */
517
+ updateDrawing(id: string, patch: DrawingPatch): boolean;
518
+ /** Start an edit (a settings dialog): the `updateDrawing` calls until `endDrawingEdit` are one undo step. */
519
+ beginDrawingEdit(id: string): boolean;
520
+ /** Keep the edit as one undo step, or with `cancel` put the drawing back as it was. */
521
+ endDrawingEdit(id: string, options?: {
522
+ cancel?: boolean;
523
+ }): void;
524
+ /** Options new drawings of `type` start with; null clears them. */
525
+ setDrawingToolDefaults(type: DrawingToolType, options: DrawingOptions | null): void;
526
+ getDrawingToolDefaults(type: DrawingToolType): DrawingOptions;
136
527
  setDrawingVisible(id: string, visible: boolean): void;
137
528
  setDrawingLocked(id: string, locked: boolean): void;
529
+ /** Show or hide several drawings (a selection, say) as one undo step. */
530
+ setDrawingsVisible(ids: readonly string[], visible: boolean): void;
531
+ /** Lock or unlock several drawings as one undo step. */
532
+ setDrawingsLocked(ids: readonly string[], locked: boolean): void;
138
533
  clearDrawings(): void;
139
534
  registerDrawingTool(plugin: DrawingPlugin): void;
140
535
  undo(): boolean;
141
536
  redo(): boolean;
537
+ /** Select a drawing (and the rest of its group); false for one it can't (unknown, hidden). */
538
+ selectDrawing(id: string): boolean;
142
539
  getUndoRedoState(): {
143
540
  canUndo: boolean;
144
541
  canRedo: boolean;
145
542
  };
543
+ /**
544
+ * Put a change of yours in the chart's undo history, with its drawings and
545
+ * indicators: undo (Ctrl/Cmd+Z) calls `undo`, redo calls `redo`. Call it
546
+ * after making the change. Changes about the same `subject` close together
547
+ * merge into one step (a colour dragged across a picker). Ignored when
548
+ * `features.drawingUndoRedo` is off.
549
+ */
550
+ recordUndo(step: {
551
+ undo: () => void;
552
+ redo: () => void;
553
+ subject?: string;
554
+ }): void;
555
+ /** The weak magnet on or off. Ignored (stays off) when `features.drawingMagnet` is false. */
146
556
  setDrawingMagnet(enabled: boolean): void;
557
+ /** Whether a magnet (weak or strong) is on. */
147
558
  getDrawingMagnet(): boolean;
559
+ /**
560
+ * Snap new anchors to the bar's open, high, low or close: 'weak' when the
561
+ * pointer is near one, 'strong' always. Stays off when
562
+ * `features.drawingMagnet` is false.
563
+ */
564
+ setDrawingMagnetMode(mode: 'off' | 'weak' | 'strong'): void;
565
+ getDrawingMagnetMode(): 'off' | 'weak' | 'strong';
566
+ /** The price and bar time at a right-click, as far as its area has them. */
567
+ private contextAt;
568
+ /** Show or hide the "+" by the price axis (`features.priceAxisAddButton`). */
569
+ setPriceAxisAddButton(visible: boolean): void;
570
+ /**
571
+ * The eraser: while on, clicking a drawing removes it (each one undoable).
572
+ * Picking a drawing tool or pressing Escape turns it off. `toolModeChange`
573
+ * reports `{ eraser }`.
574
+ */
575
+ setEraserMode(on: boolean): void;
576
+ isEraserMode(): boolean;
577
+ /**
578
+ * The zoom-area tool: the next drag draws a box and the chart zooms to its
579
+ * bars; then it turns itself off. `toolModeChange` reports `{ zoomArea }`.
580
+ */
581
+ setZoomAreaMode(on: boolean): void;
582
+ isZoomAreaMode(): boolean;
583
+ /** Zoom to the bars under a box dragged in zoom-area mode. */
584
+ private zoomToBox;
148
585
  lockAllDrawings(): void;
149
586
  unlockAllDrawings(): void;
150
587
  hideAllDrawings(): void;
151
588
  showAllDrawings(): void;
152
589
  duplicateDrawing(id?: string): string | null;
153
- exportVisibleData(format?: 'csv' | 'json', filename?: string): void;
154
- exportAllData(format?: 'csv' | 'json', filename?: string): void;
590
+ /** Does nothing when `features.dataExport` is false. */
591
+ /**
592
+ * Download the bars on screen as CSV or JSON, each indicator line in a
593
+ * column of its own (`indicators: false` leaves them out). Does nothing
594
+ * when `features.dataExport` is false.
595
+ */
596
+ exportVisibleData(format?: 'csv' | 'json', filename?: string, options?: {
597
+ indicators?: boolean;
598
+ }): void;
599
+ /** `exportVisibleData` for every bar loaded. Does nothing when `features.dataExport` is false. */
600
+ exportAllData(format?: 'csv' | 'json', filename?: string, options?: {
601
+ indicators?: boolean;
602
+ }): void;
603
+ /**
604
+ * The bars and their indicator lines, one column per line named as the
605
+ * legend names it ("SMA 20", "MACD 12 26 9 Signal"): every bar loaded, or
606
+ * those on screen (`range: 'visible'`).
607
+ */
608
+ getExportData(options?: {
609
+ range?: 'all' | 'visible';
610
+ indicators?: boolean;
611
+ }): {
612
+ bars: OHLCBar[];
613
+ columns: ExportColumn[];
614
+ };
615
+ /** `getExportData` as CSV or JSON text. */
616
+ getExportText(format?: 'csv' | 'json', options?: {
617
+ range?: 'all' | 'visible';
618
+ indicators?: boolean;
619
+ }): string;
620
+ private download;
155
621
  setAutoSave(key: string, delayMs?: number): void;
156
622
  disableAutoSave(): void;
157
623
  private scheduleAutoSave;
624
+ /** Something a saved layout holds changed: auto-save it, and say so. */
625
+ private markStateChanged;
626
+ private announceStateChange;
158
627
  getAvailableIndicators(): IndicatorDescriptor[];
159
628
  getIndicatorInputs(id: string): {
160
629
  id: string;
161
630
  params: Record<string, unknown>;
162
631
  } | null;
163
632
  /** Get all active indicator instances with their current params */
164
- getActiveIndicators(): {
165
- instanceId: string;
166
- id: string;
167
- params: Record<string, unknown>;
168
- descriptor: IndicatorDescriptor;
169
- visible: boolean;
170
- }[];
633
+ getActiveIndicators(): import('@tradecanvas/core').ActiveIndicatorInfo[];
171
634
  /** Show or hide an indicator without removing it. */
172
635
  setIndicatorVisible(instanceId: string, visible: boolean): void;
636
+ private setIndicatorVisibleNow;
173
637
  /** Get current config for a specific indicator instance */
174
638
  getIndicatorConfig(instanceId: string): {
175
639
  id: string;
@@ -181,6 +645,7 @@ export declare class Chart {
181
645
  lineWidths?: number[];
182
646
  opacity?: number;
183
647
  }): void;
648
+ private updateIndicatorStyleNow;
184
649
  setOrders(orders: TradingOrder[]): void;
185
650
  /**
186
651
  * Begin placing a draggable bracket order (entry + stop-loss + take-profit).
@@ -210,17 +675,50 @@ export declare class Chart {
210
675
  */
211
676
  placeOrderIntent(intent: import('@tradecanvas/commons').OrderPlaceIntent): void;
212
677
  setPositions(positions: TradingPosition[]): void;
678
+ /** The working orders on the chart (`setOrders`, or the execution adapter's). */
679
+ getOrders(): TradingOrder[];
680
+ /** The open positions on the chart (`setPositions`, or the execution adapter's). */
681
+ getPositions(): TradingPosition[];
682
+ /** Fills marked on the chart, oldest first: the execution adapter's, or `addFill`'s. */
683
+ getFills(): import('@tradecanvas/commons').FillEvent[];
684
+ /** The P&L the fills realised since the last `clearFills`, all of them (the marks keep the latest 1000). */
685
+ getRealisedPnl(): number;
686
+ /** Mark a fill on the chart (without an execution adapter, a host reports its own). */
687
+ addFill(fill: import('@tradecanvas/commons').FillEvent): void;
688
+ clearFills(): void;
689
+ /**
690
+ * Ask for an order to be cancelled: emits `orderCancel`, which an execution
691
+ * adapter carries out (as the × on the order's line does).
692
+ */
693
+ cancelOrderIntent(orderId: string): void;
694
+ /** Ask for a position to be closed: emits `positionClose`. */
695
+ closePositionIntent(positionId: string): void;
696
+ /** Ask for a position to be reversed (closed, then the same size the other way): emits `positionReverse`. */
697
+ reversePositionIntent(positionId: string): void;
698
+ /** Ask for a position's stop-loss or take-profit to change (null removes it): emits `positionModify`. */
699
+ modifyPositionIntent(intent: import('@tradecanvas/commons').PositionModifyIntent): void;
213
700
  setDepthData(depth: DepthData | null): void;
214
701
  setCurrentPrice(price: number, _pulseColor?: string): void;
702
+ /** Whether a paper account trades on the replay (it takes a mark price) rather than on the live price. */
703
+ private replayTrades;
704
+ /** The orders and the alerts follow a live price (a paper account in a replay follows the replay). */
705
+ private followLivePrice;
706
+ /**
707
+ * Alerts against a live price, and against the indicator lines they watch,
708
+ * all as of the same moment (a line crossing another compares like with
709
+ * like). During a replay they keep watching the live market: the bars are
710
+ * the live ones, and indicator lines — computed on the replayed bars — wait.
711
+ */
712
+ private checkAlerts;
215
713
  /**
216
- * Feed the latest indicator-line values to any indicator-channel alerts.
714
+ * The latest values of the indicator lines alerts watch or compare with.
217
715
  * Channel format: `<instanceId>:<key>`; instanceIds are `tc_<id>_<n>` and
218
716
  * built-in keys are colon-free, so the first colon splits them. Values come
219
717
  * from the recalculated series, so indicator alerts evaluate at bar cadence
220
718
  * (the live intrabar tick doesn't repaint closed-bar indicator values).
221
719
  * Cheap — only walks alerts whose channel isn't `'price'`, usually none.
222
720
  */
223
- private feedIndicatorAlerts;
721
+ private collectIndicatorValues;
224
722
  setTradingConfig(config: Partial<TradingConfig>): void;
225
723
  /**
226
724
  * Connect to a real-time data source.
@@ -235,12 +733,17 @@ export declare class Chart {
235
733
  * });
236
734
  */
237
735
  connect(config: StreamConfig): Promise<void>;
736
+ /** The stream's symbol and timeframe, told when they change. */
737
+ private setStreamTarget;
238
738
  /**
239
739
  * Switch symbol or timeframe on an active stream without full reconnect.
240
740
  */
241
741
  switchStream(symbol: string, timeframe: TimeFrame): Promise<void>;
742
+ /** False when `features.timeframes` is set and does not list `timeframe`. */
743
+ isTimeframeAllowed(timeframe: TimeFrame): boolean;
242
744
  /**
243
745
  * Switch to a new timeframe. Requires an active stream connection.
746
+ * Ignored when `features.timeframes` does not list it.
244
747
  * Internally calls switchStream with the current symbol.
245
748
  */
246
749
  setTimeframe(timeframe: TimeFrame): Promise<void>;
@@ -261,15 +764,21 @@ export declare class Chart {
261
764
  disconnectExecution(): void;
262
765
  /** The connected execution adapter, or null (e.g. for adapter-specific calls). */
263
766
  getExecutionAdapter(): ExecutionAdapter | null;
767
+ /** Ignored (stays hidden) when `features.barCountdown` is false. */
264
768
  setBarCountdownVisible(visible: boolean): void;
265
769
  setSessionBreaksVisible(visible: boolean): void;
770
+ /** Does nothing when `features.compareSymbols` is false. */
266
771
  addCompareSymbol(id: string, label: string, data: DataSeries, color: string): void;
267
772
  removeCompareSymbol(id: string): void;
268
773
  updateCompareData(id: string, data: DataSeries): void;
269
774
  setCompareMode(mode: 'percent' | 'absolute'): void;
270
775
  clearCompareSymbols(): void;
776
+ /** Turning it on is ignored when `features.logScale` is false. */
271
777
  setLogScale(enabled: boolean): void;
272
778
  isLogScale(): boolean;
779
+ /** Turn the price scale upside down: higher prices lower on screen. */
780
+ setInvertScale(inverted: boolean): void;
781
+ isInvertScale(): boolean;
273
782
  /**
274
783
  * Set the price-scale presentation: `regular`, `logarithmic`, `percentage`
275
784
  * (axis labels show % change from the first visible bar), or `indexedTo100`
@@ -286,7 +795,21 @@ export declare class Chart {
286
795
  getConnectionInfo(): ConnectionInfo;
287
796
  setAutoScroll(enabled: boolean): void;
288
797
  scrollTo(timestamp: number): void;
798
+ /**
799
+ * Centre the bar that contains `time` — in the bars' own unit, ms or s —
800
+ * (the first or last bar when `time` lies outside the data), keeping the zoom. Returns that bar's index, or -1
801
+ * without data.
802
+ */
803
+ goToTime(time: number): number;
804
+ /**
805
+ * Show a span that ends at the last bar: 1D, 5D, 1M, 3M, 6M, YTD, 1Y, 5Y or
806
+ * All. Months and YTD follow the calendar in the display timezone. Only
807
+ * loaded bars can be shown, so a span longer than the data shows all of it.
808
+ */
809
+ setVisibleRangePreset(preset: RangePreset): void;
289
810
  scrollToEnd(): void;
811
+ /** Scroll by `bars` bars: later for a positive count, earlier for a negative one. */
812
+ scrollBars(bars: number): void;
290
813
  /**
291
814
  * Show the bars between two timestamps edge to edge. Times past either end
292
815
  * of the data are allowed (they map into the empty future / past).
@@ -323,6 +846,12 @@ export declare class Chart {
323
846
  x: number;
324
847
  y: number;
325
848
  } | null): void;
849
+ /**
850
+ * Show a time-only crosshair — a vertical line and time label on the bar
851
+ * that contains `time` — as when mirroring another chart; null clears it.
852
+ * Fires no crosshair events, so linked charts don't echo each other.
853
+ */
854
+ setCrosshairTime(time: number | null): void;
326
855
  getData(): DataSeries;
327
856
  setGridVisible(visible: boolean): void;
328
857
  isGridVisible(): boolean;
@@ -365,10 +894,28 @@ export declare class Chart {
365
894
  isPeriodLevelsVisible(): boolean;
366
895
  setPeriodLevelsPeriod(period: import('@tradecanvas/core').LevelPeriod): void;
367
896
  /**
368
- * Set the timezone for time-axis labels and the crosshair time pill.
369
- * `null` = browser-local; a number = fixed UTC offset in minutes (e.g. -300
370
- * for EST, 330 for IST).
897
+ * The timezone for the time axis, crosshair, tooltip, day breaks and range
898
+ * presets: an IANA zone (`'America/New_York'`, daylight saving included), a
899
+ * fixed offset in minutes east of UTC (`-300`, `330`), or null for the
900
+ * browser's. Throws a RangeError for a zone the browser doesn't know.
901
+ */
902
+ setTimezone(tz: TimeZoneSetting): void;
903
+ /** What `setTimezone` was given — `'exchange'` included. */
904
+ getTimezone(): TimeZoneSetting;
905
+ /** The zone the chart shows: `'exchange'` resolved to the symbol's zone (UTC when unknown). */
906
+ getEffectiveTimezone(): TimeZoneSetting;
907
+ private applyTimezone;
908
+ /**
909
+ * What is known about the symbol on the chart — usually from the stream's
910
+ * adapter (`resolveSymbol`), which a connected chart asks by itself. Its
911
+ * price precision applies unless `setMarket` set one; its zone backs
912
+ * `setTimezone('exchange')`; its hours feed the session shading.
371
913
  */
914
+ setSymbolInfo(info: SymbolInfo | null): void;
915
+ getSymbolInfo(): SymbolInfo | null;
916
+ /** Ask the stream's adapter about `symbol`, if it can tell; a late answer about another symbol is dropped. */
917
+ private resolveStreamSymbol;
918
+ /** `setTimezone` with a fixed offset in minutes east of UTC, or null for the browser's zone. */
372
919
  setTimezoneOffset(minutes: number | null): void;
373
920
  setPivotMarkersVisible(visible: boolean): void;
374
921
  isPivotMarkersVisible(): boolean;
@@ -385,7 +932,7 @@ export declare class Chart {
385
932
  * `windows` for a split session — a market with a midday recess (e.g. SET's
386
933
  * 10:00–12:30 and 14:30–16:30) — so the lunch break dims like pre-/post-market.
387
934
  */
388
- setSessionShadingConfig(config: Partial<import('@tradecanvas/core').SessionHoursConfig>): void;
935
+ setSessionShadingConfig(config: Partial<SessionHoursConfig>): void;
389
936
  setTooltipVisible(visible: boolean): void;
390
937
  setLegend(config: Partial<import('@tradecanvas/core').LegendConfig>): void;
391
938
  setSymbolName(symbol: string): void;
@@ -399,11 +946,61 @@ export declare class Chart {
399
946
  copyScreenshot(): Promise<boolean>;
400
947
  screenshotDataURL(): string | null;
401
948
  screenshotBlob(): Promise<Blob | null>;
402
- addAlert(price: number, condition?: import('@tradecanvas/core').AlertCondition, message?: string, channel?: string, label?: string): string | null;
949
+ /**
950
+ * Add an alert on `channel` (`'price'`, or an indicator line
951
+ * `'<instanceId>:<key>'`) at `price`. `options` compare with another line
952
+ * instead (`target`), measure a move (`movesUp` / `movesDown` with
953
+ * `percent` and `bars`), look only at closed bars (`onBarClose`), or end it
954
+ * (`expiresAt`). Throws a RangeError for options that don't fit together.
955
+ */
956
+ addAlert(price: number, condition?: import('@tradecanvas/core').AlertCondition, message?: string, channel?: string, label?: string, options?: import('@tradecanvas/core').AlertOptions): string | null;
403
957
  removeAlert(id: string): void;
958
+ /** Ids of the selected drawings, the one clicked last first. */
959
+ getSelectedDrawingIds(): string[];
960
+ /** Draw a drawing on top of the others, under them, or one step up or down. False when already there. */
961
+ moveDrawing(id: string, to: DrawingOrderMove): boolean;
962
+ /** Group drawings (two or more): they are then selected, hidden and locked together. Returns the group id. */
963
+ groupDrawings(ids: readonly string[], name?: string): string | null;
964
+ ungroupDrawings(groupId: string): boolean;
965
+ renameDrawingGroup(groupId: string, name: string): boolean;
966
+ setDrawingGroupVisible(groupId: string, visible: boolean): boolean;
967
+ setDrawingGroupLocked(groupId: string, locked: boolean): boolean;
968
+ /** Every drawing group, its drawings bottom to top. */
969
+ getDrawingGroups(): {
970
+ id: string;
971
+ name: string;
972
+ ids: string[];
973
+ }[];
974
+ private afterDrawingChange;
975
+ /** Whether a drawing has lines an alert can cross (trend lines, rays, horizontals, channels). */
976
+ canAddDrawingAlert(drawingId: string): boolean;
977
+ /**
978
+ * Where a drawing's lines are at the latest bar, as drawn on the chart's
979
+ * scale; null when it has none there (a trend line that ends before it).
980
+ */
981
+ private drawingLevelsNow;
982
+ /**
983
+ * A drawing's alerts go with it, and come back with it when an undo
984
+ * brings the drawing back.
985
+ */
986
+ private followDrawingAlerts;
987
+ /** Remove alerts on drawings no longer on the chart (drawings replaced or cleared). */
988
+ private dropOrphanDrawingAlerts;
989
+ /**
990
+ * Alert when the price crosses a drawing's line(s): a trend line where it
991
+ * is at the latest bar, any line of a channel. Removed with the drawing.
992
+ * Null when the drawing has no line to cross.
993
+ */
994
+ addDrawingAlert(drawingId: string, options?: {
995
+ condition?: 'crossing' | 'crossingUp' | 'crossingDown';
996
+ message?: string;
997
+ repeating?: boolean;
998
+ label?: string;
999
+ }): string | null;
404
1000
  getAlerts(): import('@tradecanvas/core').PriceAlert[];
405
1001
  clearAlerts(): void;
406
1002
  saveAlerts(key: string): void;
1003
+ /** Load alerts saved with `saveAlerts`. Alerts on drawings that aren't on the chart are dropped. */
407
1004
  loadAlerts(key: string): void;
408
1005
  addSignalMarker(marker: Omit<import('@tradecanvas/commons').SignalMarker, 'id'> & {
409
1006
  id?: string;
@@ -422,10 +1019,53 @@ export declare class Chart {
422
1019
  setTradeZones(zones: import('@tradecanvas/commons').TradeZone[]): void;
423
1020
  clearTradeZones(): void;
424
1021
  setTradeZoneStyle(style: Partial<import('@tradecanvas/commons').TradeZoneStyle>): void;
1022
+ /**
1023
+ * Replay the series bar by bar. While it runs the chart is detached from
1024
+ * live data: stream ticks and `appendBar`/`updateLastBar` calls are kept
1025
+ * aside (orders still track the live price), the price line shows the
1026
+ * replayed close, and auto-scale refits every step. `replayStop()` brings
1027
+ * back the live series, including everything that arrived meanwhile.
1028
+ *
1029
+ * With `steps` (finer bars), each step grows the forming bar from them.
1030
+ * A connected execution adapter that takes a mark price (a paper one)
1031
+ * trades on the replayed price and time.
1032
+ */
425
1033
  replayStart(config?: Partial<import('@tradecanvas/core').ReplayConfig>): void;
1034
+ /** Jump the replay to show the bars (or finer steps) that opened before `time`. */
1035
+ replaySeekToTime(time: number): void;
1036
+ /** A replay step's price to an adapter that takes a mark (a paper account), and to the orders on the chart. */
1037
+ private feedReplayPrice;
1038
+ /** A paper account trading on the replay goes back to the live price (the orders too), and its fills to the clock. */
1039
+ private returnMarkToLive;
1040
+ /**
1041
+ * A paper account trades on the replayed prices and times, forward only:
1042
+ * it gets every step past the latest time it has seen (a jump ahead passes
1043
+ * them all, a long one in chunks), and nothing after a seek back or a
1044
+ * restart from an earlier bar until the replay is past that time again.
1045
+ */
1046
+ private feedReplaySteps;
1047
+ /**
1048
+ * The bar of the chart's series the replay is on (the forming one), or -1
1049
+ * without a replay.
1050
+ */
1051
+ getReplayBarIndex(): number;
1052
+ /** Jump the replay to the end of bar `barIndex` of the chart's series (a click on it). */
1053
+ replaySeekToBar(barIndex: number): void;
426
1054
  replayPause(): void;
427
1055
  replayResume(): void;
1056
+ /** End the replay and return to the live series (with updates that arrived meanwhile). */
428
1057
  replayStop(): void;
1058
+ /** Whether a replay session is open (playing or paused). */
1059
+ isReplayActive(): boolean;
1060
+ /** The plot area in CSS pixels, relative to the chart container (no axes). */
1061
+ getPlotRect(): {
1062
+ x: number;
1063
+ y: number;
1064
+ width: number;
1065
+ height: number;
1066
+ };
1067
+ /** Stop the replay clock and drop the session without touching the data. */
1068
+ private endReplaySession;
429
1069
  replaySeek(index: number): void;
430
1070
  setReplaySpeed(speed: number): void;
431
1071
  getReplayState(): 'playing' | 'paused' | 'stopped';
@@ -434,6 +1074,46 @@ export declare class Chart {
434
1074
  total: number;
435
1075
  percent: number;
436
1076
  };
1077
+ /** Everything `loadState` restores: chart type, theme, drawings, indicators, alerts. */
1078
+ private captureSnapshot;
1079
+ /**
1080
+ * Put `list` in place of the chart's indicators (a layout, a template, an
1081
+ * undo), with their panes as they were: size, order, fold, maximise.
1082
+ * `keepIds` keeps each instance's id (an undo): the indicators still alike
1083
+ * are changed in place, not taken down and put back. Otherwise the ids are
1084
+ * new and the map says old → new.
1085
+ */
1086
+ private restoreIndicators;
1087
+ /** An indicator's style, visibility and levels as `ind` has them, changing only what differs. */
1088
+ private restoreLooks;
1089
+ /** The panes as they were: size first (it opens a fold), then fold, order, maximise. */
1090
+ private restorePanes;
1091
+ /**
1092
+ * The chart's indicators as a layout or a template keeps them: inputs,
1093
+ * style, levels, scale and panes (shared, size, order, fold, maximise).
1094
+ */
1095
+ getIndicatorSetup(): import('@tradecanvas/core').SnapshotIndicator[];
1096
+ /**
1097
+ * Put a set of indicators (from `getIndicatorSetup`, a template) in place
1098
+ * of the chart's, as one undo step.
1099
+ */
1100
+ applyIndicatorSetup(list: readonly SnapshotIndicator[]): void;
1101
+ /**
1102
+ * Alerts on the lines of indicators that went (`before`: id → kind) move to
1103
+ * the one new indicator of the same kind (`added`), when there is just one;
1104
+ * others stay as they are, as alerts on a removed indicator do.
1105
+ */
1106
+ private followIndicatorAlerts;
1107
+ /** Run `change` without recording undo steps for the indicators it changes. */
1108
+ private withoutIndicatorHistory;
1109
+ /**
1110
+ * Run an indicator change as one undo step (the indicators before and
1111
+ * after). Quick changes to the same indicator (a colour dragged, a period
1112
+ * typed) merge into one step.
1113
+ */
1114
+ private recordIndicators;
1115
+ /** Undo or redo an indicator step: the indicators as they were, under their own ids. */
1116
+ private applyIndicatorStep;
437
1117
  saveState(key?: string): string | null;
438
1118
  loadState(json: string): void;
439
1119
  loadStateFromStorage(key: string): boolean;
@@ -448,6 +1128,8 @@ export declare class Chart {
448
1128
  setNumberLocale(locale: string): void;
449
1129
  getNumberLocale(): string;
450
1130
  setMarket(config: MarketConfig): void;
1131
+ /** Prices show `precision` decimals everywhere; null goes back to fitting the price range. */
1132
+ private applyPricePrecision;
451
1133
  getMarket(): MarketConfig | null;
452
1134
  setPriceLimits(referencePrice: number): void;
453
1135
  /** Get the resolved feature configuration */
@@ -459,6 +1141,16 @@ export declare class Chart {
459
1141
  private createChartRenderer;
460
1142
  /** Cached display data. Invalidated when raw data or chart type changes. */
461
1143
  private getDisplayData;
1144
+ /** Recompute indicators from bar `from` on, and say so (live ticks, closes, replay steps). */
1145
+ private recalcIndicatorsFrom;
1146
+ private recalcIndicators;
1147
+ /**
1148
+ * Emit `indicatorUpdate` once per task, from the earliest changed bar, after
1149
+ * the update that caused it has finished and scheduled its redraw: a
1150
+ * listener can neither interrupt a live tick nor read the layout before
1151
+ * the chart has updated it.
1152
+ */
1153
+ private announceIndicatorUpdate;
462
1154
  /** Lightweight render for streaming updates. No layout resolve, no indicator recalc. */
463
1155
  private scheduleRender;
464
1156
  /**
@@ -472,6 +1164,14 @@ export declare class Chart {
472
1164
  private applyDataToViewport;
473
1165
  /** Full update: resolve layout, update viewport, sync context, request render. */
474
1166
  private updateViewportAndRender;
1167
+ /**
1168
+ * Fit the data to the plot, then size both price scales to their labels. A
1169
+ * scale that changes width changes the plot, so the data is fit again —
1170
+ * before anything reads the layout for this frame.
1171
+ */
1172
+ private fitDataAndAxes;
1173
+ /** Size the left scale to its widest label; true when the layout changed. */
1174
+ private fitLeftAxisWidth;
475
1175
  /**
476
1176
  * Size the price axis to its widest label (tick labels, last-price tag,
477
1177
  * crosshair pill), as an auto-width scale — so a sub-cent
@@ -488,12 +1188,18 @@ export declare class Chart {
488
1188
  */
489
1189
  private emitViewportEvents;
490
1190
  private getResolvedLayout;
1191
+ /** The hovered bar is reported over the price pane and the panes above and below it. */
1192
+ private syncCrosshairBounds;
491
1193
  /** Cache container size for 500ms to avoid layout thrashing on rapid calls */
492
1194
  private cachedContainerSize;
493
1195
  private buildPanelRenderInfos;
1196
+ /** Where the time axis starts: below the main chart and every pane under it. */
1197
+ private timeAxisTop;
494
1198
  private syncRenderContext;
495
1199
  /** Draw registered overlay plugins for a layer (called by the engine). */
496
1200
  private drawOverlayPlugins;
497
1201
  private buildPriceLimits;
498
1202
  }
1203
+ type SnapshotIndicator = import('@tradecanvas/core').SnapshotIndicator;
1204
+ export {};
499
1205
  //# sourceMappingURL=Chart.d.ts.map