lightweight-charts-drawing 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +243 -0
- package/dist/index.d.ts +4017 -0
- package/dist/lightweight-charts-drawing.es.js +10616 -0
- package/dist/lightweight-charts-drawing.es.js.map +1 -0
- package/dist/lightweight-charts-drawing.umd.js +2 -0
- package/dist/lightweight-charts-drawing.umd.js.map +1 -0
- package/package.json +53 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4017 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lightweight-charts-drawing
|
|
3
|
+
*
|
|
4
|
+
* Drawing tools plugin for TradingView's lightweight-charts library.
|
|
5
|
+
* Provides professional-grade drawing tools including trend lines,
|
|
6
|
+
* Fibonacci retracements, channels, and more.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { AutoscaleInfo } from 'lightweight-charts';
|
|
12
|
+
import { Coordinate } from 'lightweight-charts';
|
|
13
|
+
import { IChartApi } from 'lightweight-charts';
|
|
14
|
+
import { IPrimitivePaneRenderer } from 'lightweight-charts';
|
|
15
|
+
import { IPrimitivePaneView } from 'lightweight-charts';
|
|
16
|
+
import { ISeriesApi } from 'lightweight-charts';
|
|
17
|
+
import { Logical } from 'lightweight-charts';
|
|
18
|
+
import { PrimitiveHoveredItem } from 'lightweight-charts';
|
|
19
|
+
import { SeriesType } from 'lightweight-charts';
|
|
20
|
+
import { Time } from 'lightweight-charts';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Anchor point in chart coordinates (time/price)
|
|
24
|
+
*/
|
|
25
|
+
export declare interface Anchor {
|
|
26
|
+
time: Time;
|
|
27
|
+
price: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Anchored Text - Text anchored to a specific point with a connector line.
|
|
32
|
+
*
|
|
33
|
+
* Features:
|
|
34
|
+
* - Two anchor points: anchor position and text position
|
|
35
|
+
* - Connector line between anchor and text
|
|
36
|
+
* - Customizable text styling
|
|
37
|
+
*/
|
|
38
|
+
export declare class AnchoredText extends Drawing {
|
|
39
|
+
readonly type = "anchored-text";
|
|
40
|
+
protected static readonly REQUIRED_ANCHORS = 2;
|
|
41
|
+
protected static readonly HIT_THRESHOLD = 10;
|
|
42
|
+
private _textOptions;
|
|
43
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<AnchoredTextOptions>);
|
|
44
|
+
get textOptions(): AnchoredTextOptions;
|
|
45
|
+
setTextOptions(options: Partial<AnchoredTextOptions>): void;
|
|
46
|
+
setText(text: string): void;
|
|
47
|
+
getText(): string;
|
|
48
|
+
isValid(): boolean;
|
|
49
|
+
paneViews(): IPrimitivePaneView[];
|
|
50
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
51
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
52
|
+
clone(newId: string): IDrawing;
|
|
53
|
+
static create(id: string, anchorPoint: Anchor, textPoint: Anchor, text: string, style?: Partial<DrawingStyle>, options?: Partial<AnchoredTextOptions>): AnchoredText;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Anchored Text options
|
|
58
|
+
*/
|
|
59
|
+
export declare interface AnchoredTextOptions extends DrawingOptions {
|
|
60
|
+
text?: string;
|
|
61
|
+
fontSize?: number;
|
|
62
|
+
fontFamily?: string;
|
|
63
|
+
fontWeight?: string;
|
|
64
|
+
textAlign?: CanvasTextAlign;
|
|
65
|
+
showConnector?: boolean;
|
|
66
|
+
connectorLength?: number;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export declare class AnchoredTextPaneView implements IPrimitivePaneView {
|
|
70
|
+
private _renderer;
|
|
71
|
+
constructor(drawing: AnchoredText);
|
|
72
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
73
|
+
renderer(): IPrimitivePaneRenderer;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* AndrewsPitchfork - Andrews' Pitchfork pattern for channel analysis.
|
|
78
|
+
*
|
|
79
|
+
* Features:
|
|
80
|
+
* - Three anchor points (pivot, and two swing points)
|
|
81
|
+
* - Median line from pivot through midpoint of swings
|
|
82
|
+
* - Parallel outer lines through swing points
|
|
83
|
+
* - Optional fill between lines
|
|
84
|
+
*/
|
|
85
|
+
export declare class AndrewsPitchfork extends Drawing {
|
|
86
|
+
readonly type = "andrews-pitchfork";
|
|
87
|
+
protected static readonly REQUIRED_ANCHORS = 3;
|
|
88
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
89
|
+
private _pitchforkOptions;
|
|
90
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<AndrewsPitchforkOptions>);
|
|
91
|
+
get pitchforkOptions(): AndrewsPitchforkOptions;
|
|
92
|
+
setPitchforkOptions(options: Partial<AndrewsPitchforkOptions>): void;
|
|
93
|
+
isValid(): boolean;
|
|
94
|
+
paneViews(): IPrimitivePaneView[];
|
|
95
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
96
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
97
|
+
clone(newId: string): IDrawing;
|
|
98
|
+
static create(id: string, pivot: Anchor, swing1: Anchor, swing2: Anchor, style?: Partial<DrawingStyle>, options?: Partial<AndrewsPitchforkOptions>): AndrewsPitchfork;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* AndrewsPitchfork options
|
|
103
|
+
*/
|
|
104
|
+
export declare interface AndrewsPitchforkOptions extends DrawingOptions {
|
|
105
|
+
showMedianLine?: boolean;
|
|
106
|
+
showOuterLines?: boolean;
|
|
107
|
+
extendLines?: boolean;
|
|
108
|
+
filled?: boolean;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export declare class AndrewsPitchforkPaneView implements IPrimitivePaneView {
|
|
112
|
+
private _renderer;
|
|
113
|
+
constructor(drawing: AndrewsPitchfork);
|
|
114
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
115
|
+
renderer(): IPrimitivePaneRenderer;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Set up canvas context with drawing style
|
|
120
|
+
*/
|
|
121
|
+
export declare function applyStyle(ctx: CanvasRenderingContext2D, style: DrawingStyle, pixelRatio?: number): void;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Arc - A circular arc defined by three points.
|
|
125
|
+
*
|
|
126
|
+
* Features:
|
|
127
|
+
* - Three anchor points: center, start point (defines radius and start angle), end point (defines end angle)
|
|
128
|
+
* - Optional fill (pie slice)
|
|
129
|
+
* - Draws the shorter arc between start and end angles
|
|
130
|
+
*/
|
|
131
|
+
export declare class Arc extends Drawing {
|
|
132
|
+
readonly type = "arc";
|
|
133
|
+
protected static readonly REQUIRED_ANCHORS = 3;
|
|
134
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
135
|
+
private _arcOptions;
|
|
136
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<ArcOptions>);
|
|
137
|
+
get arcOptions(): ArcOptions;
|
|
138
|
+
setArcOptions(options: Partial<ArcOptions>): void;
|
|
139
|
+
isValid(): boolean;
|
|
140
|
+
paneViews(): IPrimitivePaneView[];
|
|
141
|
+
/**
|
|
142
|
+
* Get arc parameters from the three anchor points
|
|
143
|
+
*/
|
|
144
|
+
getArcParams(viewport: Viewport): {
|
|
145
|
+
center: Point;
|
|
146
|
+
radius: number;
|
|
147
|
+
startAngle: number;
|
|
148
|
+
endAngle: number;
|
|
149
|
+
} | null;
|
|
150
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
151
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
152
|
+
clone(newId: string): IDrawing;
|
|
153
|
+
static create(id: string, center: Anchor, startPoint: Anchor, endPoint: Anchor, style?: Partial<DrawingStyle>, options?: Partial<ArcOptions>): Arc;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Arc/circle geometry
|
|
158
|
+
*/
|
|
159
|
+
export declare interface ArcGeometry {
|
|
160
|
+
type: 'arc';
|
|
161
|
+
center: Point;
|
|
162
|
+
radius: number;
|
|
163
|
+
startAngle: number;
|
|
164
|
+
endAngle: number;
|
|
165
|
+
counterClockwise?: boolean;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Arc options
|
|
170
|
+
*/
|
|
171
|
+
export declare interface ArcOptions extends DrawingOptions {
|
|
172
|
+
filled?: boolean;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export declare class ArcPaneView implements IPrimitivePaneView {
|
|
176
|
+
private _renderer;
|
|
177
|
+
constructor(drawing: Arc);
|
|
178
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
179
|
+
renderer(): IPrimitivePaneRenderer;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Arrow - A line with an arrowhead at the end.
|
|
184
|
+
*
|
|
185
|
+
* Features:
|
|
186
|
+
* - Two anchor points
|
|
187
|
+
* - Arrowhead at the end point
|
|
188
|
+
* - Optional arrowhead at both ends
|
|
189
|
+
* - Configurable arrow size
|
|
190
|
+
*/
|
|
191
|
+
export declare class Arrow extends BaseLine {
|
|
192
|
+
readonly type = "arrow";
|
|
193
|
+
private _arrowOptions;
|
|
194
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<ArrowOptions>);
|
|
195
|
+
get arrowOptions(): ArrowOptions;
|
|
196
|
+
setArrowOptions(options: Partial<ArrowOptions>): void;
|
|
197
|
+
paneViews(): IPrimitivePaneView[];
|
|
198
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
199
|
+
clone(newId: string): IDrawing;
|
|
200
|
+
static create(id: string, startAnchor: Anchor, endAnchor: Anchor, style?: Partial<DrawingStyle>, options?: Partial<ArrowOptions>): Arrow;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Arrow direction
|
|
205
|
+
*/
|
|
206
|
+
export declare type ArrowDirection = 'up' | 'down' | 'left' | 'right';
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Arrow Mark Down - A downward pointing arrow marker (bearish signal).
|
|
210
|
+
*
|
|
211
|
+
* Features:
|
|
212
|
+
* - Single anchor point
|
|
213
|
+
* - Always points down
|
|
214
|
+
* - Typically placed above price bars
|
|
215
|
+
* - Red color by default
|
|
216
|
+
*/
|
|
217
|
+
export declare class ArrowMarkDown extends Drawing {
|
|
218
|
+
readonly type = "arrow-mark-down";
|
|
219
|
+
protected static readonly REQUIRED_ANCHORS = 1;
|
|
220
|
+
protected static readonly HIT_THRESHOLD = 10;
|
|
221
|
+
private _arrowOptions;
|
|
222
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<ArrowMarkDownOptions>);
|
|
223
|
+
get arrowOptions(): ArrowMarkDownOptions;
|
|
224
|
+
setArrowOptions(options: Partial<ArrowMarkDownOptions>): void;
|
|
225
|
+
isValid(): boolean;
|
|
226
|
+
paneViews(): IPrimitivePaneView[];
|
|
227
|
+
/**
|
|
228
|
+
* Get arrow vertices (always points down)
|
|
229
|
+
*/
|
|
230
|
+
getArrowVertices(viewport: Viewport): Point[] | null;
|
|
231
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
232
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
233
|
+
private pointInTriangle;
|
|
234
|
+
clone(newId: string): IDrawing;
|
|
235
|
+
static create(id: string, position: Anchor, style?: Partial<DrawingStyle>, options?: Partial<ArrowMarkDownOptions>): ArrowMarkDown;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Arrow Mark Down options
|
|
240
|
+
*/
|
|
241
|
+
export declare interface ArrowMarkDownOptions extends DrawingOptions {
|
|
242
|
+
size?: number;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export declare class ArrowMarkDownPaneView implements IPrimitivePaneView {
|
|
246
|
+
private _renderer;
|
|
247
|
+
constructor(drawing: ArrowMarkDown);
|
|
248
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
249
|
+
renderer(): IPrimitivePaneRenderer;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Arrow Marker - A directional arrow placed at a single point.
|
|
254
|
+
*
|
|
255
|
+
* Features:
|
|
256
|
+
* - Single anchor point
|
|
257
|
+
* - Configurable direction (up, down, left, right)
|
|
258
|
+
* - Configurable size
|
|
259
|
+
* - Optional fill
|
|
260
|
+
*/
|
|
261
|
+
export declare class ArrowMarker extends Drawing {
|
|
262
|
+
readonly type = "arrow-marker";
|
|
263
|
+
protected static readonly REQUIRED_ANCHORS = 1;
|
|
264
|
+
protected static readonly HIT_THRESHOLD = 10;
|
|
265
|
+
private _arrowOptions;
|
|
266
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<ArrowMarkerOptions>);
|
|
267
|
+
get arrowOptions(): ArrowMarkerOptions;
|
|
268
|
+
setArrowOptions(options: Partial<ArrowMarkerOptions>): void;
|
|
269
|
+
isValid(): boolean;
|
|
270
|
+
paneViews(): IPrimitivePaneView[];
|
|
271
|
+
/**
|
|
272
|
+
* Get arrow vertices based on position and direction
|
|
273
|
+
*/
|
|
274
|
+
getArrowVertices(viewport: Viewport): Point[] | null;
|
|
275
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
276
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
277
|
+
private pointInTriangle;
|
|
278
|
+
clone(newId: string): IDrawing;
|
|
279
|
+
static create(id: string, position: Anchor, style?: Partial<DrawingStyle>, options?: Partial<ArrowMarkerOptions>): ArrowMarker;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Arrow marker options
|
|
284
|
+
*/
|
|
285
|
+
export declare interface ArrowMarkerOptions extends DrawingOptions {
|
|
286
|
+
direction?: ArrowDirection;
|
|
287
|
+
size?: number;
|
|
288
|
+
filled?: boolean;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export declare class ArrowMarkerPaneView implements IPrimitivePaneView {
|
|
292
|
+
private _renderer;
|
|
293
|
+
constructor(drawing: ArrowMarker);
|
|
294
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
295
|
+
renderer(): IPrimitivePaneRenderer;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Arrow Mark Up - An upward pointing arrow marker (bullish signal).
|
|
300
|
+
*
|
|
301
|
+
* Features:
|
|
302
|
+
* - Single anchor point
|
|
303
|
+
* - Always points up
|
|
304
|
+
* - Typically placed below price bars
|
|
305
|
+
* - Green color by default
|
|
306
|
+
*/
|
|
307
|
+
export declare class ArrowMarkUp extends Drawing {
|
|
308
|
+
readonly type = "arrow-mark-up";
|
|
309
|
+
protected static readonly REQUIRED_ANCHORS = 1;
|
|
310
|
+
protected static readonly HIT_THRESHOLD = 10;
|
|
311
|
+
private _arrowOptions;
|
|
312
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<ArrowMarkUpOptions>);
|
|
313
|
+
get arrowOptions(): ArrowMarkUpOptions;
|
|
314
|
+
setArrowOptions(options: Partial<ArrowMarkUpOptions>): void;
|
|
315
|
+
isValid(): boolean;
|
|
316
|
+
paneViews(): IPrimitivePaneView[];
|
|
317
|
+
/**
|
|
318
|
+
* Get arrow vertices (always points up)
|
|
319
|
+
*/
|
|
320
|
+
getArrowVertices(viewport: Viewport): Point[] | null;
|
|
321
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
322
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
323
|
+
private pointInTriangle;
|
|
324
|
+
clone(newId: string): IDrawing;
|
|
325
|
+
static create(id: string, position: Anchor, style?: Partial<DrawingStyle>, options?: Partial<ArrowMarkUpOptions>): ArrowMarkUp;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Arrow Mark Up options
|
|
330
|
+
*/
|
|
331
|
+
export declare interface ArrowMarkUpOptions extends DrawingOptions {
|
|
332
|
+
size?: number;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export declare class ArrowMarkUpPaneView implements IPrimitivePaneView {
|
|
336
|
+
private _renderer;
|
|
337
|
+
constructor(drawing: ArrowMarkUp);
|
|
338
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
339
|
+
renderer(): IPrimitivePaneRenderer;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Arrow options
|
|
344
|
+
*/
|
|
345
|
+
export declare interface ArrowOptions extends DrawingOptions {
|
|
346
|
+
arrowSize?: number;
|
|
347
|
+
showBothEnds?: boolean;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export declare class ArrowPaneView implements IPrimitivePaneView {
|
|
351
|
+
private _renderer;
|
|
352
|
+
constructor(drawing: Arrow);
|
|
353
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
354
|
+
renderer(): IPrimitivePaneRenderer;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* BarsPattern - Pattern projection tool.
|
|
359
|
+
*
|
|
360
|
+
* Features:
|
|
361
|
+
* - Three anchor points: pattern start (A), pattern end (B), projection start (C)
|
|
362
|
+
* - Copies the price pattern from A-B and projects it from C
|
|
363
|
+
* - Shows the projected pattern zone
|
|
364
|
+
*/
|
|
365
|
+
export declare class BarsPattern extends Drawing {
|
|
366
|
+
readonly type = "bars-pattern";
|
|
367
|
+
protected static readonly REQUIRED_ANCHORS = 3;
|
|
368
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
369
|
+
private _barsPatternOptions;
|
|
370
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<BarsPatternOptions>);
|
|
371
|
+
get barsPatternOptions(): BarsPatternOptions;
|
|
372
|
+
setBarsPatternOptions(options: Partial<BarsPatternOptions>): void;
|
|
373
|
+
/**
|
|
374
|
+
* Get pattern info.
|
|
375
|
+
* A = pattern start, B = pattern end, C = projection start.
|
|
376
|
+
* The pattern from A-B is projected starting at C.
|
|
377
|
+
*/
|
|
378
|
+
getPatternInfo(): {
|
|
379
|
+
priceRange: number;
|
|
380
|
+
timeSpan: number;
|
|
381
|
+
projectedEndPrice: number;
|
|
382
|
+
};
|
|
383
|
+
isValid(): boolean;
|
|
384
|
+
paneViews(): IPrimitivePaneView[];
|
|
385
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
386
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
387
|
+
clone(newId: string): IDrawing;
|
|
388
|
+
static create(id: string, pointA: Anchor, pointB: Anchor, pointC: Anchor, style?: Partial<DrawingStyle>, options?: Partial<BarsPatternOptions>): BarsPattern;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Bars Pattern options
|
|
393
|
+
*/
|
|
394
|
+
export declare interface BarsPatternOptions extends DrawingOptions {
|
|
395
|
+
showLabels?: boolean;
|
|
396
|
+
filled?: boolean;
|
|
397
|
+
patternColor?: string;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export declare class BarsPatternPaneView implements IPrimitivePaneView {
|
|
401
|
+
private _renderer;
|
|
402
|
+
constructor(drawing: BarsPattern);
|
|
403
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
404
|
+
renderer(): IPrimitivePaneRenderer;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Base class for two-point line drawings.
|
|
409
|
+
* Provides common functionality for trend lines, rays, arrows, etc.
|
|
410
|
+
*/
|
|
411
|
+
export declare abstract class BaseLine extends Drawing {
|
|
412
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
413
|
+
protected static readonly REQUIRED_ANCHORS = 2;
|
|
414
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<DrawingOptions>);
|
|
415
|
+
isValid(): boolean;
|
|
416
|
+
paneViews(): IPrimitivePaneView[];
|
|
417
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
418
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
419
|
+
/**
|
|
420
|
+
* Convert a Time value to epoch seconds.
|
|
421
|
+
* Handles numeric timestamps, "YYYY-MM-DD" strings, and BusinessDay objects.
|
|
422
|
+
*/
|
|
423
|
+
protected static timeToSeconds(time: any): number;
|
|
424
|
+
/**
|
|
425
|
+
* Get the angle of the line in degrees
|
|
426
|
+
*/
|
|
427
|
+
getAngle(): number;
|
|
428
|
+
/**
|
|
429
|
+
* Get the price change between anchors
|
|
430
|
+
*/
|
|
431
|
+
getPriceChange(): {
|
|
432
|
+
absolute: number;
|
|
433
|
+
percentage: number;
|
|
434
|
+
};
|
|
435
|
+
/**
|
|
436
|
+
* Get the time span between anchors in bars (calendar days)
|
|
437
|
+
*/
|
|
438
|
+
getTimeSpan(): number;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Brush - Freehand drawing tool.
|
|
443
|
+
*
|
|
444
|
+
* Features:
|
|
445
|
+
* - Multiple anchor points forming a path
|
|
446
|
+
* - Variable brush size
|
|
447
|
+
* - Smooth line rendering
|
|
448
|
+
*/
|
|
449
|
+
export declare class Brush extends Drawing {
|
|
450
|
+
readonly type = "brush";
|
|
451
|
+
protected static readonly REQUIRED_ANCHORS = 2;
|
|
452
|
+
protected static readonly HIT_THRESHOLD = 10;
|
|
453
|
+
private _brushOptions;
|
|
454
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<BrushOptions>);
|
|
455
|
+
get brushOptions(): BrushOptions;
|
|
456
|
+
setBrushOptions(options: Partial<BrushOptions>): void;
|
|
457
|
+
/**
|
|
458
|
+
* Add a point to the brush path
|
|
459
|
+
*/
|
|
460
|
+
addPoint(anchor: Anchor): void;
|
|
461
|
+
isValid(): boolean;
|
|
462
|
+
paneViews(): IPrimitivePaneView[];
|
|
463
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
464
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
465
|
+
clone(newId: string): IDrawing;
|
|
466
|
+
static create(id: string, points: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<BrushOptions>): Brush;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Brush options
|
|
471
|
+
*/
|
|
472
|
+
export declare interface BrushOptions extends DrawingOptions {
|
|
473
|
+
brushSize?: number;
|
|
474
|
+
smoothing?: number;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
export declare class BrushPaneView implements IPrimitivePaneView {
|
|
478
|
+
private _renderer;
|
|
479
|
+
constructor(drawing: Brush);
|
|
480
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
481
|
+
renderer(): IPrimitivePaneRenderer;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Calculate price change percentage between two prices
|
|
486
|
+
*/
|
|
487
|
+
export declare function calculatePriceChange(startPrice: number, endPrice: number): {
|
|
488
|
+
change: number;
|
|
489
|
+
percentage: number;
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Callout - A text box with a pointer to a specific point.
|
|
494
|
+
*
|
|
495
|
+
* Features:
|
|
496
|
+
* - Two anchor points (target and box position)
|
|
497
|
+
* - Text box with pointer/arrow to target
|
|
498
|
+
* - Customizable appearance
|
|
499
|
+
*/
|
|
500
|
+
export declare class Callout extends Drawing {
|
|
501
|
+
readonly type = "callout";
|
|
502
|
+
protected static readonly REQUIRED_ANCHORS = 2;
|
|
503
|
+
protected static readonly HIT_THRESHOLD = 10;
|
|
504
|
+
private _calloutOptions;
|
|
505
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<CalloutOptions>);
|
|
506
|
+
get calloutOptions(): CalloutOptions;
|
|
507
|
+
setCalloutOptions(options: Partial<CalloutOptions>): void;
|
|
508
|
+
setText(text: string): void;
|
|
509
|
+
getText(): string;
|
|
510
|
+
isValid(): boolean;
|
|
511
|
+
paneViews(): IPrimitivePaneView[];
|
|
512
|
+
computeGeometry(_viewport: Viewport): Geometry[];
|
|
513
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
514
|
+
clone(newId: string): IDrawing;
|
|
515
|
+
static create(id: string, target: Anchor, boxPosition: Anchor, text: string, style?: Partial<DrawingStyle>, options?: Partial<CalloutOptions>): Callout;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Callout options
|
|
520
|
+
*/
|
|
521
|
+
export declare interface CalloutOptions extends DrawingOptions {
|
|
522
|
+
text?: string;
|
|
523
|
+
fontSize?: number;
|
|
524
|
+
fontFamily?: string;
|
|
525
|
+
backgroundColor?: string;
|
|
526
|
+
borderColor?: string;
|
|
527
|
+
padding?: number;
|
|
528
|
+
pointerSize?: number;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
export declare class CalloutPaneView implements IPrimitivePaneView {
|
|
532
|
+
private _renderer;
|
|
533
|
+
constructor(drawing: Callout);
|
|
534
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
535
|
+
renderer(): IPrimitivePaneRenderer;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Chart to pixel coordinate conversion function
|
|
540
|
+
*/
|
|
541
|
+
export declare type ChartToPixelFn = (anchor: Anchor) => Point | null;
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* Circle - A circular shape defined by center and edge point.
|
|
545
|
+
*
|
|
546
|
+
* Features:
|
|
547
|
+
* - Two anchor points (center and edge)
|
|
548
|
+
* - Radius determined by distance between points
|
|
549
|
+
* - Optional fill
|
|
550
|
+
*/
|
|
551
|
+
export declare class Circle extends Drawing {
|
|
552
|
+
readonly type = "circle";
|
|
553
|
+
protected static readonly REQUIRED_ANCHORS = 2;
|
|
554
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
555
|
+
private _circleOptions;
|
|
556
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<CircleOptions>);
|
|
557
|
+
get circleOptions(): CircleOptions;
|
|
558
|
+
setCircleOptions(options: Partial<CircleOptions>): void;
|
|
559
|
+
isValid(): boolean;
|
|
560
|
+
paneViews(): IPrimitivePaneView[];
|
|
561
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
562
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
563
|
+
/**
|
|
564
|
+
* Get the radius in pixels (requires viewport)
|
|
565
|
+
*/
|
|
566
|
+
getRadius(viewport: Viewport): number;
|
|
567
|
+
clone(newId: string): IDrawing;
|
|
568
|
+
static create(id: string, center: Anchor, edge: Anchor, style?: Partial<DrawingStyle>, options?: Partial<CircleOptions>): Circle;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Circle options
|
|
573
|
+
*/
|
|
574
|
+
export declare interface CircleOptions extends DrawingOptions {
|
|
575
|
+
filled?: boolean;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
export declare class CirclePaneView implements IPrimitivePaneView {
|
|
579
|
+
private _renderer;
|
|
580
|
+
constructor(drawing: Circle);
|
|
581
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
582
|
+
renderer(): IPrimitivePaneRenderer;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* Comment - A speech-bubble style comment marker.
|
|
587
|
+
*
|
|
588
|
+
* Features:
|
|
589
|
+
* - Single anchor point
|
|
590
|
+
* - Speech bubble with text
|
|
591
|
+
* - Customizable colors
|
|
592
|
+
*/
|
|
593
|
+
declare class Comment_2 extends Drawing {
|
|
594
|
+
readonly type = "comment";
|
|
595
|
+
protected static readonly REQUIRED_ANCHORS = 1;
|
|
596
|
+
protected static readonly HIT_THRESHOLD = 15;
|
|
597
|
+
private _commentOptions;
|
|
598
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<CommentOptions>);
|
|
599
|
+
get commentOptions(): CommentOptions;
|
|
600
|
+
setCommentOptions(options: Partial<CommentOptions>): void;
|
|
601
|
+
setText(text: string): void;
|
|
602
|
+
getText(): string;
|
|
603
|
+
isValid(): boolean;
|
|
604
|
+
paneViews(): IPrimitivePaneView[];
|
|
605
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
606
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
607
|
+
clone(newId: string): IDrawing;
|
|
608
|
+
static create(id: string, position: Anchor, text: string, style?: Partial<DrawingStyle>, options?: Partial<CommentOptions>): Comment_2;
|
|
609
|
+
}
|
|
610
|
+
export { Comment_2 as Comment }
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* Comment options
|
|
614
|
+
*/
|
|
615
|
+
export declare interface CommentOptions extends DrawingOptions {
|
|
616
|
+
text?: string;
|
|
617
|
+
fontSize?: number;
|
|
618
|
+
backgroundColor?: string;
|
|
619
|
+
textColor?: string;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
export declare class CommentPaneView implements IPrimitivePaneView {
|
|
623
|
+
private _renderer;
|
|
624
|
+
constructor(drawing: Comment_2);
|
|
625
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
626
|
+
renderer(): IPrimitivePaneRenderer;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* Control point for anchor manipulation
|
|
631
|
+
*/
|
|
632
|
+
export declare interface ControlPoint {
|
|
633
|
+
index: number;
|
|
634
|
+
x: number;
|
|
635
|
+
y: number;
|
|
636
|
+
radius: number;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* CrossLine - A crosshair at a specific point (horizontal + vertical lines).
|
|
641
|
+
*
|
|
642
|
+
* Features:
|
|
643
|
+
* - Single anchor point
|
|
644
|
+
* - Horizontal and vertical lines through the point
|
|
645
|
+
* - Optional price and time labels
|
|
646
|
+
*/
|
|
647
|
+
export declare class CrossLine extends Drawing {
|
|
648
|
+
readonly type = "cross-line";
|
|
649
|
+
protected static readonly REQUIRED_ANCHORS = 1;
|
|
650
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
651
|
+
private _crossLineOptions;
|
|
652
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<CrossLineOptions>);
|
|
653
|
+
get crossLineOptions(): CrossLineOptions;
|
|
654
|
+
setCrossLineOptions(options: Partial<CrossLineOptions>): void;
|
|
655
|
+
isValid(): boolean;
|
|
656
|
+
paneViews(): IPrimitivePaneView[];
|
|
657
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
658
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
659
|
+
clone(newId: string): IDrawing;
|
|
660
|
+
static create(id: string, anchor: Anchor, style?: Partial<DrawingStyle>, options?: Partial<CrossLineOptions>): CrossLine;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* CrossLine options
|
|
665
|
+
*/
|
|
666
|
+
export declare interface CrossLineOptions extends DrawingOptions {
|
|
667
|
+
showPrice?: boolean;
|
|
668
|
+
showTime?: boolean;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
export declare class CrossLinePaneView implements IPrimitivePaneView {
|
|
672
|
+
private _renderer;
|
|
673
|
+
constructor(drawing: CrossLine);
|
|
674
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
675
|
+
renderer(): IPrimitivePaneRenderer;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* Curve - Cubic Bezier curve with two endpoints and two control points.
|
|
680
|
+
*
|
|
681
|
+
* Features:
|
|
682
|
+
* - Four anchor points: start, control1, control2, end
|
|
683
|
+
* - Smooth curve using cubic bezier interpolation
|
|
684
|
+
* - Optional control line visualization
|
|
685
|
+
*/
|
|
686
|
+
export declare class Curve extends Drawing {
|
|
687
|
+
readonly type = "curve";
|
|
688
|
+
protected static readonly REQUIRED_ANCHORS = 4;
|
|
689
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
690
|
+
private _curveOptions;
|
|
691
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<CurveOptions>);
|
|
692
|
+
get curveOptions(): CurveOptions;
|
|
693
|
+
setCurveOptions(options: Partial<CurveOptions>): void;
|
|
694
|
+
isValid(): boolean;
|
|
695
|
+
paneViews(): IPrimitivePaneView[];
|
|
696
|
+
/**
|
|
697
|
+
* Get points along the bezier curve
|
|
698
|
+
*/
|
|
699
|
+
getCurvePoints(viewport: Viewport): Point[] | null;
|
|
700
|
+
/**
|
|
701
|
+
* Get the control points for visualization
|
|
702
|
+
*/
|
|
703
|
+
getControlPointsPixels(viewport: Viewport): {
|
|
704
|
+
start: Point;
|
|
705
|
+
control1: Point;
|
|
706
|
+
control2: Point;
|
|
707
|
+
end: Point;
|
|
708
|
+
} | null;
|
|
709
|
+
private cubicBezier;
|
|
710
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
711
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
712
|
+
private distanceToSegment;
|
|
713
|
+
clone(newId: string): IDrawing;
|
|
714
|
+
static create(id: string, start: Anchor, control1: Anchor, control2: Anchor, end: Anchor, style?: Partial<DrawingStyle>, options?: Partial<CurveOptions>): Curve;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* Curve options
|
|
719
|
+
*/
|
|
720
|
+
export declare interface CurveOptions extends DrawingOptions {
|
|
721
|
+
showControlLines?: boolean;
|
|
722
|
+
resolution?: number;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
export declare class CurvePaneView implements IPrimitivePaneView {
|
|
726
|
+
private _renderer;
|
|
727
|
+
constructor(drawing: Curve);
|
|
728
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
729
|
+
renderer(): IPrimitivePaneRenderer;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* DatePriceRange - Combined date and price measurement tool.
|
|
734
|
+
*
|
|
735
|
+
* Features:
|
|
736
|
+
* - Two anchor points (diagonal corners)
|
|
737
|
+
* - Shows price change (absolute and percentage)
|
|
738
|
+
* - Shows time change (bars and days)
|
|
739
|
+
* - Rectangular measurement zone
|
|
740
|
+
*/
|
|
741
|
+
export declare class DatePriceRange extends Drawing {
|
|
742
|
+
readonly type = "date-price-range";
|
|
743
|
+
protected static readonly REQUIRED_ANCHORS = 2;
|
|
744
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
745
|
+
private _measureOptions;
|
|
746
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<DatePriceRangeOptions>);
|
|
747
|
+
get measureOptions(): DatePriceRangeOptions;
|
|
748
|
+
setMeasureOptions(options: Partial<DatePriceRangeOptions>): void;
|
|
749
|
+
isValid(): boolean;
|
|
750
|
+
paneViews(): IPrimitivePaneView[];
|
|
751
|
+
/**
|
|
752
|
+
* Get measurement info
|
|
753
|
+
*/
|
|
754
|
+
getMeasureInfo(): {
|
|
755
|
+
startPrice: number;
|
|
756
|
+
endPrice: number;
|
|
757
|
+
priceChange: number;
|
|
758
|
+
priceChangePercent: number;
|
|
759
|
+
startTime: any;
|
|
760
|
+
endTime: any;
|
|
761
|
+
days: number;
|
|
762
|
+
bars: number;
|
|
763
|
+
isUp: boolean;
|
|
764
|
+
};
|
|
765
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
766
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
767
|
+
clone(newId: string): IDrawing;
|
|
768
|
+
static create(id: string, start: Anchor, end: Anchor, style?: Partial<DrawingStyle>, options?: Partial<DatePriceRangeOptions>): DatePriceRange;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
/**
|
|
772
|
+
* DatePriceRange options
|
|
773
|
+
*/
|
|
774
|
+
export declare interface DatePriceRangeOptions extends DrawingOptions {
|
|
775
|
+
showPrices?: boolean;
|
|
776
|
+
showPercentage?: boolean;
|
|
777
|
+
showBars?: boolean;
|
|
778
|
+
showDays?: boolean;
|
|
779
|
+
filled?: boolean;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
export declare class DatePriceRangePaneView implements IPrimitivePaneView {
|
|
783
|
+
private _renderer;
|
|
784
|
+
constructor(drawing: DatePriceRange);
|
|
785
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
786
|
+
renderer(): IPrimitivePaneRenderer;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* DateRange - Time measurement tool.
|
|
791
|
+
*
|
|
792
|
+
* Features:
|
|
793
|
+
* - Two anchor points for start and end time
|
|
794
|
+
* - Shows number of bars between points
|
|
795
|
+
* - Shows number of calendar days
|
|
796
|
+
* - Highlighted time zone
|
|
797
|
+
*/
|
|
798
|
+
export declare class DateRange extends Drawing {
|
|
799
|
+
readonly type = "date-range";
|
|
800
|
+
protected static readonly REQUIRED_ANCHORS = 2;
|
|
801
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
802
|
+
private _dateRangeOptions;
|
|
803
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<DateRangeOptions>);
|
|
804
|
+
get dateRangeOptions(): DateRangeOptions;
|
|
805
|
+
setDateRangeOptions(options: Partial<DateRangeOptions>): void;
|
|
806
|
+
isValid(): boolean;
|
|
807
|
+
paneViews(): IPrimitivePaneView[];
|
|
808
|
+
/**
|
|
809
|
+
* Get date range info
|
|
810
|
+
*/
|
|
811
|
+
getDateRangeInfo(): {
|
|
812
|
+
startTime: any;
|
|
813
|
+
endTime: any;
|
|
814
|
+
days: number;
|
|
815
|
+
bars: number;
|
|
816
|
+
};
|
|
817
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
818
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
819
|
+
clone(newId: string): IDrawing;
|
|
820
|
+
static create(id: string, start: Anchor, end: Anchor, style?: Partial<DrawingStyle>, options?: Partial<DateRangeOptions>): DateRange;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* DateRange options
|
|
825
|
+
*/
|
|
826
|
+
export declare interface DateRangeOptions extends DrawingOptions {
|
|
827
|
+
showBars?: boolean;
|
|
828
|
+
showDays?: boolean;
|
|
829
|
+
showDates?: boolean;
|
|
830
|
+
filled?: boolean;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
export declare class DateRangePaneView implements IPrimitivePaneView {
|
|
834
|
+
private _renderer;
|
|
835
|
+
constructor(drawing: DateRange);
|
|
836
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
837
|
+
renderer(): IPrimitivePaneRenderer;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
* Default drawing style
|
|
842
|
+
*/
|
|
843
|
+
export declare const DEFAULT_DRAWING_STYLE: DrawingStyle;
|
|
844
|
+
|
|
845
|
+
/**
|
|
846
|
+
* DisjointChannel - A channel with two independent lines that don't have to be parallel.
|
|
847
|
+
*
|
|
848
|
+
* Features:
|
|
849
|
+
* - Four anchor points: two for upper line, two for lower line
|
|
850
|
+
* - Lines can be at any angle (not necessarily parallel)
|
|
851
|
+
* - Optional fill between lines
|
|
852
|
+
* - Optional middle line
|
|
853
|
+
* - Optional line extensions
|
|
854
|
+
*
|
|
855
|
+
* Points:
|
|
856
|
+
* - Anchor 0-1: First line
|
|
857
|
+
* - Anchor 2-3: Second line
|
|
858
|
+
*/
|
|
859
|
+
export declare class DisjointChannel extends Drawing {
|
|
860
|
+
readonly type = "disjoint-channel";
|
|
861
|
+
protected static readonly REQUIRED_ANCHORS = 4;
|
|
862
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
863
|
+
private _channelOptions;
|
|
864
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<DisjointChannelOptions>);
|
|
865
|
+
get channelOptions(): DisjointChannelOptions;
|
|
866
|
+
setChannelOptions(options: Partial<DisjointChannelOptions>): void;
|
|
867
|
+
isValid(): boolean;
|
|
868
|
+
paneViews(): IPrimitivePaneView[];
|
|
869
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
870
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
871
|
+
private isPointInPolygon;
|
|
872
|
+
clone(newId: string): IDrawing;
|
|
873
|
+
static create(id: string, line1Start: Anchor, line1End: Anchor, line2Start: Anchor, line2End: Anchor, style?: Partial<DrawingStyle>, options?: Partial<DisjointChannelOptions>): DisjointChannel;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
/**
|
|
877
|
+
* DisjointChannel options
|
|
878
|
+
*/
|
|
879
|
+
export declare interface DisjointChannelOptions extends DrawingOptions {
|
|
880
|
+
filled?: boolean;
|
|
881
|
+
extendLines?: boolean;
|
|
882
|
+
showMiddleLine?: boolean;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
export declare class DisjointChannelPaneView implements IPrimitivePaneView {
|
|
886
|
+
private _renderer;
|
|
887
|
+
constructor(drawing: DisjointChannel);
|
|
888
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
889
|
+
renderer(): IPrimitivePaneRenderer;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
/**
|
|
893
|
+
* Calculate distance between two points
|
|
894
|
+
*/
|
|
895
|
+
export declare function distanceBetweenPoints(p1: Point, p2: Point): number;
|
|
896
|
+
|
|
897
|
+
/**
|
|
898
|
+
* Calculate distance from point to infinite line
|
|
899
|
+
*/
|
|
900
|
+
export declare function distanceToLine(point: Point, lineStart: Point, lineEnd: Point): number;
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* Calculate distance from point to line segment
|
|
904
|
+
*/
|
|
905
|
+
export declare function distanceToLineSegment(point: Point, lineStart: Point, lineEnd: Point): number;
|
|
906
|
+
|
|
907
|
+
/**
|
|
908
|
+
* DoubleCurve - S-curve with two control points creating an S-shape.
|
|
909
|
+
*
|
|
910
|
+
* Features:
|
|
911
|
+
* - Three anchor points: start, middle (inflection), end
|
|
912
|
+
* - Automatic control point calculation for smooth S-curve
|
|
913
|
+
* - Adjustable curvature
|
|
914
|
+
*/
|
|
915
|
+
export declare class DoubleCurve extends Drawing {
|
|
916
|
+
readonly type = "double-curve";
|
|
917
|
+
protected static readonly REQUIRED_ANCHORS = 3;
|
|
918
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
919
|
+
private _doubleCurveOptions;
|
|
920
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<DoubleCurveOptions>);
|
|
921
|
+
get doubleCurveOptions(): DoubleCurveOptions;
|
|
922
|
+
setDoubleCurveOptions(options: Partial<DoubleCurveOptions>): void;
|
|
923
|
+
isValid(): boolean;
|
|
924
|
+
paneViews(): IPrimitivePaneView[];
|
|
925
|
+
/**
|
|
926
|
+
* Get the three main points
|
|
927
|
+
*/
|
|
928
|
+
getMainPoints(viewport: Viewport): {
|
|
929
|
+
start: Point;
|
|
930
|
+
middle: Point;
|
|
931
|
+
end: Point;
|
|
932
|
+
} | null;
|
|
933
|
+
/**
|
|
934
|
+
* Calculate bezier control points for the S-curve
|
|
935
|
+
*/
|
|
936
|
+
getBezierControlPoints(viewport: Viewport): {
|
|
937
|
+
cp1: Point;
|
|
938
|
+
cp2: Point;
|
|
939
|
+
cp3: Point;
|
|
940
|
+
cp4: Point;
|
|
941
|
+
} | null;
|
|
942
|
+
/**
|
|
943
|
+
* Get points along the S-curve
|
|
944
|
+
*/
|
|
945
|
+
getCurvePoints(viewport: Viewport): Point[] | null;
|
|
946
|
+
private cubicBezier;
|
|
947
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
948
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
949
|
+
private distanceToSegment;
|
|
950
|
+
clone(newId: string): IDrawing;
|
|
951
|
+
static create(id: string, start: Anchor, middle: Anchor, end: Anchor, style?: Partial<DrawingStyle>, options?: Partial<DoubleCurveOptions>): DoubleCurve;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* Double Curve options
|
|
956
|
+
*/
|
|
957
|
+
export declare interface DoubleCurveOptions extends DrawingOptions {
|
|
958
|
+
showControlPoints?: boolean;
|
|
959
|
+
curvature?: number;
|
|
960
|
+
resolution?: number;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
export declare class DoubleCurvePaneView implements IPrimitivePaneView {
|
|
964
|
+
private _renderer;
|
|
965
|
+
constructor(drawing: DoubleCurve);
|
|
966
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
967
|
+
renderer(): IPrimitivePaneRenderer;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
/**
|
|
971
|
+
* Draw an arrow head at the end of a line
|
|
972
|
+
*/
|
|
973
|
+
export declare function drawArrowHead(ctx: CanvasRenderingContext2D, from: Point, to: Point, size?: number, pixelRatio?: number): void;
|
|
974
|
+
|
|
975
|
+
/**
|
|
976
|
+
* Draw a circle
|
|
977
|
+
*/
|
|
978
|
+
export declare function drawCircle(ctx: CanvasRenderingContext2D, center: Point, radius: number, fill?: boolean, pixelRatio?: number): void;
|
|
979
|
+
|
|
980
|
+
/**
|
|
981
|
+
* Draw a control point (anchor handle) in TradingView style:
|
|
982
|
+
* dark filled center with a colored ring.
|
|
983
|
+
*/
|
|
984
|
+
export declare function drawControlPoint(ctx: CanvasRenderingContext2D, point: ControlPoint, isActive?: boolean, pixelRatio?: number, lineColor?: string): void;
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* Draw all control points for a drawing
|
|
988
|
+
*/
|
|
989
|
+
export declare function drawControlPoints(ctx: CanvasRenderingContext2D, points: ControlPoint[], activeIndex?: number | null, pixelRatio?: number, lineColor?: string): void;
|
|
990
|
+
|
|
991
|
+
/**
|
|
992
|
+
* Draw a dashed line between two points
|
|
993
|
+
*/
|
|
994
|
+
export declare function drawDashedLine(ctx: CanvasRenderingContext2D, start: Point, end: Point, dashPattern?: number[], pixelRatio?: number): void;
|
|
995
|
+
|
|
996
|
+
/**
|
|
997
|
+
* Draw a filled arrow head
|
|
998
|
+
*/
|
|
999
|
+
export declare function drawFilledArrowHead(ctx: CanvasRenderingContext2D, from: Point, to: Point, size?: number, pixelRatio?: number): void;
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* Abstract base class for all drawing tools.
|
|
1003
|
+
* Implements ISeriesPrimitive for integration with lightweight-charts.
|
|
1004
|
+
*/
|
|
1005
|
+
export declare abstract class Drawing implements IDrawing {
|
|
1006
|
+
readonly id: string;
|
|
1007
|
+
abstract readonly type: string;
|
|
1008
|
+
protected _anchors: Anchor[];
|
|
1009
|
+
protected _style: DrawingStyle;
|
|
1010
|
+
protected _options: DrawingOptions;
|
|
1011
|
+
protected _state: DrawingState;
|
|
1012
|
+
protected _series: ISeriesApi<SeriesType> | null;
|
|
1013
|
+
protected _chart: IChartApi | null;
|
|
1014
|
+
protected _container: HTMLElement | null;
|
|
1015
|
+
protected _requestUpdateFn: (() => void) | null;
|
|
1016
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<DrawingOptions>);
|
|
1017
|
+
get anchors(): Anchor[];
|
|
1018
|
+
get style(): DrawingStyle;
|
|
1019
|
+
get options(): DrawingOptions;
|
|
1020
|
+
get state(): DrawingState;
|
|
1021
|
+
set anchors(value: Anchor[]);
|
|
1022
|
+
set style(value: DrawingStyle);
|
|
1023
|
+
set options(value: DrawingOptions);
|
|
1024
|
+
set state(value: DrawingState);
|
|
1025
|
+
attach(series: ISeriesApi<SeriesType>, chart: IChartApi, container?: HTMLElement): void;
|
|
1026
|
+
detach(): void;
|
|
1027
|
+
isAttached(): boolean;
|
|
1028
|
+
requestUpdate(): void;
|
|
1029
|
+
attached(params: {
|
|
1030
|
+
chart: IChartApi;
|
|
1031
|
+
series: ISeriesApi<SeriesType>;
|
|
1032
|
+
requestUpdate: () => void;
|
|
1033
|
+
}): void;
|
|
1034
|
+
detached(): void;
|
|
1035
|
+
/**
|
|
1036
|
+
* Returns pane views for rendering. Must be implemented by subclasses.
|
|
1037
|
+
*/
|
|
1038
|
+
abstract paneViews(): IPrimitivePaneView[];
|
|
1039
|
+
/**
|
|
1040
|
+
* Optional: Provide hit testing for the primitive (lightweight-charts interface)
|
|
1041
|
+
*/
|
|
1042
|
+
hitTest(x: number, y: number): PrimitiveHoveredItem | null;
|
|
1043
|
+
/**
|
|
1044
|
+
* Optional: Provide autoscale info
|
|
1045
|
+
*/
|
|
1046
|
+
autoscaleInfo(): AutoscaleInfo | null;
|
|
1047
|
+
setAnchors(anchors: Anchor[]): void;
|
|
1048
|
+
updateAnchor(index: number, anchor: Anchor): void;
|
|
1049
|
+
updateStyle(style: Partial<DrawingStyle>): void;
|
|
1050
|
+
updateOptions(options: Partial<DrawingOptions>): void;
|
|
1051
|
+
setState(state: DrawingState): void;
|
|
1052
|
+
/**
|
|
1053
|
+
* Test if point hits the drawing. Must be implemented by subclasses.
|
|
1054
|
+
*/
|
|
1055
|
+
abstract testHit(point: Point, viewport: Viewport): boolean;
|
|
1056
|
+
/**
|
|
1057
|
+
* Test if point hits an anchor control point
|
|
1058
|
+
*/
|
|
1059
|
+
hitTestAnchor(point: Point, viewport: Viewport): number | null;
|
|
1060
|
+
/**
|
|
1061
|
+
* Get control points for anchor manipulation
|
|
1062
|
+
*/
|
|
1063
|
+
getControlPoints(viewport: Viewport): ControlPoint[];
|
|
1064
|
+
anchorToPixel(anchor: Anchor, viewport: Viewport): Point | null;
|
|
1065
|
+
protected pixelToAnchor(point: Point, viewport: Viewport): Anchor | null;
|
|
1066
|
+
getViewport(): Viewport | null;
|
|
1067
|
+
/**
|
|
1068
|
+
* Compute geometry for rendering. Must be implemented by subclasses.
|
|
1069
|
+
*/
|
|
1070
|
+
abstract computeGeometry(viewport: Viewport): Geometry[];
|
|
1071
|
+
/**
|
|
1072
|
+
* Check if drawing is valid (has required anchors). Must be implemented by subclasses.
|
|
1073
|
+
*/
|
|
1074
|
+
abstract isValid(): boolean;
|
|
1075
|
+
toJSON(): SerializedDrawing;
|
|
1076
|
+
fromJSON(data: SerializedDrawing): void;
|
|
1077
|
+
/**
|
|
1078
|
+
* Create a clone of this drawing. Must be implemented by subclasses.
|
|
1079
|
+
*/
|
|
1080
|
+
abstract clone(newId: string): IDrawing;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
/**
|
|
1084
|
+
* Drawing categories for organization
|
|
1085
|
+
*/
|
|
1086
|
+
export declare type DrawingCategory = 'line' | 'channel' | 'fibonacci' | 'gann' | 'pitchfork' | 'shape' | 'annotation' | 'trading' | 'forecasting' | 'measurement';
|
|
1087
|
+
|
|
1088
|
+
/**
|
|
1089
|
+
* Drawing event payload
|
|
1090
|
+
*/
|
|
1091
|
+
export declare interface DrawingEvent {
|
|
1092
|
+
type: DrawingEventType;
|
|
1093
|
+
drawingId?: string;
|
|
1094
|
+
drawing?: IDrawing;
|
|
1095
|
+
toolType?: string;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
/**
|
|
1099
|
+
* Event callback type
|
|
1100
|
+
*/
|
|
1101
|
+
export declare type DrawingEventCallback = (event: DrawingEvent) => void;
|
|
1102
|
+
|
|
1103
|
+
/**
|
|
1104
|
+
* Event types emitted by DrawingManager
|
|
1105
|
+
*/
|
|
1106
|
+
export declare type DrawingEventType = 'drawing:added' | 'drawing:removed' | 'drawing:selected' | 'drawing:deselected' | 'drawing:updated' | 'drawing:cleared' | 'tool:changed';
|
|
1107
|
+
|
|
1108
|
+
/**
|
|
1109
|
+
* DrawingManager - Central orchestration system for managing drawings.
|
|
1110
|
+
*
|
|
1111
|
+
* Responsibilities:
|
|
1112
|
+
* - Creating, storing, removing drawings
|
|
1113
|
+
* - Attaching/detaching to chart series
|
|
1114
|
+
* - Hit detection and selection
|
|
1115
|
+
* - Interaction state management
|
|
1116
|
+
* - JSON import/export
|
|
1117
|
+
* - Event emission
|
|
1118
|
+
*/
|
|
1119
|
+
export declare class DrawingManager {
|
|
1120
|
+
private _drawings;
|
|
1121
|
+
private _selectedId;
|
|
1122
|
+
private _chart;
|
|
1123
|
+
private _series;
|
|
1124
|
+
private _container;
|
|
1125
|
+
private _listeners;
|
|
1126
|
+
private _isAttached;
|
|
1127
|
+
private _activeTool;
|
|
1128
|
+
private _isDragging;
|
|
1129
|
+
private _dragAnchorIndex;
|
|
1130
|
+
constructor();
|
|
1131
|
+
/**
|
|
1132
|
+
* Attach manager to a chart and series
|
|
1133
|
+
*/
|
|
1134
|
+
attach(chart: IChartApi, series: ISeriesApi<SeriesType>, container: HTMLElement): void;
|
|
1135
|
+
/**
|
|
1136
|
+
* Detach manager from chart
|
|
1137
|
+
*/
|
|
1138
|
+
detach(): void;
|
|
1139
|
+
/**
|
|
1140
|
+
* Check if manager is attached
|
|
1141
|
+
*/
|
|
1142
|
+
isAttached(): boolean;
|
|
1143
|
+
/**
|
|
1144
|
+
* Add a drawing to the manager
|
|
1145
|
+
*/
|
|
1146
|
+
addDrawing(drawing: IDrawing): void;
|
|
1147
|
+
/**
|
|
1148
|
+
* Remove a drawing by id
|
|
1149
|
+
*/
|
|
1150
|
+
removeDrawing(id: string): void;
|
|
1151
|
+
/**
|
|
1152
|
+
* Get a drawing by id
|
|
1153
|
+
*/
|
|
1154
|
+
getDrawing(id: string): IDrawing | undefined;
|
|
1155
|
+
/**
|
|
1156
|
+
* Get all drawings
|
|
1157
|
+
*/
|
|
1158
|
+
getAllDrawings(): IDrawing[];
|
|
1159
|
+
/**
|
|
1160
|
+
* Clear all drawings
|
|
1161
|
+
*/
|
|
1162
|
+
clearAll(): void;
|
|
1163
|
+
/**
|
|
1164
|
+
* Select a drawing by id
|
|
1165
|
+
*/
|
|
1166
|
+
selectDrawing(id: string): void;
|
|
1167
|
+
/**
|
|
1168
|
+
* Deselect all drawings
|
|
1169
|
+
*/
|
|
1170
|
+
deselectAll(): void;
|
|
1171
|
+
/**
|
|
1172
|
+
* Get selected drawing
|
|
1173
|
+
*/
|
|
1174
|
+
getSelectedDrawing(): IDrawing | null;
|
|
1175
|
+
/**
|
|
1176
|
+
* Set the active drawing tool
|
|
1177
|
+
*/
|
|
1178
|
+
setActiveTool(toolType: string | null): void;
|
|
1179
|
+
/**
|
|
1180
|
+
* Get the active drawing tool
|
|
1181
|
+
*/
|
|
1182
|
+
getActiveTool(): string | null;
|
|
1183
|
+
/**
|
|
1184
|
+
* Find drawing at point
|
|
1185
|
+
*/
|
|
1186
|
+
hitTest(point: Point): IDrawing | null;
|
|
1187
|
+
/**
|
|
1188
|
+
* Find anchor at point for selected drawing
|
|
1189
|
+
*/
|
|
1190
|
+
hitTestAnchor(point: Point): number | null;
|
|
1191
|
+
private handleClick;
|
|
1192
|
+
private handleMouseDown;
|
|
1193
|
+
private handleMouseMove;
|
|
1194
|
+
private handleMouseUp;
|
|
1195
|
+
private getPointFromEvent;
|
|
1196
|
+
private getViewport;
|
|
1197
|
+
/**
|
|
1198
|
+
* Export all drawings as JSON
|
|
1199
|
+
*/
|
|
1200
|
+
exportDrawings(): SerializedDrawing[];
|
|
1201
|
+
/**
|
|
1202
|
+
* Import drawings from JSON (requires a factory function)
|
|
1203
|
+
*/
|
|
1204
|
+
importDrawings(data: SerializedDrawing[], factory: (type: string, data: SerializedDrawing) => IDrawing | null): void;
|
|
1205
|
+
/**
|
|
1206
|
+
* Subscribe to an event
|
|
1207
|
+
*/
|
|
1208
|
+
on(event: DrawingEventType, callback: DrawingEventCallback): () => void;
|
|
1209
|
+
/**
|
|
1210
|
+
* Emit an event
|
|
1211
|
+
*/
|
|
1212
|
+
private emit;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
/**
|
|
1216
|
+
* Drawing options beyond style
|
|
1217
|
+
*/
|
|
1218
|
+
export declare interface DrawingOptions {
|
|
1219
|
+
visible?: boolean;
|
|
1220
|
+
locked?: boolean;
|
|
1221
|
+
zIndex?: number;
|
|
1222
|
+
extendLeft?: boolean;
|
|
1223
|
+
extendRight?: boolean;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
/**
|
|
1227
|
+
* Pane view implementation for Drawing primitives
|
|
1228
|
+
*/
|
|
1229
|
+
export declare class DrawingPaneView implements IPrimitivePaneView {
|
|
1230
|
+
private _renderer;
|
|
1231
|
+
constructor(drawing: Drawing);
|
|
1232
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
1233
|
+
renderer(): IPrimitivePaneRenderer;
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
/**
|
|
1237
|
+
* Drawing state for selection/editing
|
|
1238
|
+
*/
|
|
1239
|
+
export declare type DrawingState = 'normal' | 'hovered' | 'selected' | 'editing';
|
|
1240
|
+
|
|
1241
|
+
/**
|
|
1242
|
+
* Visual style for drawings
|
|
1243
|
+
*/
|
|
1244
|
+
export declare interface DrawingStyle {
|
|
1245
|
+
lineColor: string;
|
|
1246
|
+
lineWidth: number;
|
|
1247
|
+
lineDash?: number[];
|
|
1248
|
+
fillColor?: string;
|
|
1249
|
+
fillOpacity?: number;
|
|
1250
|
+
showLabels?: boolean;
|
|
1251
|
+
labelFont?: string;
|
|
1252
|
+
labelColor?: string;
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
/**
|
|
1256
|
+
* Drawing tool metadata for registration
|
|
1257
|
+
*/
|
|
1258
|
+
export declare interface DrawingToolDefinition {
|
|
1259
|
+
type: string;
|
|
1260
|
+
name: string;
|
|
1261
|
+
category: DrawingCategory;
|
|
1262
|
+
icon?: string;
|
|
1263
|
+
shortcut?: string;
|
|
1264
|
+
requiredAnchors: number;
|
|
1265
|
+
defaultStyle?: Partial<DrawingStyle>;
|
|
1266
|
+
defaultOptions?: Partial<DrawingOptions>;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
/**
|
|
1270
|
+
* Draw a label with background
|
|
1271
|
+
*/
|
|
1272
|
+
export declare function drawLabel(ctx: CanvasRenderingContext2D, text: string, position: Point, style?: {
|
|
1273
|
+
font?: string;
|
|
1274
|
+
textColor?: string;
|
|
1275
|
+
backgroundColor?: string;
|
|
1276
|
+
padding?: number;
|
|
1277
|
+
borderRadius?: number;
|
|
1278
|
+
}, pixelRatio?: number): void;
|
|
1279
|
+
|
|
1280
|
+
/**
|
|
1281
|
+
* Draw a line between two points
|
|
1282
|
+
*/
|
|
1283
|
+
export declare function drawLine(ctx: CanvasRenderingContext2D, start: Point, end: Point, pixelRatio?: number): void;
|
|
1284
|
+
|
|
1285
|
+
/**
|
|
1286
|
+
* Draw a rectangle
|
|
1287
|
+
*/
|
|
1288
|
+
export declare function drawRect(ctx: CanvasRenderingContext2D, topLeft: Point, width: number, height: number, fill?: boolean, pixelRatio?: number): void;
|
|
1289
|
+
|
|
1290
|
+
/**
|
|
1291
|
+
* Draw text at a position
|
|
1292
|
+
*/
|
|
1293
|
+
export declare function drawText(ctx: CanvasRenderingContext2D, text: string, position: Point, font?: string, color?: string, align?: CanvasTextAlign, baseline?: CanvasTextBaseline, pixelRatio?: number): void;
|
|
1294
|
+
|
|
1295
|
+
/**
|
|
1296
|
+
* Ellipse - An elliptical shape defined by two corner points of bounding box.
|
|
1297
|
+
*
|
|
1298
|
+
* Features:
|
|
1299
|
+
* - Two anchor points (opposite corners of bounding rectangle)
|
|
1300
|
+
* - Optional fill
|
|
1301
|
+
* - Axis-aligned ellipse
|
|
1302
|
+
*/
|
|
1303
|
+
export declare class Ellipse extends Drawing {
|
|
1304
|
+
readonly type = "ellipse";
|
|
1305
|
+
protected static readonly REQUIRED_ANCHORS = 2;
|
|
1306
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
1307
|
+
private _ellipseOptions;
|
|
1308
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<EllipseOptions>);
|
|
1309
|
+
get ellipseOptions(): EllipseOptions;
|
|
1310
|
+
setEllipseOptions(options: Partial<EllipseOptions>): void;
|
|
1311
|
+
isValid(): boolean;
|
|
1312
|
+
paneViews(): IPrimitivePaneView[];
|
|
1313
|
+
/**
|
|
1314
|
+
* Get ellipse parameters
|
|
1315
|
+
*/
|
|
1316
|
+
getEllipseParams(viewport: Viewport): {
|
|
1317
|
+
center: Point;
|
|
1318
|
+
radiusX: number;
|
|
1319
|
+
radiusY: number;
|
|
1320
|
+
} | null;
|
|
1321
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
1322
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
1323
|
+
clone(newId: string): IDrawing;
|
|
1324
|
+
static create(id: string, corner1: Anchor, corner2: Anchor, style?: Partial<DrawingStyle>, options?: Partial<EllipseOptions>): Ellipse;
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
/**
|
|
1328
|
+
* Ellipse options
|
|
1329
|
+
*/
|
|
1330
|
+
export declare interface EllipseOptions extends DrawingOptions {
|
|
1331
|
+
filled?: boolean;
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
export declare class EllipsePaneView implements IPrimitivePaneView {
|
|
1335
|
+
private _renderer;
|
|
1336
|
+
constructor(drawing: Ellipse);
|
|
1337
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
1338
|
+
renderer(): IPrimitivePaneRenderer;
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
/**
|
|
1342
|
+
* ExtendedLine - A line that extends infinitely in both directions.
|
|
1343
|
+
*
|
|
1344
|
+
* Features:
|
|
1345
|
+
* - Two anchor points define the line
|
|
1346
|
+
* - Extends infinitely in both directions
|
|
1347
|
+
* - Optional angle display
|
|
1348
|
+
*/
|
|
1349
|
+
export declare class ExtendedLine extends BaseLine {
|
|
1350
|
+
readonly type = "extended-line";
|
|
1351
|
+
private _extendedLineOptions;
|
|
1352
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<ExtendedLineOptions>);
|
|
1353
|
+
get extendedLineOptions(): ExtendedLineOptions;
|
|
1354
|
+
setExtendedLineOptions(options: Partial<ExtendedLineOptions>): void;
|
|
1355
|
+
paneViews(): IPrimitivePaneView[];
|
|
1356
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
1357
|
+
clone(newId: string): IDrawing;
|
|
1358
|
+
static create(id: string, startAnchor: Anchor, endAnchor: Anchor, style?: Partial<DrawingStyle>, options?: Partial<ExtendedLineOptions>): ExtendedLine;
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
/**
|
|
1362
|
+
* ExtendedLine options
|
|
1363
|
+
*/
|
|
1364
|
+
export declare interface ExtendedLineOptions extends DrawingOptions {
|
|
1365
|
+
showAngle?: boolean;
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
export declare class ExtendedLinePaneView implements IPrimitivePaneView {
|
|
1369
|
+
private _renderer;
|
|
1370
|
+
constructor(drawing: ExtendedLine);
|
|
1371
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
1372
|
+
renderer(): IPrimitivePaneRenderer;
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
/**
|
|
1376
|
+
* Extend line to viewport boundaries
|
|
1377
|
+
*/
|
|
1378
|
+
export declare function extendLineToViewport(start: Point, end: Point, viewportWidth: number, viewportHeight: number, extendLeft: boolean, extendRight: boolean): {
|
|
1379
|
+
start: Point;
|
|
1380
|
+
end: Point;
|
|
1381
|
+
};
|
|
1382
|
+
|
|
1383
|
+
/**
|
|
1384
|
+
* Fibonacci arc levels
|
|
1385
|
+
*/
|
|
1386
|
+
export declare const FIB_ARC_LEVELS: number[];
|
|
1387
|
+
|
|
1388
|
+
/**
|
|
1389
|
+
* Standard Fibonacci channel levels
|
|
1390
|
+
*/
|
|
1391
|
+
export declare const FIB_CHANNEL_LEVELS: number[];
|
|
1392
|
+
|
|
1393
|
+
/**
|
|
1394
|
+
* Fibonacci circle levels
|
|
1395
|
+
*/
|
|
1396
|
+
export declare const FIB_CIRCLE_LEVELS: number[];
|
|
1397
|
+
|
|
1398
|
+
/**
|
|
1399
|
+
* Standard Fibonacci extension levels
|
|
1400
|
+
*/
|
|
1401
|
+
export declare const FIB_EXTENSION_LEVELS: number[];
|
|
1402
|
+
|
|
1403
|
+
/**
|
|
1404
|
+
* Fibonacci speed fan ratios
|
|
1405
|
+
*/
|
|
1406
|
+
export declare const FIB_SPEED_RATIOS: number[];
|
|
1407
|
+
|
|
1408
|
+
/**
|
|
1409
|
+
* Fibonacci time extension levels
|
|
1410
|
+
*/
|
|
1411
|
+
export declare const FIB_TIME_EXTENSION_LEVELS: number[];
|
|
1412
|
+
|
|
1413
|
+
/**
|
|
1414
|
+
* Fibonacci time zone intervals (0, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89...)
|
|
1415
|
+
*/
|
|
1416
|
+
export declare const FIB_TIME_INTERVALS: number[];
|
|
1417
|
+
|
|
1418
|
+
/**
|
|
1419
|
+
* Fibonacci wedge levels
|
|
1420
|
+
*/
|
|
1421
|
+
export declare const FIB_WEDGE_LEVELS: number[];
|
|
1422
|
+
|
|
1423
|
+
/**
|
|
1424
|
+
* FibArcs - Speed/Resistance arcs at Fibonacci ratios.
|
|
1425
|
+
*
|
|
1426
|
+
* Features:
|
|
1427
|
+
* - Two anchor points (pivot and extent)
|
|
1428
|
+
* - Semi-circular or full arcs at Fibonacci distances
|
|
1429
|
+
* - Optional labels showing level
|
|
1430
|
+
* - Can show half or full circles
|
|
1431
|
+
*/
|
|
1432
|
+
export declare class FibArcs extends Drawing {
|
|
1433
|
+
readonly type = "fib-arcs";
|
|
1434
|
+
protected static readonly REQUIRED_ANCHORS = 2;
|
|
1435
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
1436
|
+
private _fibOptions;
|
|
1437
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<FibArcsOptions>);
|
|
1438
|
+
get fibOptions(): FibArcsOptions;
|
|
1439
|
+
setFibOptions(options: Partial<FibArcsOptions>): void;
|
|
1440
|
+
isValid(): boolean;
|
|
1441
|
+
paneViews(): IPrimitivePaneView[];
|
|
1442
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
1443
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
1444
|
+
clone(newId: string): IDrawing;
|
|
1445
|
+
static create(id: string, pivot: Anchor, extent: Anchor, style?: Partial<DrawingStyle>, options?: Partial<FibArcsOptions>): FibArcs;
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
/**
|
|
1449
|
+
* FibArcs options
|
|
1450
|
+
*/
|
|
1451
|
+
export declare interface FibArcsOptions extends DrawingOptions {
|
|
1452
|
+
levels?: number[];
|
|
1453
|
+
showLabels?: boolean;
|
|
1454
|
+
fullCircle?: boolean;
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
export declare class FibArcsPaneView implements IPrimitivePaneView {
|
|
1458
|
+
private _renderer;
|
|
1459
|
+
constructor(drawing: FibArcs);
|
|
1460
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
1461
|
+
renderer(): IPrimitivePaneRenderer;
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
/**
|
|
1465
|
+
* FibChannel - Fibonacci Channel with parallel trend lines at Fibonacci ratios.
|
|
1466
|
+
*
|
|
1467
|
+
* Features:
|
|
1468
|
+
* - Three anchor points (two for baseline, one for channel width)
|
|
1469
|
+
* - Multiple parallel lines at Fibonacci levels
|
|
1470
|
+
* - Optional fill between levels
|
|
1471
|
+
* - Optional line extensions
|
|
1472
|
+
*/
|
|
1473
|
+
export declare class FibChannel extends Drawing {
|
|
1474
|
+
readonly type = "fib-channel";
|
|
1475
|
+
protected static readonly REQUIRED_ANCHORS = 3;
|
|
1476
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
1477
|
+
private _fibOptions;
|
|
1478
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<FibChannelOptions>);
|
|
1479
|
+
get fibOptions(): FibChannelOptions;
|
|
1480
|
+
setFibOptions(options: Partial<FibChannelOptions>): void;
|
|
1481
|
+
isValid(): boolean;
|
|
1482
|
+
paneViews(): IPrimitivePaneView[];
|
|
1483
|
+
/**
|
|
1484
|
+
* Calculate the perpendicular offset from baseline to p3
|
|
1485
|
+
*/
|
|
1486
|
+
calculateOffset(p1: Point, p2: Point, p3: Point): Point;
|
|
1487
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
1488
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
1489
|
+
clone(newId: string): IDrawing;
|
|
1490
|
+
static create(id: string, start: Anchor, end: Anchor, width: Anchor, style?: Partial<DrawingStyle>, options?: Partial<FibChannelOptions>): FibChannel;
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
/**
|
|
1494
|
+
* FibChannel options
|
|
1495
|
+
*/
|
|
1496
|
+
export declare interface FibChannelOptions extends DrawingOptions {
|
|
1497
|
+
levels?: number[];
|
|
1498
|
+
showPrices?: boolean;
|
|
1499
|
+
showPercentages?: boolean;
|
|
1500
|
+
extendLines?: boolean;
|
|
1501
|
+
filled?: boolean;
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
export declare class FibChannelPaneView implements IPrimitivePaneView {
|
|
1505
|
+
private _renderer;
|
|
1506
|
+
constructor(drawing: FibChannel);
|
|
1507
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
1508
|
+
renderer(): IPrimitivePaneRenderer;
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
/**
|
|
1512
|
+
* FibCircles - Concentric circles at Fibonacci ratios.
|
|
1513
|
+
*
|
|
1514
|
+
* Features:
|
|
1515
|
+
* - Two anchor points (center and radius point)
|
|
1516
|
+
* - Concentric circles at Fibonacci ratio distances
|
|
1517
|
+
* - Optional labels showing level
|
|
1518
|
+
* - Optional fill between circles
|
|
1519
|
+
*/
|
|
1520
|
+
export declare class FibCircles extends Drawing {
|
|
1521
|
+
readonly type = "fib-circles";
|
|
1522
|
+
protected static readonly REQUIRED_ANCHORS = 2;
|
|
1523
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
1524
|
+
private _fibOptions;
|
|
1525
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<FibCirclesOptions>);
|
|
1526
|
+
get fibOptions(): FibCirclesOptions;
|
|
1527
|
+
setFibOptions(options: Partial<FibCirclesOptions>): void;
|
|
1528
|
+
isValid(): boolean;
|
|
1529
|
+
paneViews(): IPrimitivePaneView[];
|
|
1530
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
1531
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
1532
|
+
clone(newId: string): IDrawing;
|
|
1533
|
+
static create(id: string, center: Anchor, radiusPoint: Anchor, style?: Partial<DrawingStyle>, options?: Partial<FibCirclesOptions>): FibCircles;
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
/**
|
|
1537
|
+
* FibCircles options
|
|
1538
|
+
*/
|
|
1539
|
+
export declare interface FibCirclesOptions extends DrawingOptions {
|
|
1540
|
+
levels?: number[];
|
|
1541
|
+
showLabels?: boolean;
|
|
1542
|
+
filled?: boolean;
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
export declare class FibCirclesPaneView implements IPrimitivePaneView {
|
|
1546
|
+
private _renderer;
|
|
1547
|
+
constructor(drawing: FibCircles);
|
|
1548
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
1549
|
+
renderer(): IPrimitivePaneRenderer;
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
/**
|
|
1553
|
+
* FibExtension - Fibonacci extension levels based on three points.
|
|
1554
|
+
*
|
|
1555
|
+
* Features:
|
|
1556
|
+
* - Three anchor points (A, B, C - swing high/low/retracement)
|
|
1557
|
+
* - Extension levels projected from point C
|
|
1558
|
+
* - Optional price and percentage labels
|
|
1559
|
+
*/
|
|
1560
|
+
export declare class FibExtension extends Drawing {
|
|
1561
|
+
readonly type = "fib-extension";
|
|
1562
|
+
protected static readonly REQUIRED_ANCHORS = 3;
|
|
1563
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
1564
|
+
private _fibOptions;
|
|
1565
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<FibExtensionOptions>);
|
|
1566
|
+
get fibOptions(): FibExtensionOptions;
|
|
1567
|
+
setFibOptions(options: Partial<FibExtensionOptions>): void;
|
|
1568
|
+
isValid(): boolean;
|
|
1569
|
+
paneViews(): IPrimitivePaneView[];
|
|
1570
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
1571
|
+
/**
|
|
1572
|
+
* Get price at a specific extension level
|
|
1573
|
+
*/
|
|
1574
|
+
getPriceAtLevel(level: number): number;
|
|
1575
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
1576
|
+
clone(newId: string): IDrawing;
|
|
1577
|
+
static create(id: string, pointA: Anchor, pointB: Anchor, pointC: Anchor, style?: Partial<DrawingStyle>, options?: Partial<FibExtensionOptions>): FibExtension;
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
/**
|
|
1581
|
+
* FibExtension options
|
|
1582
|
+
*/
|
|
1583
|
+
export declare interface FibExtensionOptions extends DrawingOptions {
|
|
1584
|
+
levels?: number[];
|
|
1585
|
+
showPrices?: boolean;
|
|
1586
|
+
showPercentages?: boolean;
|
|
1587
|
+
extendLines?: boolean;
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
export declare class FibExtensionPaneView implements IPrimitivePaneView {
|
|
1591
|
+
private _renderer;
|
|
1592
|
+
constructor(drawing: FibExtension);
|
|
1593
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
1594
|
+
renderer(): IPrimitivePaneRenderer;
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
/**
|
|
1598
|
+
* Standard Fibonacci ratios
|
|
1599
|
+
*/
|
|
1600
|
+
export declare const FIBONACCI_LEVELS: number[];
|
|
1601
|
+
|
|
1602
|
+
/**
|
|
1603
|
+
* FibRetracement - Fibonacci retracement levels between two price points.
|
|
1604
|
+
*
|
|
1605
|
+
* Features:
|
|
1606
|
+
* - Two anchor points (high and low)
|
|
1607
|
+
* - Multiple Fibonacci level lines
|
|
1608
|
+
* - Optional price and percentage labels
|
|
1609
|
+
* - Optional line extensions
|
|
1610
|
+
* - Customizable levels
|
|
1611
|
+
*/
|
|
1612
|
+
export declare class FibRetracement extends Drawing {
|
|
1613
|
+
readonly type = "fib-retracement";
|
|
1614
|
+
protected static readonly REQUIRED_ANCHORS = 2;
|
|
1615
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
1616
|
+
private _fibOptions;
|
|
1617
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<FibRetracementOptions>);
|
|
1618
|
+
get fibOptions(): FibRetracementOptions;
|
|
1619
|
+
setFibOptions(options: Partial<FibRetracementOptions>): void;
|
|
1620
|
+
isValid(): boolean;
|
|
1621
|
+
paneViews(): IPrimitivePaneView[];
|
|
1622
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
1623
|
+
/**
|
|
1624
|
+
* Calculate price at a specific Fibonacci level
|
|
1625
|
+
*/
|
|
1626
|
+
getPriceAtLevel(level: number): number;
|
|
1627
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
1628
|
+
clone(newId: string): IDrawing;
|
|
1629
|
+
static create(id: string, start: Anchor, end: Anchor, style?: Partial<DrawingStyle>, options?: Partial<FibRetracementOptions>): FibRetracement;
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
/**
|
|
1633
|
+
* FibRetracement options
|
|
1634
|
+
*/
|
|
1635
|
+
export declare interface FibRetracementOptions extends DrawingOptions {
|
|
1636
|
+
levels?: number[];
|
|
1637
|
+
showPrices?: boolean;
|
|
1638
|
+
showPercentages?: boolean;
|
|
1639
|
+
extendLines?: boolean;
|
|
1640
|
+
reverseDirection?: boolean;
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
export declare class FibRetracementPaneView implements IPrimitivePaneView {
|
|
1644
|
+
private _renderer;
|
|
1645
|
+
constructor(drawing: FibRetracement);
|
|
1646
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
1647
|
+
renderer(): IPrimitivePaneRenderer;
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
/**
|
|
1651
|
+
* FibSpeedFan - Speed/Resistance fan lines at Fibonacci ratios.
|
|
1652
|
+
*
|
|
1653
|
+
* Features:
|
|
1654
|
+
* - Two anchor points define the main trend
|
|
1655
|
+
* - Fan lines emanating from first point at Fibonacci slope ratios
|
|
1656
|
+
* - Optional labels showing ratio
|
|
1657
|
+
* - Optional line extensions
|
|
1658
|
+
*/
|
|
1659
|
+
export declare class FibSpeedFan extends Drawing {
|
|
1660
|
+
readonly type = "fib-speed-fan";
|
|
1661
|
+
protected static readonly REQUIRED_ANCHORS = 2;
|
|
1662
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
1663
|
+
private _fibOptions;
|
|
1664
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<FibSpeedFanOptions>);
|
|
1665
|
+
get fibOptions(): FibSpeedFanOptions;
|
|
1666
|
+
setFibOptions(options: Partial<FibSpeedFanOptions>): void;
|
|
1667
|
+
isValid(): boolean;
|
|
1668
|
+
paneViews(): IPrimitivePaneView[];
|
|
1669
|
+
/**
|
|
1670
|
+
* Calculate fan line endpoint for a given ratio
|
|
1671
|
+
*/
|
|
1672
|
+
getFanLineEnd(p1: Point, p2: Point, ratio: number, viewportWidth: number): Point;
|
|
1673
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
1674
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
1675
|
+
clone(newId: string): IDrawing;
|
|
1676
|
+
static create(id: string, start: Anchor, end: Anchor, style?: Partial<DrawingStyle>, options?: Partial<FibSpeedFanOptions>): FibSpeedFan;
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
/**
|
|
1680
|
+
* FibSpeedFan options
|
|
1681
|
+
*/
|
|
1682
|
+
export declare interface FibSpeedFanOptions extends DrawingOptions {
|
|
1683
|
+
ratios?: number[];
|
|
1684
|
+
showLabels?: boolean;
|
|
1685
|
+
extendLines?: boolean;
|
|
1686
|
+
filled?: boolean;
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
export declare class FibSpeedFanPaneView implements IPrimitivePaneView {
|
|
1690
|
+
private _renderer;
|
|
1691
|
+
constructor(drawing: FibSpeedFan);
|
|
1692
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
1693
|
+
renderer(): IPrimitivePaneRenderer;
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
/**
|
|
1697
|
+
* FibSpiral - Golden spiral based on Fibonacci sequence.
|
|
1698
|
+
*
|
|
1699
|
+
* Features:
|
|
1700
|
+
* - Two anchor points (center and size reference)
|
|
1701
|
+
* - Logarithmic spiral with golden ratio growth
|
|
1702
|
+
* - Optional Fibonacci squares overlay
|
|
1703
|
+
* - Configurable rotation direction
|
|
1704
|
+
*/
|
|
1705
|
+
export declare class FibSpiral extends Drawing {
|
|
1706
|
+
readonly type = "fib-spiral";
|
|
1707
|
+
protected static readonly REQUIRED_ANCHORS = 2;
|
|
1708
|
+
protected static readonly HIT_THRESHOLD = 8;
|
|
1709
|
+
private _fibOptions;
|
|
1710
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<FibSpiralOptions>);
|
|
1711
|
+
get fibOptions(): FibSpiralOptions;
|
|
1712
|
+
setFibOptions(options: Partial<FibSpiralOptions>): void;
|
|
1713
|
+
isValid(): boolean;
|
|
1714
|
+
paneViews(): IPrimitivePaneView[];
|
|
1715
|
+
/**
|
|
1716
|
+
* Generate points along the golden spiral
|
|
1717
|
+
*/
|
|
1718
|
+
getSpiralPoints(center: Point, startRadius: number, rotations: number, clockwise: boolean): Point[];
|
|
1719
|
+
computeGeometry(_viewport: Viewport): Geometry[];
|
|
1720
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
1721
|
+
clone(newId: string): IDrawing;
|
|
1722
|
+
static create(id: string, center: Anchor, sizeRef: Anchor, style?: Partial<DrawingStyle>, options?: Partial<FibSpiralOptions>): FibSpiral;
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
/**
|
|
1726
|
+
* FibSpiral options
|
|
1727
|
+
*/
|
|
1728
|
+
export declare interface FibSpiralOptions extends DrawingOptions {
|
|
1729
|
+
rotations?: number;
|
|
1730
|
+
clockwise?: boolean;
|
|
1731
|
+
showSquares?: boolean;
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
export declare class FibSpiralPaneView implements IPrimitivePaneView {
|
|
1735
|
+
private _renderer;
|
|
1736
|
+
constructor(drawing: FibSpiral);
|
|
1737
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
1738
|
+
renderer(): IPrimitivePaneRenderer;
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
/**
|
|
1742
|
+
* FibTimeExtension - Trend-Based Fibonacci Time extension.
|
|
1743
|
+
*
|
|
1744
|
+
* Features:
|
|
1745
|
+
* - Three anchor points (start, end of trend, extension point)
|
|
1746
|
+
* - Vertical lines at Fibonacci time projections
|
|
1747
|
+
* - Optional labels showing level
|
|
1748
|
+
* - Optional fill between zones
|
|
1749
|
+
*/
|
|
1750
|
+
export declare class FibTimeExtension extends Drawing {
|
|
1751
|
+
readonly type = "fib-time-extension";
|
|
1752
|
+
protected static readonly REQUIRED_ANCHORS = 3;
|
|
1753
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
1754
|
+
private _fibOptions;
|
|
1755
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<FibTimeExtensionOptions>);
|
|
1756
|
+
get fibOptions(): FibTimeExtensionOptions;
|
|
1757
|
+
setFibOptions(options: Partial<FibTimeExtensionOptions>): void;
|
|
1758
|
+
isValid(): boolean;
|
|
1759
|
+
paneViews(): IPrimitivePaneView[];
|
|
1760
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
1761
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
1762
|
+
clone(newId: string): IDrawing;
|
|
1763
|
+
static create(id: string, start: Anchor, end: Anchor, extension: Anchor, style?: Partial<DrawingStyle>, options?: Partial<FibTimeExtensionOptions>): FibTimeExtension;
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
/**
|
|
1767
|
+
* FibTimeExtension options
|
|
1768
|
+
*/
|
|
1769
|
+
export declare interface FibTimeExtensionOptions extends DrawingOptions {
|
|
1770
|
+
levels?: number[];
|
|
1771
|
+
showLabels?: boolean;
|
|
1772
|
+
filled?: boolean;
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
export declare class FibTimeExtensionPaneView implements IPrimitivePaneView {
|
|
1776
|
+
private _renderer;
|
|
1777
|
+
constructor(drawing: FibTimeExtension);
|
|
1778
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
1779
|
+
renderer(): IPrimitivePaneRenderer;
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
/**
|
|
1783
|
+
* FibTimeZone - Vertical lines at Fibonacci time intervals.
|
|
1784
|
+
*
|
|
1785
|
+
* Features:
|
|
1786
|
+
* - Two anchor points define the unit interval
|
|
1787
|
+
* - Vertical lines at Fibonacci sequence positions
|
|
1788
|
+
* - Optional labels showing interval number
|
|
1789
|
+
* - Optional fill between zones
|
|
1790
|
+
*/
|
|
1791
|
+
export declare class FibTimeZone extends Drawing {
|
|
1792
|
+
readonly type = "fib-time-zone";
|
|
1793
|
+
protected static readonly REQUIRED_ANCHORS = 2;
|
|
1794
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
1795
|
+
private _fibOptions;
|
|
1796
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<FibTimeZoneOptions>);
|
|
1797
|
+
get fibOptions(): FibTimeZoneOptions;
|
|
1798
|
+
setFibOptions(options: Partial<FibTimeZoneOptions>): void;
|
|
1799
|
+
isValid(): boolean;
|
|
1800
|
+
paneViews(): IPrimitivePaneView[];
|
|
1801
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
1802
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
1803
|
+
clone(newId: string): IDrawing;
|
|
1804
|
+
static create(id: string, start: Anchor, end: Anchor, style?: Partial<DrawingStyle>, options?: Partial<FibTimeZoneOptions>): FibTimeZone;
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
/**
|
|
1808
|
+
* FibTimeZone options
|
|
1809
|
+
*/
|
|
1810
|
+
export declare interface FibTimeZoneOptions extends DrawingOptions {
|
|
1811
|
+
intervals?: number[];
|
|
1812
|
+
showLabels?: boolean;
|
|
1813
|
+
filled?: boolean;
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1816
|
+
export declare class FibTimeZonePaneView implements IPrimitivePaneView {
|
|
1817
|
+
private _renderer;
|
|
1818
|
+
constructor(drawing: FibTimeZone);
|
|
1819
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
1820
|
+
renderer(): IPrimitivePaneRenderer;
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
/**
|
|
1824
|
+
* FibWedge - Wedge pattern with Fibonacci level lines.
|
|
1825
|
+
*
|
|
1826
|
+
* Features:
|
|
1827
|
+
* - Three anchor points (apex and two boundary points)
|
|
1828
|
+
* - Lines radiating from apex at Fibonacci angle divisions
|
|
1829
|
+
* - Optional labels showing level
|
|
1830
|
+
* - Optional fill between lines
|
|
1831
|
+
*/
|
|
1832
|
+
export declare class FibWedge extends Drawing {
|
|
1833
|
+
readonly type = "fib-wedge";
|
|
1834
|
+
protected static readonly REQUIRED_ANCHORS = 3;
|
|
1835
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
1836
|
+
private _fibOptions;
|
|
1837
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<FibWedgeOptions>);
|
|
1838
|
+
get fibOptions(): FibWedgeOptions;
|
|
1839
|
+
setFibOptions(options: Partial<FibWedgeOptions>): void;
|
|
1840
|
+
isValid(): boolean;
|
|
1841
|
+
paneViews(): IPrimitivePaneView[];
|
|
1842
|
+
/**
|
|
1843
|
+
* Get the endpoint for a wedge line at a given level
|
|
1844
|
+
*/
|
|
1845
|
+
getWedgeLineEnd(_apex: Point, p1: Point, p2: Point, level: number): Point;
|
|
1846
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
1847
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
1848
|
+
clone(newId: string): IDrawing;
|
|
1849
|
+
static create(id: string, apex: Anchor, boundary1: Anchor, boundary2: Anchor, style?: Partial<DrawingStyle>, options?: Partial<FibWedgeOptions>): FibWedge;
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
/**
|
|
1853
|
+
* FibWedge options
|
|
1854
|
+
*/
|
|
1855
|
+
export declare interface FibWedgeOptions extends DrawingOptions {
|
|
1856
|
+
levels?: number[];
|
|
1857
|
+
showLabels?: boolean;
|
|
1858
|
+
filled?: boolean;
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
export declare class FibWedgePaneView implements IPrimitivePaneView {
|
|
1862
|
+
private _renderer;
|
|
1863
|
+
constructor(drawing: FibWedge);
|
|
1864
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
1865
|
+
renderer(): IPrimitivePaneRenderer;
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
/**
|
|
1869
|
+
* Flag mark color type
|
|
1870
|
+
*/
|
|
1871
|
+
export declare type FlagColor = 'red' | 'green' | 'blue' | 'yellow' | 'purple' | 'custom';
|
|
1872
|
+
|
|
1873
|
+
/**
|
|
1874
|
+
* Flag Mark - A flag marker placed on the chart.
|
|
1875
|
+
*
|
|
1876
|
+
* Features:
|
|
1877
|
+
* - Single anchor point
|
|
1878
|
+
* - Various preset colors
|
|
1879
|
+
* - Optional label
|
|
1880
|
+
* - Configurable size
|
|
1881
|
+
*/
|
|
1882
|
+
export declare class FlagMark extends Drawing {
|
|
1883
|
+
readonly type = "flag-mark";
|
|
1884
|
+
protected static readonly REQUIRED_ANCHORS = 1;
|
|
1885
|
+
protected static readonly HIT_THRESHOLD = 15;
|
|
1886
|
+
private _flagOptions;
|
|
1887
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<FlagMarkOptions>);
|
|
1888
|
+
get flagOptions(): FlagMarkOptions;
|
|
1889
|
+
setFlagOptions(options: Partial<FlagMarkOptions>): void;
|
|
1890
|
+
getFlagColor(): string;
|
|
1891
|
+
setLabel(label: string): void;
|
|
1892
|
+
getLabel(): string;
|
|
1893
|
+
isValid(): boolean;
|
|
1894
|
+
paneViews(): IPrimitivePaneView[];
|
|
1895
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
1896
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
1897
|
+
clone(newId: string): IDrawing;
|
|
1898
|
+
static create(id: string, position: Anchor, flagColor?: FlagColor, label?: string, style?: Partial<DrawingStyle>, options?: Partial<FlagMarkOptions>): FlagMark;
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
/**
|
|
1902
|
+
* Flag Mark options
|
|
1903
|
+
*/
|
|
1904
|
+
export declare interface FlagMarkOptions extends DrawingOptions {
|
|
1905
|
+
flagColor?: FlagColor;
|
|
1906
|
+
customColor?: string;
|
|
1907
|
+
label?: string;
|
|
1908
|
+
size?: number;
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
export declare class FlagMarkPaneView implements IPrimitivePaneView {
|
|
1912
|
+
private _renderer;
|
|
1913
|
+
constructor(drawing: FlagMark);
|
|
1914
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
1915
|
+
renderer(): IPrimitivePaneRenderer;
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
/**
|
|
1919
|
+
* FlatTopBottom - A channel where one side is flat (horizontal) and the other follows a trend.
|
|
1920
|
+
*
|
|
1921
|
+
* Features:
|
|
1922
|
+
* - Three anchor points: two for the trend line, one for the flat line level
|
|
1923
|
+
* - One horizontal line (flat)
|
|
1924
|
+
* - One diagonal line (trend)
|
|
1925
|
+
* - Optional fill between lines
|
|
1926
|
+
* - Optional line extensions
|
|
1927
|
+
*/
|
|
1928
|
+
export declare class FlatTopBottom extends Drawing {
|
|
1929
|
+
readonly type = "flat-top-bottom";
|
|
1930
|
+
protected static readonly REQUIRED_ANCHORS = 3;
|
|
1931
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
1932
|
+
private _channelOptions;
|
|
1933
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<FlatTopBottomOptions>);
|
|
1934
|
+
get channelOptions(): FlatTopBottomOptions;
|
|
1935
|
+
setChannelOptions(options: Partial<FlatTopBottomOptions>): void;
|
|
1936
|
+
isValid(): boolean;
|
|
1937
|
+
paneViews(): IPrimitivePaneView[];
|
|
1938
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
1939
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
1940
|
+
clone(newId: string): IDrawing;
|
|
1941
|
+
static create(id: string, start: Anchor, end: Anchor, flatLevel: Anchor, style?: Partial<DrawingStyle>, options?: Partial<FlatTopBottomOptions>): FlatTopBottom;
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
/**
|
|
1945
|
+
* FlatTopBottom options
|
|
1946
|
+
*/
|
|
1947
|
+
export declare interface FlatTopBottomOptions extends DrawingOptions {
|
|
1948
|
+
filled?: boolean;
|
|
1949
|
+
extendLines?: boolean;
|
|
1950
|
+
flatPosition?: 'top' | 'bottom';
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1953
|
+
export declare class FlatTopBottomPaneView implements IPrimitivePaneView {
|
|
1954
|
+
private _renderer;
|
|
1955
|
+
constructor(drawing: FlatTopBottom);
|
|
1956
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
1957
|
+
renderer(): IPrimitivePaneRenderer;
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
/**
|
|
1961
|
+
* Forecast - Price forecast projection tool.
|
|
1962
|
+
*
|
|
1963
|
+
* Features:
|
|
1964
|
+
* - Two anchor points defining a price range and time range
|
|
1965
|
+
* - Anchor 1: start price/time
|
|
1966
|
+
* - Anchor 2: target forecast price/time
|
|
1967
|
+
* - Shows projected zone with target price/percentage labels
|
|
1968
|
+
*/
|
|
1969
|
+
export declare class Forecast extends Drawing {
|
|
1970
|
+
readonly type = "forecast";
|
|
1971
|
+
protected static readonly REQUIRED_ANCHORS = 2;
|
|
1972
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
1973
|
+
private _forecastOptions;
|
|
1974
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<ForecastOptions>);
|
|
1975
|
+
get forecastOptions(): ForecastOptions;
|
|
1976
|
+
setForecastOptions(options: Partial<ForecastOptions>): void;
|
|
1977
|
+
getForecastInfo(): {
|
|
1978
|
+
startPrice: number;
|
|
1979
|
+
targetPrice: number;
|
|
1980
|
+
priceChange: number;
|
|
1981
|
+
percentChange: number;
|
|
1982
|
+
isUp: boolean;
|
|
1983
|
+
};
|
|
1984
|
+
isValid(): boolean;
|
|
1985
|
+
paneViews(): IPrimitivePaneView[];
|
|
1986
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
1987
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
1988
|
+
clone(newId: string): IDrawing;
|
|
1989
|
+
static create(id: string, startAnchor: Anchor, targetAnchor: Anchor, style?: Partial<DrawingStyle>, options?: Partial<ForecastOptions>): Forecast;
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1992
|
+
/**
|
|
1993
|
+
* Forecast options
|
|
1994
|
+
*/
|
|
1995
|
+
export declare interface ForecastOptions extends DrawingOptions {
|
|
1996
|
+
showPrices?: boolean;
|
|
1997
|
+
showPercentage?: boolean;
|
|
1998
|
+
showLabels?: boolean;
|
|
1999
|
+
filled?: boolean;
|
|
2000
|
+
}
|
|
2001
|
+
|
|
2002
|
+
export declare class ForecastPaneView implements IPrimitivePaneView {
|
|
2003
|
+
private _renderer;
|
|
2004
|
+
constructor(drawing: Forecast);
|
|
2005
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
2006
|
+
renderer(): IPrimitivePaneRenderer;
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
/**
|
|
2010
|
+
* Format percentage for display
|
|
2011
|
+
*/
|
|
2012
|
+
export declare function formatPercentage(percentage: number, precision?: number): string;
|
|
2013
|
+
|
|
2014
|
+
/**
|
|
2015
|
+
* Format price for display
|
|
2016
|
+
*/
|
|
2017
|
+
export declare function formatPrice(price: number, precision?: number): string;
|
|
2018
|
+
|
|
2019
|
+
/**
|
|
2020
|
+
* Standard Gann fan angles (rise/run ratios)
|
|
2021
|
+
*/
|
|
2022
|
+
export declare const GANN_FAN_ANGLES: {
|
|
2023
|
+
ratio: number;
|
|
2024
|
+
label: string;
|
|
2025
|
+
}[];
|
|
2026
|
+
|
|
2027
|
+
/**
|
|
2028
|
+
* Gann price levels
|
|
2029
|
+
*/
|
|
2030
|
+
export declare const GANN_LEVELS: number[];
|
|
2031
|
+
|
|
2032
|
+
/**
|
|
2033
|
+
* Gann square divisions for the "Square of Nine" pattern
|
|
2034
|
+
*/
|
|
2035
|
+
export declare const GANN_SQUARE_DIVISIONS = 8;
|
|
2036
|
+
|
|
2037
|
+
/**
|
|
2038
|
+
* Gann square levels (cardinal and ordinal)
|
|
2039
|
+
*/
|
|
2040
|
+
export declare const GANN_SQUARE_LEVELS: number[];
|
|
2041
|
+
|
|
2042
|
+
/**
|
|
2043
|
+
* GannBox - Gann grid/box for price and time analysis.
|
|
2044
|
+
*
|
|
2045
|
+
* Features:
|
|
2046
|
+
* - Two anchor points (corners)
|
|
2047
|
+
* - Horizontal price levels
|
|
2048
|
+
* - Vertical time levels
|
|
2049
|
+
* - Optional diagonal lines
|
|
2050
|
+
*/
|
|
2051
|
+
export declare class GannBox extends Drawing {
|
|
2052
|
+
readonly type = "gann-box";
|
|
2053
|
+
protected static readonly REQUIRED_ANCHORS = 2;
|
|
2054
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
2055
|
+
private _gannOptions;
|
|
2056
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<GannBoxOptions>);
|
|
2057
|
+
get gannOptions(): GannBoxOptions;
|
|
2058
|
+
setGannOptions(options: Partial<GannBoxOptions>): void;
|
|
2059
|
+
isValid(): boolean;
|
|
2060
|
+
paneViews(): IPrimitivePaneView[];
|
|
2061
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
2062
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
2063
|
+
clone(newId: string): IDrawing;
|
|
2064
|
+
static create(id: string, corner1: Anchor, corner2: Anchor, style?: Partial<DrawingStyle>, options?: Partial<GannBoxOptions>): GannBox;
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
/**
|
|
2068
|
+
* GannBox options
|
|
2069
|
+
*/
|
|
2070
|
+
export declare interface GannBoxOptions extends DrawingOptions {
|
|
2071
|
+
priceLevels?: number[];
|
|
2072
|
+
timeLevels?: number[];
|
|
2073
|
+
showDiagonals?: boolean;
|
|
2074
|
+
filled?: boolean;
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
export declare class GannBoxPaneView implements IPrimitivePaneView {
|
|
2078
|
+
private _renderer;
|
|
2079
|
+
constructor(drawing: GannBox);
|
|
2080
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
2081
|
+
renderer(): IPrimitivePaneRenderer;
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
/**
|
|
2085
|
+
* GannFan - Gann fan lines radiating from a point.
|
|
2086
|
+
*
|
|
2087
|
+
* Features:
|
|
2088
|
+
* - Two anchor points (origin and direction)
|
|
2089
|
+
* - Multiple fan lines at Gann angles
|
|
2090
|
+
* - Optional labels for each angle
|
|
2091
|
+
*/
|
|
2092
|
+
export declare class GannFan extends Drawing {
|
|
2093
|
+
readonly type = "gann-fan";
|
|
2094
|
+
protected static readonly REQUIRED_ANCHORS = 2;
|
|
2095
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
2096
|
+
private _gannOptions;
|
|
2097
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<GannFanOptions>);
|
|
2098
|
+
get gannOptions(): GannFanOptions;
|
|
2099
|
+
setGannOptions(options: Partial<GannFanOptions>): void;
|
|
2100
|
+
isValid(): boolean;
|
|
2101
|
+
paneViews(): IPrimitivePaneView[];
|
|
2102
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
2103
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
2104
|
+
clone(newId: string): IDrawing;
|
|
2105
|
+
static create(id: string, origin: Anchor, direction: Anchor, style?: Partial<DrawingStyle>, options?: Partial<GannFanOptions>): GannFan;
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
/**
|
|
2109
|
+
* GannFan options
|
|
2110
|
+
*/
|
|
2111
|
+
export declare interface GannFanOptions extends DrawingOptions {
|
|
2112
|
+
angles?: {
|
|
2113
|
+
ratio: number;
|
|
2114
|
+
label: string;
|
|
2115
|
+
}[];
|
|
2116
|
+
showLabels?: boolean;
|
|
2117
|
+
extendLines?: boolean;
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
export declare class GannFanPaneView implements IPrimitivePaneView {
|
|
2121
|
+
private _renderer;
|
|
2122
|
+
constructor(drawing: GannFan);
|
|
2123
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
2124
|
+
renderer(): IPrimitivePaneRenderer;
|
|
2125
|
+
}
|
|
2126
|
+
|
|
2127
|
+
/**
|
|
2128
|
+
* GannSquare - Resizable Gann square with "Square of Nine" pattern.
|
|
2129
|
+
*
|
|
2130
|
+
* Features:
|
|
2131
|
+
* - Two anchor points (center and corner)
|
|
2132
|
+
* - Concentric squares at regular intervals
|
|
2133
|
+
* - Cardinal cross (vertical/horizontal through center)
|
|
2134
|
+
* - Ordinal cross (45-degree diagonals)
|
|
2135
|
+
* - Optional spiral pattern
|
|
2136
|
+
*/
|
|
2137
|
+
export declare class GannSquare extends Drawing {
|
|
2138
|
+
readonly type = "gann-square";
|
|
2139
|
+
protected static readonly REQUIRED_ANCHORS = 2;
|
|
2140
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
2141
|
+
private _gannOptions;
|
|
2142
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<GannSquareOptions>);
|
|
2143
|
+
get gannOptions(): GannSquareOptions;
|
|
2144
|
+
setGannOptions(options: Partial<GannSquareOptions>): void;
|
|
2145
|
+
isValid(): boolean;
|
|
2146
|
+
paneViews(): IPrimitivePaneView[];
|
|
2147
|
+
/**
|
|
2148
|
+
* Get the square size from center to corner
|
|
2149
|
+
*/
|
|
2150
|
+
getSquareRadius(viewport: Viewport): number;
|
|
2151
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
2152
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
2153
|
+
clone(newId: string): IDrawing;
|
|
2154
|
+
static create(id: string, center: Anchor, corner: Anchor, style?: Partial<DrawingStyle>, options?: Partial<GannSquareOptions>): GannSquare;
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
/**
|
|
2158
|
+
* GannSquareFixed - Fixed-size Gann square for price/time analysis.
|
|
2159
|
+
*
|
|
2160
|
+
* Features:
|
|
2161
|
+
* - Single anchor point (center)
|
|
2162
|
+
* - Fixed square size based on price units
|
|
2163
|
+
* - Cardinal cross (vertical/horizontal)
|
|
2164
|
+
* - Ordinal cross (45-degree diagonals)
|
|
2165
|
+
* - Optional arcs at corners
|
|
2166
|
+
*/
|
|
2167
|
+
export declare class GannSquareFixed extends Drawing {
|
|
2168
|
+
readonly type = "gann-square-fixed";
|
|
2169
|
+
protected static readonly REQUIRED_ANCHORS = 1;
|
|
2170
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
2171
|
+
private _gannOptions;
|
|
2172
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<GannSquareFixedOptions>);
|
|
2173
|
+
get gannOptions(): GannSquareFixedOptions;
|
|
2174
|
+
setGannOptions(options: Partial<GannSquareFixedOptions>): void;
|
|
2175
|
+
isValid(): boolean;
|
|
2176
|
+
paneViews(): IPrimitivePaneView[];
|
|
2177
|
+
/**
|
|
2178
|
+
* Get the square size based on price scale
|
|
2179
|
+
*/
|
|
2180
|
+
getSquarePixelSize(viewport: Viewport): number;
|
|
2181
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
2182
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
2183
|
+
clone(newId: string): IDrawing;
|
|
2184
|
+
static create(id: string, center: Anchor, style?: Partial<DrawingStyle>, options?: Partial<GannSquareFixedOptions>): GannSquareFixed;
|
|
2185
|
+
}
|
|
2186
|
+
|
|
2187
|
+
/**
|
|
2188
|
+
* GannSquareFixed options
|
|
2189
|
+
*/
|
|
2190
|
+
export declare interface GannSquareFixedOptions extends DrawingOptions {
|
|
2191
|
+
squareSize?: number;
|
|
2192
|
+
levels?: number[];
|
|
2193
|
+
showDiagonals?: boolean;
|
|
2194
|
+
showArcs?: boolean;
|
|
2195
|
+
showLabels?: boolean;
|
|
2196
|
+
filled?: boolean;
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
export declare class GannSquareFixedPaneView implements IPrimitivePaneView {
|
|
2200
|
+
private _renderer;
|
|
2201
|
+
constructor(drawing: GannSquareFixed);
|
|
2202
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
2203
|
+
renderer(): IPrimitivePaneRenderer;
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
/**
|
|
2207
|
+
* GannSquare options
|
|
2208
|
+
*/
|
|
2209
|
+
export declare interface GannSquareOptions extends DrawingOptions {
|
|
2210
|
+
divisions?: number;
|
|
2211
|
+
showDiagonals?: boolean;
|
|
2212
|
+
showCardinalCross?: boolean;
|
|
2213
|
+
showSpiral?: boolean;
|
|
2214
|
+
showLabels?: boolean;
|
|
2215
|
+
filled?: boolean;
|
|
2216
|
+
}
|
|
2217
|
+
|
|
2218
|
+
export declare class GannSquarePaneView implements IPrimitivePaneView {
|
|
2219
|
+
private _renderer;
|
|
2220
|
+
constructor(drawing: GannSquare);
|
|
2221
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
2222
|
+
renderer(): IPrimitivePaneRenderer;
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2225
|
+
/**
|
|
2226
|
+
* Union of all geometry types
|
|
2227
|
+
*/
|
|
2228
|
+
export declare type Geometry = LineGeometry | ArcGeometry | RectangleGeometry | PolygonGeometry | TextGeometry;
|
|
2229
|
+
|
|
2230
|
+
/**
|
|
2231
|
+
* Get angle of line in radians
|
|
2232
|
+
*/
|
|
2233
|
+
export declare function getLineAngle(start: Point, end: Point): number;
|
|
2234
|
+
|
|
2235
|
+
/**
|
|
2236
|
+
* Get angle of line in degrees
|
|
2237
|
+
*/
|
|
2238
|
+
export declare function getLineAngleDegrees(start: Point, end: Point): number;
|
|
2239
|
+
|
|
2240
|
+
export declare function getToolRegistry(): ToolRegistry;
|
|
2241
|
+
|
|
2242
|
+
/**
|
|
2243
|
+
* Golden ratio for spiral
|
|
2244
|
+
*/
|
|
2245
|
+
export declare const GOLDEN_RATIO = 1.618033988749895;
|
|
2246
|
+
|
|
2247
|
+
/**
|
|
2248
|
+
* Highlighter - Semi-transparent highlight drawing tool.
|
|
2249
|
+
*
|
|
2250
|
+
* Features:
|
|
2251
|
+
* - Multiple anchor points forming a path
|
|
2252
|
+
* - Wide, semi-transparent stroke
|
|
2253
|
+
* - Ideal for marking important areas
|
|
2254
|
+
*/
|
|
2255
|
+
export declare class Highlighter extends Drawing {
|
|
2256
|
+
readonly type = "highlighter";
|
|
2257
|
+
protected static readonly REQUIRED_ANCHORS = 2;
|
|
2258
|
+
protected static readonly HIT_THRESHOLD = 15;
|
|
2259
|
+
private _highlighterOptions;
|
|
2260
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<HighlighterOptions>);
|
|
2261
|
+
get highlighterOptions(): HighlighterOptions;
|
|
2262
|
+
setHighlighterOptions(options: Partial<HighlighterOptions>): void;
|
|
2263
|
+
/**
|
|
2264
|
+
* Add a point to the highlighter path
|
|
2265
|
+
*/
|
|
2266
|
+
addPoint(anchor: Anchor): void;
|
|
2267
|
+
isValid(): boolean;
|
|
2268
|
+
paneViews(): IPrimitivePaneView[];
|
|
2269
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
2270
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
2271
|
+
clone(newId: string): IDrawing;
|
|
2272
|
+
static create(id: string, points: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<HighlighterOptions>): Highlighter;
|
|
2273
|
+
}
|
|
2274
|
+
|
|
2275
|
+
/**
|
|
2276
|
+
* Highlighter options
|
|
2277
|
+
*/
|
|
2278
|
+
export declare interface HighlighterOptions extends DrawingOptions {
|
|
2279
|
+
highlighterWidth?: number;
|
|
2280
|
+
opacity?: number;
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
export declare class HighlighterPaneView implements IPrimitivePaneView {
|
|
2284
|
+
private _renderer;
|
|
2285
|
+
constructor(drawing: Highlighter);
|
|
2286
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
2287
|
+
renderer(): IPrimitivePaneRenderer;
|
|
2288
|
+
}
|
|
2289
|
+
|
|
2290
|
+
/**
|
|
2291
|
+
* HorizontalLine - A horizontal line at a specific price level.
|
|
2292
|
+
*
|
|
2293
|
+
* Features:
|
|
2294
|
+
* - Single anchor point (price level)
|
|
2295
|
+
* - Extends across entire viewport
|
|
2296
|
+
* - Optional price label
|
|
2297
|
+
* - Optional custom label text
|
|
2298
|
+
*/
|
|
2299
|
+
export declare class HorizontalLine extends Drawing {
|
|
2300
|
+
readonly type = "horizontal-line";
|
|
2301
|
+
protected static readonly REQUIRED_ANCHORS = 1;
|
|
2302
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
2303
|
+
private _horizontalLineOptions;
|
|
2304
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<HorizontalLineOptions>);
|
|
2305
|
+
get horizontalLineOptions(): HorizontalLineOptions;
|
|
2306
|
+
setHorizontalLineOptions(options: Partial<HorizontalLineOptions>): void;
|
|
2307
|
+
isValid(): boolean;
|
|
2308
|
+
paneViews(): IPrimitivePaneView[];
|
|
2309
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
2310
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
2311
|
+
clone(newId: string): IDrawing;
|
|
2312
|
+
static create(id: string, price: number, time: number | string, style?: Partial<DrawingStyle>, options?: Partial<HorizontalLineOptions>): HorizontalLine;
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2315
|
+
/**
|
|
2316
|
+
* HorizontalLine options
|
|
2317
|
+
*/
|
|
2318
|
+
export declare interface HorizontalLineOptions extends DrawingOptions {
|
|
2319
|
+
showPrice?: boolean;
|
|
2320
|
+
showLabel?: boolean;
|
|
2321
|
+
labelText?: string;
|
|
2322
|
+
}
|
|
2323
|
+
|
|
2324
|
+
export declare class HorizontalLinePaneView implements IPrimitivePaneView {
|
|
2325
|
+
private _renderer;
|
|
2326
|
+
constructor(drawing: HorizontalLine);
|
|
2327
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
2328
|
+
renderer(): IPrimitivePaneRenderer;
|
|
2329
|
+
}
|
|
2330
|
+
|
|
2331
|
+
/**
|
|
2332
|
+
* Preview renderer for horizontal line (single point)
|
|
2333
|
+
*/
|
|
2334
|
+
export declare class HorizontalLinePreviewRenderer extends PreviewRenderer {
|
|
2335
|
+
render(ctx: CanvasRenderingContext2D, anchors: Anchor[], previewAnchor: Anchor | null, viewport: Viewport, style: DrawingStyle, pixelRatio: number): void;
|
|
2336
|
+
}
|
|
2337
|
+
|
|
2338
|
+
/**
|
|
2339
|
+
* HorizontalRay - A horizontal ray extending from a single point.
|
|
2340
|
+
*
|
|
2341
|
+
* Features:
|
|
2342
|
+
* - Single anchor point (price level)
|
|
2343
|
+
* - Extends horizontally to the right (or left) edge
|
|
2344
|
+
* - Optional price label
|
|
2345
|
+
* - Useful for support/resistance levels with direction
|
|
2346
|
+
*/
|
|
2347
|
+
export declare class HorizontalRay extends Drawing {
|
|
2348
|
+
readonly type = "horizontal-ray";
|
|
2349
|
+
protected static readonly REQUIRED_ANCHORS = 1;
|
|
2350
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
2351
|
+
private _horizontalRayOptions;
|
|
2352
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<HorizontalRayOptions>);
|
|
2353
|
+
get horizontalRayOptions(): HorizontalRayOptions;
|
|
2354
|
+
setHorizontalRayOptions(options: Partial<HorizontalRayOptions>): void;
|
|
2355
|
+
isValid(): boolean;
|
|
2356
|
+
paneViews(): IPrimitivePaneView[];
|
|
2357
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
2358
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
2359
|
+
clone(newId: string): IDrawing;
|
|
2360
|
+
static create(id: string, time: number | string, price: number, style?: Partial<DrawingStyle>, options?: Partial<HorizontalRayOptions>): HorizontalRay;
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2363
|
+
/**
|
|
2364
|
+
* HorizontalRay options
|
|
2365
|
+
*/
|
|
2366
|
+
export declare interface HorizontalRayOptions extends DrawingOptions {
|
|
2367
|
+
showPrice?: boolean;
|
|
2368
|
+
direction?: 'right' | 'left';
|
|
2369
|
+
}
|
|
2370
|
+
|
|
2371
|
+
export declare class HorizontalRayPaneView implements IPrimitivePaneView {
|
|
2372
|
+
private _renderer;
|
|
2373
|
+
constructor(drawing: HorizontalRay);
|
|
2374
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
2375
|
+
renderer(): IPrimitivePaneRenderer;
|
|
2376
|
+
}
|
|
2377
|
+
|
|
2378
|
+
/**
|
|
2379
|
+
* Base drawing interface
|
|
2380
|
+
*/
|
|
2381
|
+
export declare interface IDrawing {
|
|
2382
|
+
readonly id: string;
|
|
2383
|
+
readonly type: string;
|
|
2384
|
+
anchors: Anchor[];
|
|
2385
|
+
style: DrawingStyle;
|
|
2386
|
+
options: DrawingOptions;
|
|
2387
|
+
state: DrawingState;
|
|
2388
|
+
attach(series: ISeriesApi<SeriesType>, chart: IChartApi, container?: HTMLElement): void;
|
|
2389
|
+
detach(): void;
|
|
2390
|
+
isAttached(): boolean;
|
|
2391
|
+
isValid(): boolean;
|
|
2392
|
+
setAnchors(anchors: Anchor[]): void;
|
|
2393
|
+
updateAnchor(index: number, anchor: Anchor): void;
|
|
2394
|
+
updateStyle(style: Partial<DrawingStyle>): void;
|
|
2395
|
+
updateOptions(options: Partial<DrawingOptions>): void;
|
|
2396
|
+
setState(state: DrawingState): void;
|
|
2397
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
2398
|
+
hitTestAnchor(point: Point, viewport: Viewport): number | null;
|
|
2399
|
+
getControlPoints(viewport: Viewport): ControlPoint[];
|
|
2400
|
+
toJSON(): SerializedDrawing;
|
|
2401
|
+
fromJSON(data: SerializedDrawing): void;
|
|
2402
|
+
clone(newId: string): IDrawing;
|
|
2403
|
+
getViewport(): Viewport | null;
|
|
2404
|
+
requestUpdate(): void;
|
|
2405
|
+
paneViews(): IPrimitivePaneView[];
|
|
2406
|
+
}
|
|
2407
|
+
|
|
2408
|
+
/**
|
|
2409
|
+
* Interface for interaction handlers
|
|
2410
|
+
*/
|
|
2411
|
+
export declare interface IInteractionHandler {
|
|
2412
|
+
getState(): InteractionState;
|
|
2413
|
+
getAnchors(): Anchor[];
|
|
2414
|
+
getPreviewAnchor(): Anchor | null;
|
|
2415
|
+
onMouseDown(data: MouseEventData): void;
|
|
2416
|
+
onMouseMove(data: MouseEventData): void;
|
|
2417
|
+
onMouseUp(data: MouseEventData): void;
|
|
2418
|
+
onKeyDown(key: string): void;
|
|
2419
|
+
isComplete(): boolean;
|
|
2420
|
+
reset(): void;
|
|
2421
|
+
}
|
|
2422
|
+
|
|
2423
|
+
/**
|
|
2424
|
+
* InfoLine - A line that displays measurement information.
|
|
2425
|
+
*
|
|
2426
|
+
* Features:
|
|
2427
|
+
* - Two anchor points
|
|
2428
|
+
* - Shows distance, angle, price/percent change
|
|
2429
|
+
* - Shows bar count and time duration
|
|
2430
|
+
* - Comprehensive measurement tool
|
|
2431
|
+
*/
|
|
2432
|
+
export declare class InfoLine extends BaseLine {
|
|
2433
|
+
readonly type = "info-line";
|
|
2434
|
+
private _infoLineOptions;
|
|
2435
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<InfoLineOptions>);
|
|
2436
|
+
get infoLineOptions(): InfoLineOptions;
|
|
2437
|
+
setInfoLineOptions(options: Partial<InfoLineOptions>): void;
|
|
2438
|
+
paneViews(): IPrimitivePaneView[];
|
|
2439
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
2440
|
+
private computeLabelGeometry;
|
|
2441
|
+
/**
|
|
2442
|
+
* Get all measurement info as an object
|
|
2443
|
+
*/
|
|
2444
|
+
getMeasurements(viewport: Viewport): {
|
|
2445
|
+
distance: number;
|
|
2446
|
+
angle: number;
|
|
2447
|
+
priceChange: number;
|
|
2448
|
+
percentChange: number;
|
|
2449
|
+
bars: number;
|
|
2450
|
+
} | null;
|
|
2451
|
+
clone(newId: string): IDrawing;
|
|
2452
|
+
static create(id: string, startAnchor: Anchor, endAnchor: Anchor, style?: Partial<DrawingStyle>, options?: Partial<InfoLineOptions>): InfoLine;
|
|
2453
|
+
}
|
|
2454
|
+
|
|
2455
|
+
/**
|
|
2456
|
+
* InfoLine options
|
|
2457
|
+
*/
|
|
2458
|
+
export declare interface InfoLineOptions extends DrawingOptions {
|
|
2459
|
+
showDistance?: boolean;
|
|
2460
|
+
showAngle?: boolean;
|
|
2461
|
+
showPriceChange?: boolean;
|
|
2462
|
+
showPercentChange?: boolean;
|
|
2463
|
+
showBars?: boolean;
|
|
2464
|
+
showTime?: boolean;
|
|
2465
|
+
}
|
|
2466
|
+
|
|
2467
|
+
export declare class InfoLinePaneView implements IPrimitivePaneView {
|
|
2468
|
+
private _renderer;
|
|
2469
|
+
constructor(drawing: InfoLine);
|
|
2470
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
2471
|
+
renderer(): IPrimitivePaneRenderer;
|
|
2472
|
+
}
|
|
2473
|
+
|
|
2474
|
+
/**
|
|
2475
|
+
* InsidePitchfork - Inside Pitchfork variant.
|
|
2476
|
+
*
|
|
2477
|
+
* The Inside Pitchfork differs from Andrews' Pitchfork in that the outer
|
|
2478
|
+
* lines converge toward the median line rather than running parallel to it.
|
|
2479
|
+
* The outer lines start from the swing points (p1, p2) and converge toward
|
|
2480
|
+
* a point on the extended median line.
|
|
2481
|
+
*
|
|
2482
|
+
* Features:
|
|
2483
|
+
* - Three anchor points (pivot, and two swing points)
|
|
2484
|
+
* - Median line from pivot through midpoint of swings
|
|
2485
|
+
* - Converging outer lines from swing points toward median
|
|
2486
|
+
* - Optional fill between lines
|
|
2487
|
+
*/
|
|
2488
|
+
export declare class InsidePitchfork extends Drawing {
|
|
2489
|
+
readonly type = "inside-pitchfork";
|
|
2490
|
+
protected static readonly REQUIRED_ANCHORS = 3;
|
|
2491
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
2492
|
+
private _pitchforkOptions;
|
|
2493
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<InsidePitchforkOptions>);
|
|
2494
|
+
get pitchforkOptions(): InsidePitchforkOptions;
|
|
2495
|
+
setPitchforkOptions(options: Partial<InsidePitchforkOptions>): void;
|
|
2496
|
+
isValid(): boolean;
|
|
2497
|
+
paneViews(): IPrimitivePaneView[];
|
|
2498
|
+
/**
|
|
2499
|
+
* Calculate the convergence point on the median line where outer lines meet.
|
|
2500
|
+
* This is a point further along the median line.
|
|
2501
|
+
*/
|
|
2502
|
+
getConvergencePoint(p0: Point, mid: Point, factor?: number): Point;
|
|
2503
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
2504
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
2505
|
+
clone(newId: string): IDrawing;
|
|
2506
|
+
static create(id: string, pivot: Anchor, swing1: Anchor, swing2: Anchor, style?: Partial<DrawingStyle>, options?: Partial<InsidePitchforkOptions>): InsidePitchfork;
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2509
|
+
/**
|
|
2510
|
+
* InsidePitchfork options
|
|
2511
|
+
*/
|
|
2512
|
+
export declare interface InsidePitchforkOptions extends DrawingOptions {
|
|
2513
|
+
showMedianLine?: boolean;
|
|
2514
|
+
showOuterLines?: boolean;
|
|
2515
|
+
extendLines?: boolean;
|
|
2516
|
+
filled?: boolean;
|
|
2517
|
+
}
|
|
2518
|
+
|
|
2519
|
+
export declare class InsidePitchforkPaneView implements IPrimitivePaneView {
|
|
2520
|
+
private _renderer;
|
|
2521
|
+
constructor(drawing: InsidePitchfork);
|
|
2522
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
2523
|
+
renderer(): IPrimitivePaneRenderer;
|
|
2524
|
+
}
|
|
2525
|
+
|
|
2526
|
+
/**
|
|
2527
|
+
* Configuration for interaction handler
|
|
2528
|
+
*/
|
|
2529
|
+
export declare interface InteractionConfig {
|
|
2530
|
+
requiredAnchors: number;
|
|
2531
|
+
pixelToChart: PixelToChartFn;
|
|
2532
|
+
snapConfig?: SnapConfig;
|
|
2533
|
+
onAnchorAdded?: (anchor: Anchor, index: number) => void;
|
|
2534
|
+
onAnchorUpdated?: (anchor: Anchor, index: number) => void;
|
|
2535
|
+
onPreviewMove?: (previewAnchor: Anchor) => void;
|
|
2536
|
+
onComplete?: () => void;
|
|
2537
|
+
onCancel?: () => void;
|
|
2538
|
+
}
|
|
2539
|
+
|
|
2540
|
+
/**
|
|
2541
|
+
* Base interaction handler implementing FSM for drawing placement.
|
|
2542
|
+
* Handles the state machine for placing anchors and completing drawings.
|
|
2543
|
+
*/
|
|
2544
|
+
export declare class InteractionHandler implements IInteractionHandler {
|
|
2545
|
+
protected _state: InteractionState;
|
|
2546
|
+
protected _anchors: Anchor[];
|
|
2547
|
+
protected _previewAnchor: Anchor | null;
|
|
2548
|
+
protected _editingAnchorIndex: number | null;
|
|
2549
|
+
protected _config: InteractionConfig;
|
|
2550
|
+
constructor(config: InteractionConfig);
|
|
2551
|
+
getState(): InteractionState;
|
|
2552
|
+
getAnchors(): Anchor[];
|
|
2553
|
+
getPreviewAnchor(): Anchor | null;
|
|
2554
|
+
onMouseDown(data: MouseEventData): void;
|
|
2555
|
+
onMouseMove(data: MouseEventData): void;
|
|
2556
|
+
onMouseUp(_data: MouseEventData): void;
|
|
2557
|
+
onKeyDown(key: string): void;
|
|
2558
|
+
isComplete(): boolean;
|
|
2559
|
+
reset(): void;
|
|
2560
|
+
/**
|
|
2561
|
+
* Start editing a specific anchor
|
|
2562
|
+
*/
|
|
2563
|
+
startEditingAnchor(index: number): void;
|
|
2564
|
+
/**
|
|
2565
|
+
* Set anchors externally (for loading from saved data)
|
|
2566
|
+
*/
|
|
2567
|
+
setAnchors(anchors: Anchor[]): void;
|
|
2568
|
+
protected pointToAnchor(point: Point): Anchor | null;
|
|
2569
|
+
protected applySnap(anchor: Anchor, _point: Point): Anchor;
|
|
2570
|
+
protected cancel(): void;
|
|
2571
|
+
protected notifyAnchorAdded(anchor: Anchor, index: number): void;
|
|
2572
|
+
protected notifyAnchorUpdated(anchor: Anchor, index: number): void;
|
|
2573
|
+
protected notifyPreviewMove(anchor: Anchor): void;
|
|
2574
|
+
protected notifyComplete(): void;
|
|
2575
|
+
}
|
|
2576
|
+
|
|
2577
|
+
/**
|
|
2578
|
+
* Interaction states for the FSM
|
|
2579
|
+
*/
|
|
2580
|
+
export declare type InteractionState = 'idle' | 'placing' | 'editing' | 'complete';
|
|
2581
|
+
|
|
2582
|
+
/**
|
|
2583
|
+
* Interface for preview renderers
|
|
2584
|
+
*/
|
|
2585
|
+
export declare interface IPreviewRenderer {
|
|
2586
|
+
render(ctx: CanvasRenderingContext2D, anchors: Anchor[], previewAnchor: Anchor | null, viewport: Viewport, style: DrawingStyle, pixelRatio: number): void;
|
|
2587
|
+
}
|
|
2588
|
+
|
|
2589
|
+
/**
|
|
2590
|
+
* Check if point is within distance of another point
|
|
2591
|
+
*/
|
|
2592
|
+
export declare function isPointNear(p1: Point, p2: Point, threshold: number): boolean;
|
|
2593
|
+
|
|
2594
|
+
/**
|
|
2595
|
+
* Linear interpolation between two points
|
|
2596
|
+
*/
|
|
2597
|
+
export declare function lerp(p1: Point, p2: Point, t: number): Point;
|
|
2598
|
+
|
|
2599
|
+
/**
|
|
2600
|
+
* Line geometry with optional extensions
|
|
2601
|
+
*/
|
|
2602
|
+
export declare interface LineGeometry {
|
|
2603
|
+
type: 'line';
|
|
2604
|
+
start: Point;
|
|
2605
|
+
end: Point;
|
|
2606
|
+
extendLeft?: boolean;
|
|
2607
|
+
extendRight?: boolean;
|
|
2608
|
+
}
|
|
2609
|
+
|
|
2610
|
+
/**
|
|
2611
|
+
* Preview renderer for two-point line drawings
|
|
2612
|
+
*/
|
|
2613
|
+
export declare class LinePreviewRenderer extends PreviewRenderer {
|
|
2614
|
+
render(ctx: CanvasRenderingContext2D, anchors: Anchor[], previewAnchor: Anchor | null, viewport: Viewport, style: DrawingStyle, pixelRatio: number): void;
|
|
2615
|
+
}
|
|
2616
|
+
|
|
2617
|
+
/**
|
|
2618
|
+
* LongPosition - Trade visualization for long positions.
|
|
2619
|
+
*
|
|
2620
|
+
* Features:
|
|
2621
|
+
* - Three anchor points: entry, stop loss, take profit
|
|
2622
|
+
* - Shows risk (red) and reward (green) zones
|
|
2623
|
+
* - Displays P&L, percentage change, and risk/reward ratio
|
|
2624
|
+
*/
|
|
2625
|
+
export declare class LongPosition extends Drawing {
|
|
2626
|
+
readonly type = "long-position";
|
|
2627
|
+
protected static readonly REQUIRED_ANCHORS = 3;
|
|
2628
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
2629
|
+
private _positionOptions;
|
|
2630
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<LongPositionOptions>);
|
|
2631
|
+
get positionOptions(): LongPositionOptions;
|
|
2632
|
+
setPositionOptions(options: Partial<LongPositionOptions>): void;
|
|
2633
|
+
isValid(): boolean;
|
|
2634
|
+
paneViews(): IPrimitivePaneView[];
|
|
2635
|
+
/**
|
|
2636
|
+
* Get position info
|
|
2637
|
+
* Anchors: [0] = entry, [1] = stop loss, [2] = take profit
|
|
2638
|
+
*/
|
|
2639
|
+
getPositionInfo(): {
|
|
2640
|
+
entry: number;
|
|
2641
|
+
stopLoss: number;
|
|
2642
|
+
takeProfit: number;
|
|
2643
|
+
risk: number;
|
|
2644
|
+
reward: number;
|
|
2645
|
+
riskRewardRatio: number;
|
|
2646
|
+
riskPercent: number;
|
|
2647
|
+
rewardPercent: number;
|
|
2648
|
+
};
|
|
2649
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
2650
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
2651
|
+
clone(newId: string): IDrawing;
|
|
2652
|
+
static create(id: string, entry: Anchor, stopLoss: Anchor, takeProfit: Anchor, style?: Partial<DrawingStyle>, options?: Partial<LongPositionOptions>): LongPosition;
|
|
2653
|
+
}
|
|
2654
|
+
|
|
2655
|
+
/**
|
|
2656
|
+
* LongPosition options
|
|
2657
|
+
*/
|
|
2658
|
+
export declare interface LongPositionOptions extends DrawingOptions {
|
|
2659
|
+
showPrices?: boolean;
|
|
2660
|
+
showPercentage?: boolean;
|
|
2661
|
+
showRiskReward?: boolean;
|
|
2662
|
+
showPnL?: boolean;
|
|
2663
|
+
quantity?: number;
|
|
2664
|
+
accountSize?: number;
|
|
2665
|
+
}
|
|
2666
|
+
|
|
2667
|
+
export declare class LongPositionPaneView implements IPrimitivePaneView {
|
|
2668
|
+
private _renderer;
|
|
2669
|
+
constructor(drawing: LongPosition);
|
|
2670
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
2671
|
+
renderer(): IPrimitivePaneRenderer;
|
|
2672
|
+
}
|
|
2673
|
+
|
|
2674
|
+
/**
|
|
2675
|
+
* Calculate midpoint between two points
|
|
2676
|
+
*/
|
|
2677
|
+
export declare function midpoint(p1: Point, p2: Point): Point;
|
|
2678
|
+
|
|
2679
|
+
/**
|
|
2680
|
+
* ModifiedSchiffPitchfork - Modified Schiff Pitchfork variant.
|
|
2681
|
+
*
|
|
2682
|
+
* The Modified Schiff Pitchfork differs from the standard Schiff in that
|
|
2683
|
+
* the median line starts from the midpoint of a vertical line drawn from
|
|
2684
|
+
* the pivot point (p0) down/up to the price level of the first swing point (p1).
|
|
2685
|
+
* This creates a more horizontal median line than both Andrews' and Schiff.
|
|
2686
|
+
*
|
|
2687
|
+
* Features:
|
|
2688
|
+
* - Three anchor points (pivot, and two swing points)
|
|
2689
|
+
* - Median line from modified pivot through midpoint of swings
|
|
2690
|
+
* - Parallel outer lines through swing points
|
|
2691
|
+
* - Optional fill between lines
|
|
2692
|
+
*/
|
|
2693
|
+
export declare class ModifiedSchiffPitchfork extends Drawing {
|
|
2694
|
+
readonly type = "modified-schiff-pitchfork";
|
|
2695
|
+
protected static readonly REQUIRED_ANCHORS = 3;
|
|
2696
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
2697
|
+
private _pitchforkOptions;
|
|
2698
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<ModifiedSchiffPitchforkOptions>);
|
|
2699
|
+
get pitchforkOptions(): ModifiedSchiffPitchforkOptions;
|
|
2700
|
+
setPitchforkOptions(options: Partial<ModifiedSchiffPitchforkOptions>): void;
|
|
2701
|
+
isValid(): boolean;
|
|
2702
|
+
paneViews(): IPrimitivePaneView[];
|
|
2703
|
+
/**
|
|
2704
|
+
* Calculate the Modified Schiff pivot point.
|
|
2705
|
+
* It's the midpoint between p0 and a point directly below/above p0 at p1's y-level.
|
|
2706
|
+
*/
|
|
2707
|
+
getModifiedSchiffPivot(p0: Point, p1: Point): Point;
|
|
2708
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
2709
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
2710
|
+
clone(newId: string): IDrawing;
|
|
2711
|
+
static create(id: string, pivot: Anchor, swing1: Anchor, swing2: Anchor, style?: Partial<DrawingStyle>, options?: Partial<ModifiedSchiffPitchforkOptions>): ModifiedSchiffPitchfork;
|
|
2712
|
+
}
|
|
2713
|
+
|
|
2714
|
+
/**
|
|
2715
|
+
* ModifiedSchiffPitchfork options
|
|
2716
|
+
*/
|
|
2717
|
+
export declare interface ModifiedSchiffPitchforkOptions extends DrawingOptions {
|
|
2718
|
+
showMedianLine?: boolean;
|
|
2719
|
+
showOuterLines?: boolean;
|
|
2720
|
+
extendLines?: boolean;
|
|
2721
|
+
filled?: boolean;
|
|
2722
|
+
}
|
|
2723
|
+
|
|
2724
|
+
export declare class ModifiedSchiffPitchforkPaneView implements IPrimitivePaneView {
|
|
2725
|
+
private _renderer;
|
|
2726
|
+
constructor(drawing: ModifiedSchiffPitchfork);
|
|
2727
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
2728
|
+
renderer(): IPrimitivePaneRenderer;
|
|
2729
|
+
}
|
|
2730
|
+
|
|
2731
|
+
/**
|
|
2732
|
+
* Mouse event data passed to interaction handlers
|
|
2733
|
+
*/
|
|
2734
|
+
export declare interface MouseEventData {
|
|
2735
|
+
point: Point;
|
|
2736
|
+
time: Time | null;
|
|
2737
|
+
price: number | null;
|
|
2738
|
+
srcEvent: MouseEvent;
|
|
2739
|
+
}
|
|
2740
|
+
|
|
2741
|
+
/**
|
|
2742
|
+
* Note - A sticky note style annotation.
|
|
2743
|
+
*
|
|
2744
|
+
* Features:
|
|
2745
|
+
* - Single anchor point
|
|
2746
|
+
* - Note icon with expandable text
|
|
2747
|
+
* - Customizable background and icon color
|
|
2748
|
+
* - Fixed or auto-width
|
|
2749
|
+
*/
|
|
2750
|
+
export declare class Note extends Drawing {
|
|
2751
|
+
readonly type = "note";
|
|
2752
|
+
protected static readonly REQUIRED_ANCHORS = 1;
|
|
2753
|
+
protected static readonly HIT_THRESHOLD = 15;
|
|
2754
|
+
private _noteOptions;
|
|
2755
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<NoteOptions>);
|
|
2756
|
+
get noteOptions(): NoteOptions;
|
|
2757
|
+
setNoteOptions(options: Partial<NoteOptions>): void;
|
|
2758
|
+
setText(text: string): void;
|
|
2759
|
+
getText(): string;
|
|
2760
|
+
isValid(): boolean;
|
|
2761
|
+
paneViews(): IPrimitivePaneView[];
|
|
2762
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
2763
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
2764
|
+
clone(newId: string): IDrawing;
|
|
2765
|
+
static create(id: string, position: Anchor, text: string, style?: Partial<DrawingStyle>, options?: Partial<NoteOptions>): Note;
|
|
2766
|
+
}
|
|
2767
|
+
|
|
2768
|
+
/**
|
|
2769
|
+
* Note options
|
|
2770
|
+
*/
|
|
2771
|
+
export declare interface NoteOptions extends DrawingOptions {
|
|
2772
|
+
text?: string;
|
|
2773
|
+
fontSize?: number;
|
|
2774
|
+
backgroundColor?: string;
|
|
2775
|
+
iconColor?: string;
|
|
2776
|
+
width?: number;
|
|
2777
|
+
showIcon?: boolean;
|
|
2778
|
+
}
|
|
2779
|
+
|
|
2780
|
+
export declare class NotePaneView implements IPrimitivePaneView {
|
|
2781
|
+
private _renderer;
|
|
2782
|
+
constructor(drawing: Note);
|
|
2783
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
2784
|
+
renderer(): IPrimitivePaneRenderer;
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2787
|
+
/**
|
|
2788
|
+
* ParallelChannel - Two parallel lines forming a channel.
|
|
2789
|
+
*
|
|
2790
|
+
* Features:
|
|
2791
|
+
* - Three anchor points (two for baseline, one for channel width)
|
|
2792
|
+
* - Optional fill between lines
|
|
2793
|
+
* - Optional middle line
|
|
2794
|
+
* - Optional line extensions
|
|
2795
|
+
*/
|
|
2796
|
+
export declare class ParallelChannel extends Drawing {
|
|
2797
|
+
readonly type = "parallel-channel";
|
|
2798
|
+
protected static readonly REQUIRED_ANCHORS = 3;
|
|
2799
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
2800
|
+
private _channelOptions;
|
|
2801
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<ParallelChannelOptions>);
|
|
2802
|
+
get channelOptions(): ParallelChannelOptions;
|
|
2803
|
+
setChannelOptions(options: Partial<ParallelChannelOptions>): void;
|
|
2804
|
+
isValid(): boolean;
|
|
2805
|
+
paneViews(): IPrimitivePaneView[];
|
|
2806
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
2807
|
+
private calculateOffset;
|
|
2808
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
2809
|
+
clone(newId: string): IDrawing;
|
|
2810
|
+
static create(id: string, start: Anchor, end: Anchor, width: Anchor, style?: Partial<DrawingStyle>, options?: Partial<ParallelChannelOptions>): ParallelChannel;
|
|
2811
|
+
}
|
|
2812
|
+
|
|
2813
|
+
/**
|
|
2814
|
+
* ParallelChannel options
|
|
2815
|
+
*/
|
|
2816
|
+
export declare interface ParallelChannelOptions extends DrawingOptions {
|
|
2817
|
+
filled?: boolean;
|
|
2818
|
+
showMiddleLine?: boolean;
|
|
2819
|
+
extendLines?: boolean;
|
|
2820
|
+
}
|
|
2821
|
+
|
|
2822
|
+
export declare class ParallelChannelPaneView implements IPrimitivePaneView {
|
|
2823
|
+
private _renderer;
|
|
2824
|
+
constructor(drawing: ParallelChannel);
|
|
2825
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
2826
|
+
renderer(): IPrimitivePaneRenderer;
|
|
2827
|
+
}
|
|
2828
|
+
|
|
2829
|
+
/**
|
|
2830
|
+
* Path - Freeform path drawing with straight line segments.
|
|
2831
|
+
*
|
|
2832
|
+
* Features:
|
|
2833
|
+
* - Multiple anchor points connected by straight lines
|
|
2834
|
+
* - Optional closed path
|
|
2835
|
+
* - Optional fill (when closed)
|
|
2836
|
+
*/
|
|
2837
|
+
export declare class Path extends Drawing {
|
|
2838
|
+
readonly type = "path";
|
|
2839
|
+
protected static readonly REQUIRED_ANCHORS = 2;
|
|
2840
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
2841
|
+
private _pathOptions;
|
|
2842
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<PathOptions>);
|
|
2843
|
+
get pathOptions(): PathOptions;
|
|
2844
|
+
setPathOptions(options: Partial<PathOptions>): void;
|
|
2845
|
+
/**
|
|
2846
|
+
* Add a point to the path
|
|
2847
|
+
*/
|
|
2848
|
+
addPoint(anchor: Anchor): void;
|
|
2849
|
+
/**
|
|
2850
|
+
* Close or open the path
|
|
2851
|
+
*/
|
|
2852
|
+
setClosed(closed: boolean): void;
|
|
2853
|
+
isValid(): boolean;
|
|
2854
|
+
paneViews(): IPrimitivePaneView[];
|
|
2855
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
2856
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
2857
|
+
private pointInPolygon;
|
|
2858
|
+
clone(newId: string): IDrawing;
|
|
2859
|
+
static create(id: string, points: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<PathOptions>): Path;
|
|
2860
|
+
}
|
|
2861
|
+
|
|
2862
|
+
/**
|
|
2863
|
+
* Path options
|
|
2864
|
+
*/
|
|
2865
|
+
export declare interface PathOptions extends DrawingOptions {
|
|
2866
|
+
closed?: boolean;
|
|
2867
|
+
filled?: boolean;
|
|
2868
|
+
}
|
|
2869
|
+
|
|
2870
|
+
export declare class PathPaneView implements IPrimitivePaneView {
|
|
2871
|
+
private _renderer;
|
|
2872
|
+
constructor(drawing: Path);
|
|
2873
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
2874
|
+
renderer(): IPrimitivePaneRenderer;
|
|
2875
|
+
}
|
|
2876
|
+
|
|
2877
|
+
/**
|
|
2878
|
+
* Pin - A simple pin/map marker annotation.
|
|
2879
|
+
*
|
|
2880
|
+
* Features:
|
|
2881
|
+
* - Single anchor point
|
|
2882
|
+
* - Teardrop/pin shape
|
|
2883
|
+
* - Optional short label
|
|
2884
|
+
*/
|
|
2885
|
+
export declare class Pin extends Drawing {
|
|
2886
|
+
readonly type = "pin";
|
|
2887
|
+
protected static readonly REQUIRED_ANCHORS = 1;
|
|
2888
|
+
protected static readonly HIT_THRESHOLD = 15;
|
|
2889
|
+
private _pinOptions;
|
|
2890
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<PinOptions>);
|
|
2891
|
+
get pinOptions(): PinOptions;
|
|
2892
|
+
setPinOptions(options: Partial<PinOptions>): void;
|
|
2893
|
+
setLabel(label: string): void;
|
|
2894
|
+
getLabel(): string;
|
|
2895
|
+
isValid(): boolean;
|
|
2896
|
+
paneViews(): IPrimitivePaneView[];
|
|
2897
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
2898
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
2899
|
+
clone(newId: string): IDrawing;
|
|
2900
|
+
static create(id: string, position: Anchor, style?: Partial<DrawingStyle>, options?: Partial<PinOptions>): Pin;
|
|
2901
|
+
}
|
|
2902
|
+
|
|
2903
|
+
/**
|
|
2904
|
+
* Pin options
|
|
2905
|
+
*/
|
|
2906
|
+
export declare interface PinOptions extends DrawingOptions {
|
|
2907
|
+
color?: string;
|
|
2908
|
+
size?: number;
|
|
2909
|
+
label?: string;
|
|
2910
|
+
}
|
|
2911
|
+
|
|
2912
|
+
export declare class PinPaneView implements IPrimitivePaneView {
|
|
2913
|
+
private _renderer;
|
|
2914
|
+
constructor(drawing: Pin);
|
|
2915
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
2916
|
+
renderer(): IPrimitivePaneRenderer;
|
|
2917
|
+
}
|
|
2918
|
+
|
|
2919
|
+
/**
|
|
2920
|
+
* Pitchfan - Fan lines from a pitchfork-style base at Fibonacci levels.
|
|
2921
|
+
*
|
|
2922
|
+
* Features:
|
|
2923
|
+
* - Three anchor points (pivot and two swing points)
|
|
2924
|
+
* - Fan lines radiating from pivot through Fibonacci divisions
|
|
2925
|
+
* - Similar to pitchfork but with multiple fan lines
|
|
2926
|
+
* - Optional line extensions
|
|
2927
|
+
*/
|
|
2928
|
+
export declare class Pitchfan extends Drawing {
|
|
2929
|
+
readonly type = "pitchfan";
|
|
2930
|
+
protected static readonly REQUIRED_ANCHORS = 3;
|
|
2931
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
2932
|
+
private _fibOptions;
|
|
2933
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<PitchfanOptions>);
|
|
2934
|
+
get fibOptions(): PitchfanOptions;
|
|
2935
|
+
setFibOptions(options: Partial<PitchfanOptions>): void;
|
|
2936
|
+
isValid(): boolean;
|
|
2937
|
+
paneViews(): IPrimitivePaneView[];
|
|
2938
|
+
/**
|
|
2939
|
+
* Get the fan line endpoint for a given level
|
|
2940
|
+
*/
|
|
2941
|
+
getFanLineEnd(pivot: Point, p1: Point, p2: Point, level: number): Point;
|
|
2942
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
2943
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
2944
|
+
clone(newId: string): IDrawing;
|
|
2945
|
+
static create(id: string, pivot: Anchor, swing1: Anchor, swing2: Anchor, style?: Partial<DrawingStyle>, options?: Partial<PitchfanOptions>): Pitchfan;
|
|
2946
|
+
}
|
|
2947
|
+
|
|
2948
|
+
/**
|
|
2949
|
+
* Pitchfan levels (Fibonacci-based)
|
|
2950
|
+
*/
|
|
2951
|
+
export declare const PITCHFAN_LEVELS: number[];
|
|
2952
|
+
|
|
2953
|
+
/**
|
|
2954
|
+
* Pitchfan options
|
|
2955
|
+
*/
|
|
2956
|
+
export declare interface PitchfanOptions extends DrawingOptions {
|
|
2957
|
+
levels?: number[];
|
|
2958
|
+
showLabels?: boolean;
|
|
2959
|
+
extendLines?: boolean;
|
|
2960
|
+
filled?: boolean;
|
|
2961
|
+
}
|
|
2962
|
+
|
|
2963
|
+
export declare class PitchfanPaneView implements IPrimitivePaneView {
|
|
2964
|
+
private _renderer;
|
|
2965
|
+
constructor(drawing: Pitchfan);
|
|
2966
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
2967
|
+
renderer(): IPrimitivePaneRenderer;
|
|
2968
|
+
}
|
|
2969
|
+
|
|
2970
|
+
/**
|
|
2971
|
+
* Pixel to chart coordinate conversion function
|
|
2972
|
+
*/
|
|
2973
|
+
export declare type PixelToChartFn = (point: Point) => Anchor | null;
|
|
2974
|
+
|
|
2975
|
+
/**
|
|
2976
|
+
* Point in pixel coordinates
|
|
2977
|
+
*/
|
|
2978
|
+
export declare interface Point {
|
|
2979
|
+
x: number;
|
|
2980
|
+
y: number;
|
|
2981
|
+
}
|
|
2982
|
+
|
|
2983
|
+
/**
|
|
2984
|
+
* Polygon geometry (closed or open path)
|
|
2985
|
+
*/
|
|
2986
|
+
export declare interface PolygonGeometry {
|
|
2987
|
+
type: 'polygon';
|
|
2988
|
+
points: Point[];
|
|
2989
|
+
closed: boolean;
|
|
2990
|
+
}
|
|
2991
|
+
|
|
2992
|
+
/**
|
|
2993
|
+
* Polyline - Multi-point connected line with vertex markers.
|
|
2994
|
+
*
|
|
2995
|
+
* Features:
|
|
2996
|
+
* - Multiple anchor points connected by straight lines
|
|
2997
|
+
* - Optional vertex markers at each point
|
|
2998
|
+
* - Interactive point adding during creation
|
|
2999
|
+
*/
|
|
3000
|
+
export declare class Polyline extends Drawing {
|
|
3001
|
+
readonly type = "polyline";
|
|
3002
|
+
protected static readonly REQUIRED_ANCHORS = 2;
|
|
3003
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
3004
|
+
private _polylineOptions;
|
|
3005
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<PolylineOptions>);
|
|
3006
|
+
get polylineOptions(): PolylineOptions;
|
|
3007
|
+
setPolylineOptions(options: Partial<PolylineOptions>): void;
|
|
3008
|
+
/**
|
|
3009
|
+
* Add a point to the polyline
|
|
3010
|
+
*/
|
|
3011
|
+
addPoint(anchor: Anchor): void;
|
|
3012
|
+
/**
|
|
3013
|
+
* Insert a point at a specific index
|
|
3014
|
+
*/
|
|
3015
|
+
insertPoint(index: number, anchor: Anchor): void;
|
|
3016
|
+
/**
|
|
3017
|
+
* Remove a point at a specific index
|
|
3018
|
+
*/
|
|
3019
|
+
removePoint(index: number): void;
|
|
3020
|
+
isValid(): boolean;
|
|
3021
|
+
paneViews(): IPrimitivePaneView[];
|
|
3022
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
3023
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
3024
|
+
/**
|
|
3025
|
+
* Get total length of the polyline
|
|
3026
|
+
*/
|
|
3027
|
+
getTotalLength(viewport: Viewport): number;
|
|
3028
|
+
clone(newId: string): IDrawing;
|
|
3029
|
+
static create(id: string, points: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<PolylineOptions>): Polyline;
|
|
3030
|
+
}
|
|
3031
|
+
|
|
3032
|
+
/**
|
|
3033
|
+
* Polyline options
|
|
3034
|
+
*/
|
|
3035
|
+
export declare interface PolylineOptions extends DrawingOptions {
|
|
3036
|
+
showVertices?: boolean;
|
|
3037
|
+
vertexRadius?: number;
|
|
3038
|
+
}
|
|
3039
|
+
|
|
3040
|
+
export declare class PolylinePaneView implements IPrimitivePaneView {
|
|
3041
|
+
private _renderer;
|
|
3042
|
+
constructor(drawing: Polyline);
|
|
3043
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
3044
|
+
renderer(): IPrimitivePaneRenderer;
|
|
3045
|
+
}
|
|
3046
|
+
|
|
3047
|
+
/**
|
|
3048
|
+
* Base preview renderer with common functionality
|
|
3049
|
+
*/
|
|
3050
|
+
export declare abstract class PreviewRenderer implements IPreviewRenderer {
|
|
3051
|
+
abstract render(ctx: CanvasRenderingContext2D, anchors: Anchor[], previewAnchor: Anchor | null, viewport: Viewport, style: DrawingStyle, pixelRatio: number): void;
|
|
3052
|
+
protected anchorToPixel(anchor: Anchor, viewport: Viewport): Point | null;
|
|
3053
|
+
protected drawAnchorPoint(ctx: CanvasRenderingContext2D, point: Point, pixelRatio: number): void;
|
|
3054
|
+
}
|
|
3055
|
+
|
|
3056
|
+
/**
|
|
3057
|
+
* Price Label - A simple price label with arrow pointer.
|
|
3058
|
+
*
|
|
3059
|
+
* Features:
|
|
3060
|
+
* - Single anchor point
|
|
3061
|
+
* - Shows price value in a badge
|
|
3062
|
+
* - Arrow pointer to the price level
|
|
3063
|
+
* - Extends to the right edge
|
|
3064
|
+
*/
|
|
3065
|
+
export declare class PriceLabel extends Drawing {
|
|
3066
|
+
readonly type = "price-label";
|
|
3067
|
+
protected static readonly REQUIRED_ANCHORS = 1;
|
|
3068
|
+
protected static readonly HIT_THRESHOLD = 10;
|
|
3069
|
+
private _labelOptions;
|
|
3070
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<PriceLabelOptions>);
|
|
3071
|
+
get labelOptions(): PriceLabelOptions;
|
|
3072
|
+
setLabelOptions(options: Partial<PriceLabelOptions>): void;
|
|
3073
|
+
getPrice(): number;
|
|
3074
|
+
isValid(): boolean;
|
|
3075
|
+
paneViews(): IPrimitivePaneView[];
|
|
3076
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
3077
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
3078
|
+
clone(newId: string): IDrawing;
|
|
3079
|
+
static create(id: string, position: Anchor, style?: Partial<DrawingStyle>, options?: Partial<PriceLabelOptions>): PriceLabel;
|
|
3080
|
+
}
|
|
3081
|
+
|
|
3082
|
+
/**
|
|
3083
|
+
* Price Label options
|
|
3084
|
+
*/
|
|
3085
|
+
export declare interface PriceLabelOptions extends DrawingOptions {
|
|
3086
|
+
fontSize?: number;
|
|
3087
|
+
backgroundColor?: string;
|
|
3088
|
+
textColor?: string;
|
|
3089
|
+
showArrow?: boolean;
|
|
3090
|
+
arrowDirection?: 'left' | 'right';
|
|
3091
|
+
decimals?: number;
|
|
3092
|
+
}
|
|
3093
|
+
|
|
3094
|
+
export declare class PriceLabelPaneView implements IPrimitivePaneView {
|
|
3095
|
+
private _renderer;
|
|
3096
|
+
constructor(drawing: PriceLabel);
|
|
3097
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
3098
|
+
renderer(): IPrimitivePaneRenderer;
|
|
3099
|
+
}
|
|
3100
|
+
|
|
3101
|
+
/**
|
|
3102
|
+
* Price Note - Displays price and optional note at a specific point.
|
|
3103
|
+
*
|
|
3104
|
+
* Features:
|
|
3105
|
+
* - Single anchor point
|
|
3106
|
+
* - Shows price value
|
|
3107
|
+
* - Optional note text
|
|
3108
|
+
* - Customizable colors
|
|
3109
|
+
*/
|
|
3110
|
+
export declare class PriceNote extends Drawing {
|
|
3111
|
+
readonly type = "price-note";
|
|
3112
|
+
protected static readonly REQUIRED_ANCHORS = 1;
|
|
3113
|
+
protected static readonly HIT_THRESHOLD = 10;
|
|
3114
|
+
private _noteOptions;
|
|
3115
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<PriceNoteOptions>);
|
|
3116
|
+
get noteOptions(): PriceNoteOptions;
|
|
3117
|
+
setNoteOptions(options: Partial<PriceNoteOptions>): void;
|
|
3118
|
+
setNote(note: string): void;
|
|
3119
|
+
getNote(): string;
|
|
3120
|
+
getPrice(): number;
|
|
3121
|
+
isValid(): boolean;
|
|
3122
|
+
paneViews(): IPrimitivePaneView[];
|
|
3123
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
3124
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
3125
|
+
clone(newId: string): IDrawing;
|
|
3126
|
+
static create(id: string, position: Anchor, note?: string, style?: Partial<DrawingStyle>, options?: Partial<PriceNoteOptions>): PriceNote;
|
|
3127
|
+
}
|
|
3128
|
+
|
|
3129
|
+
/**
|
|
3130
|
+
* Price Note options
|
|
3131
|
+
*/
|
|
3132
|
+
export declare interface PriceNoteOptions extends DrawingOptions {
|
|
3133
|
+
note?: string;
|
|
3134
|
+
showPrice?: boolean;
|
|
3135
|
+
showTime?: boolean;
|
|
3136
|
+
fontSize?: number;
|
|
3137
|
+
backgroundColor?: string;
|
|
3138
|
+
priceColor?: string;
|
|
3139
|
+
noteColor?: string;
|
|
3140
|
+
}
|
|
3141
|
+
|
|
3142
|
+
export declare class PriceNotePaneView implements IPrimitivePaneView {
|
|
3143
|
+
private _renderer;
|
|
3144
|
+
constructor(drawing: PriceNote);
|
|
3145
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
3146
|
+
renderer(): IPrimitivePaneRenderer;
|
|
3147
|
+
}
|
|
3148
|
+
|
|
3149
|
+
/**
|
|
3150
|
+
* PriceRange - A highlighted price zone between two price levels.
|
|
3151
|
+
*
|
|
3152
|
+
* Features:
|
|
3153
|
+
* - Two anchor points (top and bottom of range)
|
|
3154
|
+
* - Shows price range and percentage change
|
|
3155
|
+
* - Spans full viewport width
|
|
3156
|
+
*/
|
|
3157
|
+
export declare class PriceRange extends Drawing {
|
|
3158
|
+
readonly type = "price-range";
|
|
3159
|
+
protected static readonly REQUIRED_ANCHORS = 2;
|
|
3160
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
3161
|
+
private _priceRangeOptions;
|
|
3162
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<PriceRangeOptions>);
|
|
3163
|
+
get priceRangeOptions(): PriceRangeOptions;
|
|
3164
|
+
setPriceRangeOptions(options: Partial<PriceRangeOptions>): void;
|
|
3165
|
+
isValid(): boolean;
|
|
3166
|
+
paneViews(): IPrimitivePaneView[];
|
|
3167
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
3168
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
3169
|
+
/**
|
|
3170
|
+
* Get the price range information
|
|
3171
|
+
*/
|
|
3172
|
+
getRangeInfo(): {
|
|
3173
|
+
min: number;
|
|
3174
|
+
max: number;
|
|
3175
|
+
range: number;
|
|
3176
|
+
percentage: number;
|
|
3177
|
+
};
|
|
3178
|
+
clone(newId: string): IDrawing;
|
|
3179
|
+
static create(id: string, price1: number, price2: number, time: number | string, style?: Partial<DrawingStyle>, options?: Partial<PriceRangeOptions>): PriceRange;
|
|
3180
|
+
}
|
|
3181
|
+
|
|
3182
|
+
/**
|
|
3183
|
+
* PriceRange options
|
|
3184
|
+
*/
|
|
3185
|
+
export declare interface PriceRangeOptions extends DrawingOptions {
|
|
3186
|
+
showPrices?: boolean;
|
|
3187
|
+
showRange?: boolean;
|
|
3188
|
+
showPercentage?: boolean;
|
|
3189
|
+
}
|
|
3190
|
+
|
|
3191
|
+
export declare class PriceRangePaneView implements IPrimitivePaneView {
|
|
3192
|
+
private _renderer;
|
|
3193
|
+
constructor(drawing: PriceRange);
|
|
3194
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
3195
|
+
renderer(): IPrimitivePaneRenderer;
|
|
3196
|
+
}
|
|
3197
|
+
|
|
3198
|
+
/**
|
|
3199
|
+
* Projection - Price projection tool.
|
|
3200
|
+
*
|
|
3201
|
+
* Features:
|
|
3202
|
+
* - Three anchor points: initial move (A to B), projection start (C)
|
|
3203
|
+
* - Projects the A-B move from point C
|
|
3204
|
+
* - Shows target price and percentage
|
|
3205
|
+
*/
|
|
3206
|
+
export declare class Projection extends Drawing {
|
|
3207
|
+
readonly type = "projection";
|
|
3208
|
+
protected static readonly REQUIRED_ANCHORS = 3;
|
|
3209
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
3210
|
+
private _projectionOptions;
|
|
3211
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<ProjectionOptions>);
|
|
3212
|
+
get projectionOptions(): ProjectionOptions;
|
|
3213
|
+
setProjectionOptions(options: Partial<ProjectionOptions>): void;
|
|
3214
|
+
isValid(): boolean;
|
|
3215
|
+
paneViews(): IPrimitivePaneView[];
|
|
3216
|
+
/**
|
|
3217
|
+
* Get projection info
|
|
3218
|
+
* Anchors: [0] = A (start of reference move)
|
|
3219
|
+
* [1] = B (end of reference move)
|
|
3220
|
+
* [2] = C (projection start point)
|
|
3221
|
+
*/
|
|
3222
|
+
getProjectionInfo(): {
|
|
3223
|
+
priceA: number;
|
|
3224
|
+
priceB: number;
|
|
3225
|
+
priceC: number;
|
|
3226
|
+
targetPrice: number;
|
|
3227
|
+
moveSize: number;
|
|
3228
|
+
movePercent: number;
|
|
3229
|
+
isUp: boolean;
|
|
3230
|
+
};
|
|
3231
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
3232
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
3233
|
+
clone(newId: string): IDrawing;
|
|
3234
|
+
static create(id: string, pointA: Anchor, pointB: Anchor, pointC: Anchor, style?: Partial<DrawingStyle>, options?: Partial<ProjectionOptions>): Projection;
|
|
3235
|
+
}
|
|
3236
|
+
|
|
3237
|
+
/**
|
|
3238
|
+
* Projection options
|
|
3239
|
+
*/
|
|
3240
|
+
export declare interface ProjectionOptions extends DrawingOptions {
|
|
3241
|
+
showPrices?: boolean;
|
|
3242
|
+
showPercentage?: boolean;
|
|
3243
|
+
showLabels?: boolean;
|
|
3244
|
+
filled?: boolean;
|
|
3245
|
+
}
|
|
3246
|
+
|
|
3247
|
+
export declare class ProjectionPaneView implements IPrimitivePaneView {
|
|
3248
|
+
private _renderer;
|
|
3249
|
+
constructor(drawing: Projection);
|
|
3250
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
3251
|
+
renderer(): IPrimitivePaneRenderer;
|
|
3252
|
+
}
|
|
3253
|
+
|
|
3254
|
+
/**
|
|
3255
|
+
* Ray - A line that extends infinitely in one direction from the first anchor.
|
|
3256
|
+
*
|
|
3257
|
+
* Features:
|
|
3258
|
+
* - Two anchor points define the direction
|
|
3259
|
+
* - Extends infinitely from first anchor through second anchor
|
|
3260
|
+
* - Optional angle display
|
|
3261
|
+
*/
|
|
3262
|
+
export declare class Ray extends BaseLine {
|
|
3263
|
+
readonly type = "ray";
|
|
3264
|
+
private _rayOptions;
|
|
3265
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<RayOptions>);
|
|
3266
|
+
get rayOptions(): RayOptions;
|
|
3267
|
+
setRayOptions(options: Partial<RayOptions>): void;
|
|
3268
|
+
paneViews(): IPrimitivePaneView[];
|
|
3269
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
3270
|
+
clone(newId: string): IDrawing;
|
|
3271
|
+
static create(id: string, startAnchor: Anchor, endAnchor: Anchor, style?: Partial<DrawingStyle>, options?: Partial<RayOptions>): Ray;
|
|
3272
|
+
}
|
|
3273
|
+
|
|
3274
|
+
/**
|
|
3275
|
+
* Ray options
|
|
3276
|
+
*/
|
|
3277
|
+
export declare interface RayOptions extends DrawingOptions {
|
|
3278
|
+
showAngle?: boolean;
|
|
3279
|
+
}
|
|
3280
|
+
|
|
3281
|
+
export declare class RayPaneView implements IPrimitivePaneView {
|
|
3282
|
+
private _renderer;
|
|
3283
|
+
constructor(drawing: Ray);
|
|
3284
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
3285
|
+
renderer(): IPrimitivePaneRenderer;
|
|
3286
|
+
}
|
|
3287
|
+
|
|
3288
|
+
/**
|
|
3289
|
+
* Rectangle - A rectangular shape defined by two corner points.
|
|
3290
|
+
*
|
|
3291
|
+
* Features:
|
|
3292
|
+
* - Two anchor points (opposite corners)
|
|
3293
|
+
* - Optional fill
|
|
3294
|
+
* - Optional dimension labels
|
|
3295
|
+
*/
|
|
3296
|
+
export declare class Rectangle extends Drawing {
|
|
3297
|
+
readonly type = "rectangle";
|
|
3298
|
+
protected static readonly REQUIRED_ANCHORS = 2;
|
|
3299
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
3300
|
+
private _rectangleOptions;
|
|
3301
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<RectangleOptions>);
|
|
3302
|
+
get rectangleOptions(): RectangleOptions;
|
|
3303
|
+
setRectangleOptions(options: Partial<RectangleOptions>): void;
|
|
3304
|
+
isValid(): boolean;
|
|
3305
|
+
paneViews(): IPrimitivePaneView[];
|
|
3306
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
3307
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
3308
|
+
/**
|
|
3309
|
+
* Get price range of the rectangle
|
|
3310
|
+
*/
|
|
3311
|
+
getPriceRange(): {
|
|
3312
|
+
min: number;
|
|
3313
|
+
max: number;
|
|
3314
|
+
range: number;
|
|
3315
|
+
};
|
|
3316
|
+
clone(newId: string): IDrawing;
|
|
3317
|
+
static create(id: string, corner1: Anchor, corner2: Anchor, style?: Partial<DrawingStyle>, options?: Partial<RectangleOptions>): Rectangle;
|
|
3318
|
+
}
|
|
3319
|
+
|
|
3320
|
+
/**
|
|
3321
|
+
* Rectangle geometry
|
|
3322
|
+
*/
|
|
3323
|
+
export declare interface RectangleGeometry {
|
|
3324
|
+
type: 'rectangle';
|
|
3325
|
+
topLeft: Point;
|
|
3326
|
+
width: number;
|
|
3327
|
+
height: number;
|
|
3328
|
+
rotation?: number;
|
|
3329
|
+
}
|
|
3330
|
+
|
|
3331
|
+
/**
|
|
3332
|
+
* Rectangle options
|
|
3333
|
+
*/
|
|
3334
|
+
export declare interface RectangleOptions extends DrawingOptions {
|
|
3335
|
+
filled?: boolean;
|
|
3336
|
+
showDimensions?: boolean;
|
|
3337
|
+
}
|
|
3338
|
+
|
|
3339
|
+
export declare class RectanglePaneView implements IPrimitivePaneView {
|
|
3340
|
+
private _renderer;
|
|
3341
|
+
constructor(drawing: Rectangle);
|
|
3342
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
3343
|
+
renderer(): IPrimitivePaneRenderer;
|
|
3344
|
+
}
|
|
3345
|
+
|
|
3346
|
+
/**
|
|
3347
|
+
* RegressionTrend - Linear regression channel with standard deviation bands.
|
|
3348
|
+
*
|
|
3349
|
+
* Features:
|
|
3350
|
+
* - Two anchor points define the regression range
|
|
3351
|
+
* - Linear regression calculates the best-fit line
|
|
3352
|
+
* - Channel width based on standard deviation
|
|
3353
|
+
* - Optional fill between lines
|
|
3354
|
+
* - Optional line extensions
|
|
3355
|
+
*/
|
|
3356
|
+
export declare class RegressionTrend extends Drawing {
|
|
3357
|
+
readonly type = "regression-trend";
|
|
3358
|
+
protected static readonly REQUIRED_ANCHORS = 2;
|
|
3359
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
3360
|
+
private _channelOptions;
|
|
3361
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<RegressionTrendOptions>);
|
|
3362
|
+
get channelOptions(): RegressionTrendOptions;
|
|
3363
|
+
setChannelOptions(options: Partial<RegressionTrendOptions>): void;
|
|
3364
|
+
isValid(): boolean;
|
|
3365
|
+
paneViews(): IPrimitivePaneView[];
|
|
3366
|
+
/**
|
|
3367
|
+
* Calculate linear regression parameters
|
|
3368
|
+
*/
|
|
3369
|
+
calculateRegression(p1: Point, p2: Point): {
|
|
3370
|
+
slope: number;
|
|
3371
|
+
intercept: number;
|
|
3372
|
+
stdDev: number;
|
|
3373
|
+
};
|
|
3374
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
3375
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
3376
|
+
clone(newId: string): IDrawing;
|
|
3377
|
+
static create(id: string, start: Anchor, end: Anchor, style?: Partial<DrawingStyle>, options?: Partial<RegressionTrendOptions>): RegressionTrend;
|
|
3378
|
+
}
|
|
3379
|
+
|
|
3380
|
+
/**
|
|
3381
|
+
* RegressionTrend options
|
|
3382
|
+
*/
|
|
3383
|
+
export declare interface RegressionTrendOptions extends DrawingOptions {
|
|
3384
|
+
filled?: boolean;
|
|
3385
|
+
showMiddleLine?: boolean;
|
|
3386
|
+
extendLines?: boolean;
|
|
3387
|
+
standardDeviations?: number;
|
|
3388
|
+
}
|
|
3389
|
+
|
|
3390
|
+
export declare class RegressionTrendPaneView implements IPrimitivePaneView {
|
|
3391
|
+
private _renderer;
|
|
3392
|
+
constructor(drawing: RegressionTrend);
|
|
3393
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
3394
|
+
renderer(): IPrimitivePaneRenderer;
|
|
3395
|
+
}
|
|
3396
|
+
|
|
3397
|
+
/**
|
|
3398
|
+
* RotatedRectangle - A rectangular shape that can be rotated to any angle.
|
|
3399
|
+
*
|
|
3400
|
+
* Features:
|
|
3401
|
+
* - Three anchor points: first two define one edge, third defines height
|
|
3402
|
+
* - Rotation determined by the angle of the first edge
|
|
3403
|
+
* - Optional fill
|
|
3404
|
+
* - Optional dimension labels
|
|
3405
|
+
*/
|
|
3406
|
+
export declare class RotatedRectangle extends Drawing {
|
|
3407
|
+
readonly type = "rotated-rectangle";
|
|
3408
|
+
protected static readonly REQUIRED_ANCHORS = 3;
|
|
3409
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
3410
|
+
private _rotatedRectangleOptions;
|
|
3411
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<RotatedRectangleOptions>);
|
|
3412
|
+
get rotatedRectangleOptions(): RotatedRectangleOptions;
|
|
3413
|
+
setRotatedRectangleOptions(options: Partial<RotatedRectangleOptions>): void;
|
|
3414
|
+
isValid(): boolean;
|
|
3415
|
+
paneViews(): IPrimitivePaneView[];
|
|
3416
|
+
/**
|
|
3417
|
+
* Get the four corners of the rotated rectangle
|
|
3418
|
+
*/
|
|
3419
|
+
getCorners(viewport: Viewport): Point[] | null;
|
|
3420
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
3421
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
3422
|
+
private pointInPolygon;
|
|
3423
|
+
clone(newId: string): IDrawing;
|
|
3424
|
+
static create(id: string, p1: Anchor, p2: Anchor, p3: Anchor, style?: Partial<DrawingStyle>, options?: Partial<RotatedRectangleOptions>): RotatedRectangle;
|
|
3425
|
+
}
|
|
3426
|
+
|
|
3427
|
+
/**
|
|
3428
|
+
* Rotated Rectangle options
|
|
3429
|
+
*/
|
|
3430
|
+
export declare interface RotatedRectangleOptions extends DrawingOptions {
|
|
3431
|
+
filled?: boolean;
|
|
3432
|
+
showDimensions?: boolean;
|
|
3433
|
+
}
|
|
3434
|
+
|
|
3435
|
+
export declare class RotatedRectanglePaneView implements IPrimitivePaneView {
|
|
3436
|
+
private _renderer;
|
|
3437
|
+
constructor(drawing: RotatedRectangle);
|
|
3438
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
3439
|
+
renderer(): IPrimitivePaneRenderer;
|
|
3440
|
+
}
|
|
3441
|
+
|
|
3442
|
+
/**
|
|
3443
|
+
* Rotate point around center
|
|
3444
|
+
*/
|
|
3445
|
+
export declare function rotatePoint(point: Point, center: Point, angle: number): Point;
|
|
3446
|
+
|
|
3447
|
+
/**
|
|
3448
|
+
* SchiffPitchfork - Schiff Pitchfork variant.
|
|
3449
|
+
*
|
|
3450
|
+
* The Schiff Pitchfork differs from Andrews' Pitchfork in that the median line
|
|
3451
|
+
* starts from the midpoint between the pivot (p0) and the first swing point (p1),
|
|
3452
|
+
* rather than from the pivot itself. This creates a less steep median line.
|
|
3453
|
+
*
|
|
3454
|
+
* Features:
|
|
3455
|
+
* - Three anchor points (pivot, and two swing points)
|
|
3456
|
+
* - Median line from midpoint(p0,p1) through midpoint of swings
|
|
3457
|
+
* - Parallel outer lines through swing points
|
|
3458
|
+
* - Optional fill between lines
|
|
3459
|
+
*/
|
|
3460
|
+
export declare class SchiffPitchfork extends Drawing {
|
|
3461
|
+
readonly type = "schiff-pitchfork";
|
|
3462
|
+
protected static readonly REQUIRED_ANCHORS = 3;
|
|
3463
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
3464
|
+
private _pitchforkOptions;
|
|
3465
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<SchiffPitchforkOptions>);
|
|
3466
|
+
get pitchforkOptions(): SchiffPitchforkOptions;
|
|
3467
|
+
setPitchforkOptions(options: Partial<SchiffPitchforkOptions>): void;
|
|
3468
|
+
isValid(): boolean;
|
|
3469
|
+
paneViews(): IPrimitivePaneView[];
|
|
3470
|
+
/**
|
|
3471
|
+
* Calculate the Schiff pivot point (midpoint between p0 and p1)
|
|
3472
|
+
*/
|
|
3473
|
+
getSchiffPivot(p0: Point, p1: Point): Point;
|
|
3474
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
3475
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
3476
|
+
clone(newId: string): IDrawing;
|
|
3477
|
+
static create(id: string, pivot: Anchor, swing1: Anchor, swing2: Anchor, style?: Partial<DrawingStyle>, options?: Partial<SchiffPitchforkOptions>): SchiffPitchfork;
|
|
3478
|
+
}
|
|
3479
|
+
|
|
3480
|
+
/**
|
|
3481
|
+
* SchiffPitchfork options
|
|
3482
|
+
*/
|
|
3483
|
+
export declare interface SchiffPitchforkOptions extends DrawingOptions {
|
|
3484
|
+
showMedianLine?: boolean;
|
|
3485
|
+
showOuterLines?: boolean;
|
|
3486
|
+
extendLines?: boolean;
|
|
3487
|
+
filled?: boolean;
|
|
3488
|
+
}
|
|
3489
|
+
|
|
3490
|
+
export declare class SchiffPitchforkPaneView implements IPrimitivePaneView {
|
|
3491
|
+
private _renderer;
|
|
3492
|
+
constructor(drawing: SchiffPitchfork);
|
|
3493
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
3494
|
+
renderer(): IPrimitivePaneRenderer;
|
|
3495
|
+
}
|
|
3496
|
+
|
|
3497
|
+
/**
|
|
3498
|
+
* Serialized drawing data for persistence
|
|
3499
|
+
*/
|
|
3500
|
+
export declare interface SerializedDrawing {
|
|
3501
|
+
id: string;
|
|
3502
|
+
type: string;
|
|
3503
|
+
anchors: Anchor[];
|
|
3504
|
+
style: DrawingStyle;
|
|
3505
|
+
options: DrawingOptions;
|
|
3506
|
+
}
|
|
3507
|
+
|
|
3508
|
+
/**
|
|
3509
|
+
* ShortPosition - Trade visualization for short positions.
|
|
3510
|
+
*
|
|
3511
|
+
* Features:
|
|
3512
|
+
* - Three anchor points: entry, stop loss, take profit
|
|
3513
|
+
* - Shows risk (red) and reward (green) zones
|
|
3514
|
+
* - Displays P&L, percentage change, and risk/reward ratio
|
|
3515
|
+
*/
|
|
3516
|
+
export declare class ShortPosition extends Drawing {
|
|
3517
|
+
readonly type = "short-position";
|
|
3518
|
+
protected static readonly REQUIRED_ANCHORS = 3;
|
|
3519
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
3520
|
+
private _positionOptions;
|
|
3521
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<ShortPositionOptions>);
|
|
3522
|
+
get positionOptions(): ShortPositionOptions;
|
|
3523
|
+
setPositionOptions(options: Partial<ShortPositionOptions>): void;
|
|
3524
|
+
isValid(): boolean;
|
|
3525
|
+
paneViews(): IPrimitivePaneView[];
|
|
3526
|
+
/**
|
|
3527
|
+
* Get position info
|
|
3528
|
+
* Anchors: [0] = entry, [1] = stop loss (above entry), [2] = take profit (below entry)
|
|
3529
|
+
*/
|
|
3530
|
+
getPositionInfo(): {
|
|
3531
|
+
entry: number;
|
|
3532
|
+
stopLoss: number;
|
|
3533
|
+
takeProfit: number;
|
|
3534
|
+
risk: number;
|
|
3535
|
+
reward: number;
|
|
3536
|
+
riskRewardRatio: number;
|
|
3537
|
+
riskPercent: number;
|
|
3538
|
+
rewardPercent: number;
|
|
3539
|
+
};
|
|
3540
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
3541
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
3542
|
+
clone(newId: string): IDrawing;
|
|
3543
|
+
static create(id: string, entry: Anchor, stopLoss: Anchor, takeProfit: Anchor, style?: Partial<DrawingStyle>, options?: Partial<ShortPositionOptions>): ShortPosition;
|
|
3544
|
+
}
|
|
3545
|
+
|
|
3546
|
+
/**
|
|
3547
|
+
* ShortPosition options
|
|
3548
|
+
*/
|
|
3549
|
+
export declare interface ShortPositionOptions extends DrawingOptions {
|
|
3550
|
+
showPrices?: boolean;
|
|
3551
|
+
showPercentage?: boolean;
|
|
3552
|
+
showRiskReward?: boolean;
|
|
3553
|
+
showPnL?: boolean;
|
|
3554
|
+
quantity?: number;
|
|
3555
|
+
accountSize?: number;
|
|
3556
|
+
}
|
|
3557
|
+
|
|
3558
|
+
export declare class ShortPositionPaneView implements IPrimitivePaneView {
|
|
3559
|
+
private _renderer;
|
|
3560
|
+
constructor(drawing: ShortPosition);
|
|
3561
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
3562
|
+
renderer(): IPrimitivePaneRenderer;
|
|
3563
|
+
}
|
|
3564
|
+
|
|
3565
|
+
/**
|
|
3566
|
+
* Signpost - A directional signpost marker.
|
|
3567
|
+
*
|
|
3568
|
+
* Features:
|
|
3569
|
+
* - Single anchor point
|
|
3570
|
+
* - Directional arrow-shaped sign (left/right)
|
|
3571
|
+
* - Text label on the sign
|
|
3572
|
+
*/
|
|
3573
|
+
export declare class Signpost extends Drawing {
|
|
3574
|
+
readonly type = "signpost";
|
|
3575
|
+
protected static readonly REQUIRED_ANCHORS = 1;
|
|
3576
|
+
protected static readonly HIT_THRESHOLD = 15;
|
|
3577
|
+
private _signpostOptions;
|
|
3578
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<SignpostOptions>);
|
|
3579
|
+
get signpostOptions(): SignpostOptions;
|
|
3580
|
+
setSignpostOptions(options: Partial<SignpostOptions>): void;
|
|
3581
|
+
setText(text: string): void;
|
|
3582
|
+
getText(): string;
|
|
3583
|
+
isValid(): boolean;
|
|
3584
|
+
paneViews(): IPrimitivePaneView[];
|
|
3585
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
3586
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
3587
|
+
clone(newId: string): IDrawing;
|
|
3588
|
+
static create(id: string, position: Anchor, text: string, style?: Partial<DrawingStyle>, options?: Partial<SignpostOptions>): Signpost;
|
|
3589
|
+
}
|
|
3590
|
+
|
|
3591
|
+
/**
|
|
3592
|
+
* Signpost options
|
|
3593
|
+
*/
|
|
3594
|
+
export declare interface SignpostOptions extends DrawingOptions {
|
|
3595
|
+
text?: string;
|
|
3596
|
+
fontSize?: number;
|
|
3597
|
+
backgroundColor?: string;
|
|
3598
|
+
textColor?: string;
|
|
3599
|
+
direction?: 'left' | 'right';
|
|
3600
|
+
}
|
|
3601
|
+
|
|
3602
|
+
export declare class SignpostPaneView implements IPrimitivePaneView {
|
|
3603
|
+
private _renderer;
|
|
3604
|
+
constructor(drawing: Signpost);
|
|
3605
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
3606
|
+
renderer(): IPrimitivePaneRenderer;
|
|
3607
|
+
}
|
|
3608
|
+
|
|
3609
|
+
/**
|
|
3610
|
+
* Single-point interaction handler for vertical/horizontal lines
|
|
3611
|
+
*/
|
|
3612
|
+
export declare class SinglePointInteractionHandler extends InteractionHandler {
|
|
3613
|
+
constructor(config: Omit<InteractionConfig, 'requiredAnchors'>);
|
|
3614
|
+
}
|
|
3615
|
+
|
|
3616
|
+
/**
|
|
3617
|
+
* Snap configuration for interaction
|
|
3618
|
+
*/
|
|
3619
|
+
export declare interface SnapConfig {
|
|
3620
|
+
snapToPrice: boolean;
|
|
3621
|
+
snapToBar: boolean;
|
|
3622
|
+
snapThreshold: number;
|
|
3623
|
+
}
|
|
3624
|
+
|
|
3625
|
+
/**
|
|
3626
|
+
* Table - A data table annotation.
|
|
3627
|
+
*
|
|
3628
|
+
* Features:
|
|
3629
|
+
* - Single anchor point (top-left corner)
|
|
3630
|
+
* - Configurable rows and columns
|
|
3631
|
+
* - Optional header row with distinct styling
|
|
3632
|
+
*/
|
|
3633
|
+
export declare class Table extends Drawing {
|
|
3634
|
+
readonly type = "table";
|
|
3635
|
+
protected static readonly REQUIRED_ANCHORS = 1;
|
|
3636
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
3637
|
+
private _tableOptions;
|
|
3638
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<TableOptions>);
|
|
3639
|
+
get tableOptions(): TableOptions;
|
|
3640
|
+
setTableOptions(options: Partial<TableOptions>): void;
|
|
3641
|
+
setRows(rows: string[][]): void;
|
|
3642
|
+
getRows(): string[][];
|
|
3643
|
+
isValid(): boolean;
|
|
3644
|
+
paneViews(): IPrimitivePaneView[];
|
|
3645
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
3646
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
3647
|
+
clone(newId: string): IDrawing;
|
|
3648
|
+
static create(id: string, position: Anchor, rows?: string[][], style?: Partial<DrawingStyle>, options?: Partial<TableOptions>): Table;
|
|
3649
|
+
}
|
|
3650
|
+
|
|
3651
|
+
/**
|
|
3652
|
+
* Table options
|
|
3653
|
+
*/
|
|
3654
|
+
export declare interface TableOptions extends DrawingOptions {
|
|
3655
|
+
rows?: string[][];
|
|
3656
|
+
headerRow?: boolean;
|
|
3657
|
+
fontSize?: number;
|
|
3658
|
+
backgroundColor?: string;
|
|
3659
|
+
headerColor?: string;
|
|
3660
|
+
textColor?: string;
|
|
3661
|
+
borderColor?: string;
|
|
3662
|
+
cellPadding?: number;
|
|
3663
|
+
}
|
|
3664
|
+
|
|
3665
|
+
export declare class TablePaneView implements IPrimitivePaneView {
|
|
3666
|
+
private _renderer;
|
|
3667
|
+
constructor(drawing: Table);
|
|
3668
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
3669
|
+
renderer(): IPrimitivePaneRenderer;
|
|
3670
|
+
}
|
|
3671
|
+
|
|
3672
|
+
/**
|
|
3673
|
+
* TextAnnotation - A text label placed on the chart.
|
|
3674
|
+
*
|
|
3675
|
+
* Features:
|
|
3676
|
+
* - Single anchor point (position)
|
|
3677
|
+
* - Customizable text, font, alignment
|
|
3678
|
+
* - Optional background and border
|
|
3679
|
+
*/
|
|
3680
|
+
export declare class TextAnnotation extends Drawing {
|
|
3681
|
+
readonly type = "text-annotation";
|
|
3682
|
+
protected static readonly REQUIRED_ANCHORS = 1;
|
|
3683
|
+
protected static readonly HIT_THRESHOLD = 10;
|
|
3684
|
+
private _textOptions;
|
|
3685
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<TextAnnotationOptions>);
|
|
3686
|
+
get textOptions(): TextAnnotationOptions;
|
|
3687
|
+
setTextOptions(options: Partial<TextAnnotationOptions>): void;
|
|
3688
|
+
setText(text: string): void;
|
|
3689
|
+
getText(): string;
|
|
3690
|
+
isValid(): boolean;
|
|
3691
|
+
paneViews(): IPrimitivePaneView[];
|
|
3692
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
3693
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
3694
|
+
clone(newId: string): IDrawing;
|
|
3695
|
+
static create(id: string, position: Anchor, text: string, style?: Partial<DrawingStyle>, options?: Partial<TextAnnotationOptions>): TextAnnotation;
|
|
3696
|
+
}
|
|
3697
|
+
|
|
3698
|
+
/**
|
|
3699
|
+
* TextAnnotation options
|
|
3700
|
+
*/
|
|
3701
|
+
export declare interface TextAnnotationOptions extends DrawingOptions {
|
|
3702
|
+
text?: string;
|
|
3703
|
+
fontSize?: number;
|
|
3704
|
+
fontFamily?: string;
|
|
3705
|
+
fontWeight?: string;
|
|
3706
|
+
textAlign?: CanvasTextAlign;
|
|
3707
|
+
backgroundColor?: string;
|
|
3708
|
+
borderColor?: string;
|
|
3709
|
+
padding?: number;
|
|
3710
|
+
}
|
|
3711
|
+
|
|
3712
|
+
export declare class TextAnnotationPaneView implements IPrimitivePaneView {
|
|
3713
|
+
private _renderer;
|
|
3714
|
+
constructor(drawing: TextAnnotation);
|
|
3715
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
3716
|
+
renderer(): IPrimitivePaneRenderer;
|
|
3717
|
+
}
|
|
3718
|
+
|
|
3719
|
+
/**
|
|
3720
|
+
* Text geometry
|
|
3721
|
+
*/
|
|
3722
|
+
export declare interface TextGeometry {
|
|
3723
|
+
type: 'text';
|
|
3724
|
+
position: Point;
|
|
3725
|
+
text: string;
|
|
3726
|
+
font?: string;
|
|
3727
|
+
color?: string;
|
|
3728
|
+
align?: CanvasTextAlign;
|
|
3729
|
+
baseline?: CanvasTextBaseline;
|
|
3730
|
+
rotation?: number;
|
|
3731
|
+
}
|
|
3732
|
+
|
|
3733
|
+
/**
|
|
3734
|
+
* Three-point interaction handler for channel/pitchfork drawings
|
|
3735
|
+
*/
|
|
3736
|
+
export declare class ThreePointInteractionHandler extends InteractionHandler {
|
|
3737
|
+
constructor(config: Omit<InteractionConfig, 'requiredAnchors'>);
|
|
3738
|
+
}
|
|
3739
|
+
|
|
3740
|
+
/**
|
|
3741
|
+
* Preview renderer for three-point drawings (channels, pitchforks)
|
|
3742
|
+
*/
|
|
3743
|
+
export declare class ThreePointPreviewRenderer extends PreviewRenderer {
|
|
3744
|
+
render(ctx: CanvasRenderingContext2D, anchors: Anchor[], previewAnchor: Anchor | null, viewport: Viewport, style: DrawingStyle, pixelRatio: number): void;
|
|
3745
|
+
}
|
|
3746
|
+
|
|
3747
|
+
/**
|
|
3748
|
+
* All registered drawing tools
|
|
3749
|
+
*/
|
|
3750
|
+
export declare const TOOL_DEFINITIONS: ToolRegistryEntry[];
|
|
3751
|
+
|
|
3752
|
+
/**
|
|
3753
|
+
* Tool Registry - Central registry for all drawing tools.
|
|
3754
|
+
*/
|
|
3755
|
+
export declare class ToolRegistry {
|
|
3756
|
+
private static _instance;
|
|
3757
|
+
private _tools;
|
|
3758
|
+
private constructor();
|
|
3759
|
+
static getInstance(): ToolRegistry;
|
|
3760
|
+
/**
|
|
3761
|
+
* Register a custom tool
|
|
3762
|
+
*/
|
|
3763
|
+
register(entry: ToolRegistryEntry): void;
|
|
3764
|
+
/**
|
|
3765
|
+
* Get tool definition by type
|
|
3766
|
+
*/
|
|
3767
|
+
get(type: string): ToolRegistryEntry | undefined;
|
|
3768
|
+
/**
|
|
3769
|
+
* Get all tool definitions
|
|
3770
|
+
*/
|
|
3771
|
+
getAll(): ToolRegistryEntry[];
|
|
3772
|
+
/**
|
|
3773
|
+
* Get tools by category
|
|
3774
|
+
*/
|
|
3775
|
+
getByCategory(category: DrawingCategory): ToolRegistryEntry[];
|
|
3776
|
+
/**
|
|
3777
|
+
* Get all categories
|
|
3778
|
+
*/
|
|
3779
|
+
getCategories(): DrawingCategory[];
|
|
3780
|
+
/**
|
|
3781
|
+
* Create a drawing instance
|
|
3782
|
+
*/
|
|
3783
|
+
createDrawing(type: string, id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<DrawingOptions>): IDrawing | null;
|
|
3784
|
+
/**
|
|
3785
|
+
* Check if a tool type is registered
|
|
3786
|
+
*/
|
|
3787
|
+
has(type: string): boolean;
|
|
3788
|
+
}
|
|
3789
|
+
|
|
3790
|
+
/**
|
|
3791
|
+
* Tool definition with factory function
|
|
3792
|
+
*/
|
|
3793
|
+
declare interface ToolRegistryEntry extends DrawingToolDefinition {
|
|
3794
|
+
factory: (id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<DrawingOptions>) => IDrawing;
|
|
3795
|
+
}
|
|
3796
|
+
|
|
3797
|
+
/**
|
|
3798
|
+
* TrendAngle - A line that displays its angle with a visual arc indicator.
|
|
3799
|
+
*
|
|
3800
|
+
* Features:
|
|
3801
|
+
* - Two anchor points
|
|
3802
|
+
* - Visual arc showing the angle from horizontal
|
|
3803
|
+
* - Degree label display
|
|
3804
|
+
* - Useful for measuring trend slopes
|
|
3805
|
+
*/
|
|
3806
|
+
export declare class TrendAngle extends BaseLine {
|
|
3807
|
+
readonly type = "trend-angle";
|
|
3808
|
+
private _trendAngleOptions;
|
|
3809
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<TrendAngleOptions>);
|
|
3810
|
+
get trendAngleOptions(): TrendAngleOptions;
|
|
3811
|
+
setTrendAngleOptions(options: Partial<TrendAngleOptions>): void;
|
|
3812
|
+
paneViews(): IPrimitivePaneView[];
|
|
3813
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
3814
|
+
/**
|
|
3815
|
+
* Get the angle in radians (from horizontal)
|
|
3816
|
+
*/
|
|
3817
|
+
private getAngleRadians;
|
|
3818
|
+
/**
|
|
3819
|
+
* Get the angle in degrees
|
|
3820
|
+
*/
|
|
3821
|
+
getAngle(): number;
|
|
3822
|
+
clone(newId: string): IDrawing;
|
|
3823
|
+
static create(id: string, startAnchor: Anchor, endAnchor: Anchor, style?: Partial<DrawingStyle>, options?: Partial<TrendAngleOptions>): TrendAngle;
|
|
3824
|
+
}
|
|
3825
|
+
|
|
3826
|
+
/**
|
|
3827
|
+
* TrendAngle options
|
|
3828
|
+
*/
|
|
3829
|
+
export declare interface TrendAngleOptions extends DrawingOptions {
|
|
3830
|
+
showArc?: boolean;
|
|
3831
|
+
arcRadius?: number;
|
|
3832
|
+
showDegrees?: boolean;
|
|
3833
|
+
}
|
|
3834
|
+
|
|
3835
|
+
export declare class TrendAnglePaneView implements IPrimitivePaneView {
|
|
3836
|
+
private _renderer;
|
|
3837
|
+
constructor(drawing: TrendAngle);
|
|
3838
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
3839
|
+
renderer(): IPrimitivePaneRenderer;
|
|
3840
|
+
}
|
|
3841
|
+
|
|
3842
|
+
/**
|
|
3843
|
+
* TrendLine - The most advanced line drawing tool.
|
|
3844
|
+
*
|
|
3845
|
+
* Features:
|
|
3846
|
+
* - Two-point line drawing
|
|
3847
|
+
* - Optional line extensions (left/right)
|
|
3848
|
+
* - Optional angle display
|
|
3849
|
+
* - Optional price/percentage change display
|
|
3850
|
+
* - Optional bar count display
|
|
3851
|
+
* - Hit testing for selection
|
|
3852
|
+
* - Anchor manipulation
|
|
3853
|
+
*/
|
|
3854
|
+
export declare class TrendLine extends BaseLine {
|
|
3855
|
+
readonly type = "trend-line";
|
|
3856
|
+
private _trendLineOptions;
|
|
3857
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<TrendLineOptions>);
|
|
3858
|
+
get trendLineOptions(): TrendLineOptions;
|
|
3859
|
+
setTrendLineOptions(options: Partial<TrendLineOptions>): void;
|
|
3860
|
+
paneViews(): IPrimitivePaneView[];
|
|
3861
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
3862
|
+
private computeLabelGeometry;
|
|
3863
|
+
clone(newId: string): IDrawing;
|
|
3864
|
+
toJSON(): {
|
|
3865
|
+
options: {
|
|
3866
|
+
showAngle?: boolean;
|
|
3867
|
+
showPriceChange?: boolean;
|
|
3868
|
+
showPercentChange?: boolean;
|
|
3869
|
+
showBars?: boolean;
|
|
3870
|
+
visible?: boolean;
|
|
3871
|
+
locked?: boolean;
|
|
3872
|
+
zIndex?: number;
|
|
3873
|
+
extendLeft?: boolean;
|
|
3874
|
+
extendRight?: boolean;
|
|
3875
|
+
};
|
|
3876
|
+
id: string;
|
|
3877
|
+
type: string;
|
|
3878
|
+
anchors: Anchor[];
|
|
3879
|
+
style: DrawingStyle;
|
|
3880
|
+
};
|
|
3881
|
+
fromJSON(data: any): void;
|
|
3882
|
+
static create(id: string, startAnchor: Anchor, endAnchor: Anchor, style?: Partial<DrawingStyle>, options?: Partial<TrendLineOptions>): TrendLine;
|
|
3883
|
+
}
|
|
3884
|
+
|
|
3885
|
+
/**
|
|
3886
|
+
* TrendLine options beyond base drawing options
|
|
3887
|
+
*/
|
|
3888
|
+
export declare interface TrendLineOptions extends DrawingOptions {
|
|
3889
|
+
showAngle?: boolean;
|
|
3890
|
+
showPriceChange?: boolean;
|
|
3891
|
+
showPercentChange?: boolean;
|
|
3892
|
+
showBars?: boolean;
|
|
3893
|
+
}
|
|
3894
|
+
|
|
3895
|
+
/**
|
|
3896
|
+
* Specialized pane view for TrendLine with label support
|
|
3897
|
+
*/
|
|
3898
|
+
export declare class TrendLinePaneView implements IPrimitivePaneView {
|
|
3899
|
+
private _renderer;
|
|
3900
|
+
constructor(drawing: TrendLine);
|
|
3901
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
3902
|
+
renderer(): IPrimitivePaneRenderer;
|
|
3903
|
+
}
|
|
3904
|
+
|
|
3905
|
+
/**
|
|
3906
|
+
* Triangle - A triangular shape defined by three points.
|
|
3907
|
+
*
|
|
3908
|
+
* Features:
|
|
3909
|
+
* - Three anchor points (vertices)
|
|
3910
|
+
* - Optional fill
|
|
3911
|
+
*/
|
|
3912
|
+
export declare class Triangle extends Drawing {
|
|
3913
|
+
readonly type = "triangle";
|
|
3914
|
+
protected static readonly REQUIRED_ANCHORS = 3;
|
|
3915
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
3916
|
+
private _triangleOptions;
|
|
3917
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<TriangleOptions>);
|
|
3918
|
+
get triangleOptions(): TriangleOptions;
|
|
3919
|
+
setTriangleOptions(options: Partial<TriangleOptions>): void;
|
|
3920
|
+
isValid(): boolean;
|
|
3921
|
+
paneViews(): IPrimitivePaneView[];
|
|
3922
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
3923
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
3924
|
+
private isPointInTriangle;
|
|
3925
|
+
clone(newId: string): IDrawing;
|
|
3926
|
+
static create(id: string, p1: Anchor, p2: Anchor, p3: Anchor, style?: Partial<DrawingStyle>, options?: Partial<TriangleOptions>): Triangle;
|
|
3927
|
+
}
|
|
3928
|
+
|
|
3929
|
+
/**
|
|
3930
|
+
* Triangle options
|
|
3931
|
+
*/
|
|
3932
|
+
export declare interface TriangleOptions extends DrawingOptions {
|
|
3933
|
+
filled?: boolean;
|
|
3934
|
+
}
|
|
3935
|
+
|
|
3936
|
+
export declare class TrianglePaneView implements IPrimitivePaneView {
|
|
3937
|
+
private _renderer;
|
|
3938
|
+
constructor(drawing: Triangle);
|
|
3939
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
3940
|
+
renderer(): IPrimitivePaneRenderer;
|
|
3941
|
+
}
|
|
3942
|
+
|
|
3943
|
+
/**
|
|
3944
|
+
* Two-point interaction handler for line-based drawings
|
|
3945
|
+
*/
|
|
3946
|
+
export declare class TwoPointInteractionHandler extends InteractionHandler {
|
|
3947
|
+
constructor(config: Omit<InteractionConfig, 'requiredAnchors'>);
|
|
3948
|
+
}
|
|
3949
|
+
|
|
3950
|
+
export declare const VERSION = "0.1.0";
|
|
3951
|
+
|
|
3952
|
+
/**
|
|
3953
|
+
* VerticalLine - A vertical line at a specific time.
|
|
3954
|
+
*
|
|
3955
|
+
* Features:
|
|
3956
|
+
* - Single anchor point (time)
|
|
3957
|
+
* - Extends across entire viewport height
|
|
3958
|
+
* - Optional time label
|
|
3959
|
+
* - Optional custom label text
|
|
3960
|
+
*/
|
|
3961
|
+
export declare class VerticalLine extends Drawing {
|
|
3962
|
+
readonly type = "vertical-line";
|
|
3963
|
+
protected static readonly REQUIRED_ANCHORS = 1;
|
|
3964
|
+
protected static readonly HIT_THRESHOLD = 5;
|
|
3965
|
+
private _verticalLineOptions;
|
|
3966
|
+
constructor(id: string, anchors?: Anchor[], style?: Partial<DrawingStyle>, options?: Partial<VerticalLineOptions>);
|
|
3967
|
+
get verticalLineOptions(): VerticalLineOptions;
|
|
3968
|
+
setVerticalLineOptions(options: Partial<VerticalLineOptions>): void;
|
|
3969
|
+
isValid(): boolean;
|
|
3970
|
+
paneViews(): IPrimitivePaneView[];
|
|
3971
|
+
computeGeometry(viewport: Viewport): Geometry[];
|
|
3972
|
+
testHit(point: Point, viewport: Viewport): boolean;
|
|
3973
|
+
clone(newId: string): IDrawing;
|
|
3974
|
+
static create(id: string, time: number | string, price: number, style?: Partial<DrawingStyle>, options?: Partial<VerticalLineOptions>): VerticalLine;
|
|
3975
|
+
}
|
|
3976
|
+
|
|
3977
|
+
/**
|
|
3978
|
+
* VerticalLine options
|
|
3979
|
+
*/
|
|
3980
|
+
export declare interface VerticalLineOptions extends DrawingOptions {
|
|
3981
|
+
showTime?: boolean;
|
|
3982
|
+
showLabel?: boolean;
|
|
3983
|
+
labelText?: string;
|
|
3984
|
+
}
|
|
3985
|
+
|
|
3986
|
+
export declare class VerticalLinePaneView implements IPrimitivePaneView {
|
|
3987
|
+
private _renderer;
|
|
3988
|
+
constructor(drawing: VerticalLine);
|
|
3989
|
+
zOrder(): 'bottom' | 'normal' | 'top';
|
|
3990
|
+
renderer(): IPrimitivePaneRenderer;
|
|
3991
|
+
}
|
|
3992
|
+
|
|
3993
|
+
/**
|
|
3994
|
+
* Preview renderer for vertical line (single point)
|
|
3995
|
+
*/
|
|
3996
|
+
export declare class VerticalLinePreviewRenderer extends PreviewRenderer {
|
|
3997
|
+
render(ctx: CanvasRenderingContext2D, anchors: Anchor[], previewAnchor: Anchor | null, viewport: Viewport, style: DrawingStyle, pixelRatio: number): void;
|
|
3998
|
+
}
|
|
3999
|
+
|
|
4000
|
+
/**
|
|
4001
|
+
* Viewport information for rendering
|
|
4002
|
+
*/
|
|
4003
|
+
export declare interface Viewport {
|
|
4004
|
+
width: number;
|
|
4005
|
+
height: number;
|
|
4006
|
+
timeScale: {
|
|
4007
|
+
coordinateToTime(x: number): Time | null;
|
|
4008
|
+
timeToCoordinate(time: Time): Coordinate | null;
|
|
4009
|
+
logicalToCoordinate(logical: Logical): Coordinate | null;
|
|
4010
|
+
};
|
|
4011
|
+
priceScale: {
|
|
4012
|
+
coordinateToPrice(y: number): number | null;
|
|
4013
|
+
priceToCoordinate(price: number): Coordinate | null;
|
|
4014
|
+
};
|
|
4015
|
+
}
|
|
4016
|
+
|
|
4017
|
+
export { }
|