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