wickchart 1.3.0 → 1.5.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 +83 -5
- package/package.json +11 -4
- package/src/core.js +353 -11
- package/src/wick-chart.js +257 -3
- package/types/core.d.ts +243 -3
- package/types/wick-chart.d.ts +233 -3
package/types/wick-chart.d.ts
CHANGED
|
@@ -172,6 +172,12 @@ declare class WickChart extends HTMLElementBase {
|
|
|
172
172
|
idxAtMid: number;
|
|
173
173
|
midX: number;
|
|
174
174
|
};
|
|
175
|
+
_layers: any[];
|
|
176
|
+
_layerClaim: {
|
|
177
|
+
layer: any;
|
|
178
|
+
pointerId: any;
|
|
179
|
+
};
|
|
180
|
+
_layerSeq: number;
|
|
175
181
|
_loadingMore: boolean;
|
|
176
182
|
_noMore: boolean;
|
|
177
183
|
_positions: any[];
|
|
@@ -240,11 +246,12 @@ declare class WickChart extends HTMLElementBase {
|
|
|
240
246
|
fast?: undefined;
|
|
241
247
|
slow?: undefined;
|
|
242
248
|
signal?: undefined;
|
|
249
|
+
smooth?: undefined;
|
|
243
250
|
};
|
|
244
251
|
compute: (bars: any, p: any) => number[];
|
|
245
|
-
range?: undefined;
|
|
246
252
|
color?: undefined;
|
|
247
253
|
guides?: undefined;
|
|
254
|
+
range?: undefined;
|
|
248
255
|
fmt?: undefined;
|
|
249
256
|
} | {
|
|
250
257
|
kind: string;
|
|
@@ -254,11 +261,62 @@ declare class WickChart extends HTMLElementBase {
|
|
|
254
261
|
fast?: undefined;
|
|
255
262
|
slow?: undefined;
|
|
256
263
|
signal?: undefined;
|
|
264
|
+
smooth?: undefined;
|
|
265
|
+
};
|
|
266
|
+
compute: (bars: any, p: any) => number[];
|
|
267
|
+
color?: undefined;
|
|
268
|
+
guides?: undefined;
|
|
269
|
+
range?: undefined;
|
|
270
|
+
fmt?: undefined;
|
|
271
|
+
} | {
|
|
272
|
+
kind: string;
|
|
273
|
+
params: {
|
|
274
|
+
mult?: undefined;
|
|
275
|
+
fast?: undefined;
|
|
276
|
+
slow?: undefined;
|
|
277
|
+
signal?: undefined;
|
|
278
|
+
smooth?: undefined;
|
|
279
|
+
period?: undefined;
|
|
280
|
+
};
|
|
281
|
+
compute: (bars: any) => number[];
|
|
282
|
+
color?: undefined;
|
|
283
|
+
guides?: undefined;
|
|
284
|
+
range?: undefined;
|
|
285
|
+
fmt?: undefined;
|
|
286
|
+
} | {
|
|
287
|
+
kind: string;
|
|
288
|
+
params: {
|
|
289
|
+
period: number;
|
|
290
|
+
mult: number;
|
|
291
|
+
fast?: undefined;
|
|
292
|
+
slow?: undefined;
|
|
293
|
+
signal?: undefined;
|
|
294
|
+
smooth?: undefined;
|
|
257
295
|
};
|
|
258
296
|
compute: (bars: any, p: any) => number[];
|
|
297
|
+
color?: undefined;
|
|
298
|
+
guides?: undefined;
|
|
259
299
|
range?: undefined;
|
|
300
|
+
fmt?: undefined;
|
|
301
|
+
} | {
|
|
302
|
+
kind: string;
|
|
303
|
+
params: {
|
|
304
|
+
period: number;
|
|
305
|
+
mult?: undefined;
|
|
306
|
+
fast?: undefined;
|
|
307
|
+
slow?: undefined;
|
|
308
|
+
signal?: undefined;
|
|
309
|
+
smooth?: undefined;
|
|
310
|
+
};
|
|
311
|
+
compute: (bars: any, p: any) => {
|
|
312
|
+
lines: {
|
|
313
|
+
name: string;
|
|
314
|
+
values: number[];
|
|
315
|
+
}[];
|
|
316
|
+
};
|
|
260
317
|
color?: undefined;
|
|
261
318
|
guides?: undefined;
|
|
319
|
+
range?: undefined;
|
|
262
320
|
fmt?: undefined;
|
|
263
321
|
} | {
|
|
264
322
|
kind: string;
|
|
@@ -268,6 +326,7 @@ declare class WickChart extends HTMLElementBase {
|
|
|
268
326
|
fast?: undefined;
|
|
269
327
|
slow?: undefined;
|
|
270
328
|
signal?: undefined;
|
|
329
|
+
smooth?: undefined;
|
|
271
330
|
};
|
|
272
331
|
compute: (bars: any, p: any) => {
|
|
273
332
|
lines: {
|
|
@@ -275,9 +334,29 @@ declare class WickChart extends HTMLElementBase {
|
|
|
275
334
|
values: number[];
|
|
276
335
|
}[];
|
|
277
336
|
};
|
|
337
|
+
color?: undefined;
|
|
338
|
+
guides?: undefined;
|
|
278
339
|
range?: undefined;
|
|
340
|
+
fmt?: undefined;
|
|
341
|
+
} | {
|
|
342
|
+
kind: string;
|
|
343
|
+
params: {
|
|
344
|
+
period: number;
|
|
345
|
+
mult: number;
|
|
346
|
+
fast?: undefined;
|
|
347
|
+
slow?: undefined;
|
|
348
|
+
signal?: undefined;
|
|
349
|
+
smooth?: undefined;
|
|
350
|
+
};
|
|
351
|
+
compute: (bars: any, p: any) => {
|
|
352
|
+
lines: {
|
|
353
|
+
name: string;
|
|
354
|
+
values: number[];
|
|
355
|
+
}[];
|
|
356
|
+
};
|
|
279
357
|
color?: undefined;
|
|
280
358
|
guides?: undefined;
|
|
359
|
+
range?: undefined;
|
|
281
360
|
fmt?: undefined;
|
|
282
361
|
} | {
|
|
283
362
|
kind: string;
|
|
@@ -287,6 +366,7 @@ declare class WickChart extends HTMLElementBase {
|
|
|
287
366
|
fast?: undefined;
|
|
288
367
|
slow?: undefined;
|
|
289
368
|
signal?: undefined;
|
|
369
|
+
smooth?: undefined;
|
|
290
370
|
};
|
|
291
371
|
guides: number[];
|
|
292
372
|
range: number[];
|
|
@@ -294,15 +374,15 @@ declare class WickChart extends HTMLElementBase {
|
|
|
294
374
|
color: string;
|
|
295
375
|
compute: (bars: any, p: any) => number[];
|
|
296
376
|
} | {
|
|
297
|
-
range?: undefined;
|
|
298
377
|
color?: undefined;
|
|
299
378
|
kind: string;
|
|
300
379
|
params: {
|
|
301
380
|
mult?: undefined;
|
|
302
|
-
period?: undefined;
|
|
303
381
|
fast: number;
|
|
304
382
|
slow: number;
|
|
305
383
|
signal: number;
|
|
384
|
+
smooth?: undefined;
|
|
385
|
+
period?: undefined;
|
|
306
386
|
};
|
|
307
387
|
guides: number[];
|
|
308
388
|
fmt: string;
|
|
@@ -313,6 +393,87 @@ declare class WickChart extends HTMLElementBase {
|
|
|
313
393
|
}[];
|
|
314
394
|
histogram: number[];
|
|
315
395
|
};
|
|
396
|
+
range?: undefined;
|
|
397
|
+
} | {
|
|
398
|
+
color?: undefined;
|
|
399
|
+
kind: string;
|
|
400
|
+
params: {
|
|
401
|
+
mult?: undefined;
|
|
402
|
+
fast?: undefined;
|
|
403
|
+
slow?: undefined;
|
|
404
|
+
signal?: undefined;
|
|
405
|
+
period: number;
|
|
406
|
+
smooth?: undefined;
|
|
407
|
+
};
|
|
408
|
+
fmt: string;
|
|
409
|
+
compute: (bars: any, p: any) => number[];
|
|
410
|
+
guides?: undefined;
|
|
411
|
+
range?: undefined;
|
|
412
|
+
} | {
|
|
413
|
+
color?: undefined;
|
|
414
|
+
kind: string;
|
|
415
|
+
params: {
|
|
416
|
+
mult?: undefined;
|
|
417
|
+
fast?: undefined;
|
|
418
|
+
slow?: undefined;
|
|
419
|
+
signal?: undefined;
|
|
420
|
+
period: number;
|
|
421
|
+
smooth: number;
|
|
422
|
+
};
|
|
423
|
+
guides: number[];
|
|
424
|
+
range: number[];
|
|
425
|
+
fmt: string;
|
|
426
|
+
compute: (bars: any, p: any) => {
|
|
427
|
+
lines: {
|
|
428
|
+
name: string;
|
|
429
|
+
values: number[];
|
|
430
|
+
}[];
|
|
431
|
+
};
|
|
432
|
+
} | {
|
|
433
|
+
color?: undefined;
|
|
434
|
+
kind: string;
|
|
435
|
+
params: {
|
|
436
|
+
mult?: undefined;
|
|
437
|
+
fast?: undefined;
|
|
438
|
+
slow?: undefined;
|
|
439
|
+
signal?: undefined;
|
|
440
|
+
smooth?: undefined;
|
|
441
|
+
period?: undefined;
|
|
442
|
+
};
|
|
443
|
+
fmt: string;
|
|
444
|
+
compute: (bars: any) => number[];
|
|
445
|
+
guides?: undefined;
|
|
446
|
+
range?: undefined;
|
|
447
|
+
} | {
|
|
448
|
+
color?: undefined;
|
|
449
|
+
kind: string;
|
|
450
|
+
params: {
|
|
451
|
+
mult?: undefined;
|
|
452
|
+
fast?: undefined;
|
|
453
|
+
slow?: undefined;
|
|
454
|
+
signal?: undefined;
|
|
455
|
+
smooth?: undefined;
|
|
456
|
+
period: number;
|
|
457
|
+
};
|
|
458
|
+
guides: number[];
|
|
459
|
+
fmt: string;
|
|
460
|
+
compute: (bars: any, p: any) => number[];
|
|
461
|
+
range?: undefined;
|
|
462
|
+
} | {
|
|
463
|
+
color?: undefined;
|
|
464
|
+
kind: string;
|
|
465
|
+
params: {
|
|
466
|
+
mult?: undefined;
|
|
467
|
+
fast?: undefined;
|
|
468
|
+
slow?: undefined;
|
|
469
|
+
signal?: undefined;
|
|
470
|
+
smooth?: undefined;
|
|
471
|
+
period: number;
|
|
472
|
+
};
|
|
473
|
+
guides: number[];
|
|
474
|
+
range: number[];
|
|
475
|
+
fmt: string;
|
|
476
|
+
compute: (bars: any, p: any) => number[];
|
|
316
477
|
}>;
|
|
317
478
|
/**
|
|
318
479
|
* Register a custom indicator.
|
|
@@ -623,6 +784,75 @@ declare class WickChart extends HTMLElementBase {
|
|
|
623
784
|
_updateLegend(): void;
|
|
624
785
|
/** Position P&L chips (top-right HTML overlay). */
|
|
625
786
|
_updateHud(): void;
|
|
787
|
+
/**
|
|
788
|
+
* Register a plugin layer. `layer.draw(api)` runs on every render, above
|
|
789
|
+
* chart content and under the crosshair; `layer.onPointer(pev)` is asked
|
|
790
|
+
* first on pointerdown and claims the gesture by returning true — the
|
|
791
|
+
* layer then receives that pointer's move/up/cancel events (plus a
|
|
792
|
+
* 'cancel' on Escape) and the chart suppresses its own pan/measure/brush
|
|
793
|
+
* for the duration.
|
|
794
|
+
* @param {{id?: string, draw: Function, onPointer?: Function}} layer
|
|
795
|
+
* @returns {object|null} the normalized layer handle (with `id`), or null
|
|
796
|
+
* if the layer was rejected (no draw fn, or 16 layers already added)
|
|
797
|
+
*/
|
|
798
|
+
addLayer(layer: {
|
|
799
|
+
id?: string;
|
|
800
|
+
draw: Function;
|
|
801
|
+
onPointer?: Function;
|
|
802
|
+
}): object | null;
|
|
803
|
+
/**
|
|
804
|
+
* Remove a layer added via addLayer (pass the returned handle or its id).
|
|
805
|
+
* @param {object|string} idOrLayer
|
|
806
|
+
* @returns {boolean} true if a layer was removed
|
|
807
|
+
*/
|
|
808
|
+
removeLayer(idOrLayer: object | string): boolean;
|
|
809
|
+
/** Ask for a repaint on the next frame (interactive layers call this). */
|
|
810
|
+
requestDraw(): void;
|
|
811
|
+
/** Paint every registered layer. Called from _render with live state. */
|
|
812
|
+
_drawLayers(ctx: any, pal: any, ly: any, d: any): void;
|
|
813
|
+
/** Ask layers, in order, whether one claims this pointerdown. */
|
|
814
|
+
_layerHit(e: any, pt: any): any;
|
|
815
|
+
/** Deliver a pointer event to a claiming layer; never throws outward. */
|
|
816
|
+
_routeLayer(layer: any, e: any, pt: any, type: any): void;
|
|
817
|
+
_layerPointerEvent(e: any, pt: any, type: any): {
|
|
818
|
+
type: any;
|
|
819
|
+
x: any;
|
|
820
|
+
y: any;
|
|
821
|
+
pointerId: any;
|
|
822
|
+
button: any;
|
|
823
|
+
shiftKey: boolean;
|
|
824
|
+
ctrlKey: boolean;
|
|
825
|
+
altKey: boolean;
|
|
826
|
+
metaKey: boolean;
|
|
827
|
+
};
|
|
828
|
+
/**
|
|
829
|
+
* x-pixel for a bar time (ms or s, auto-detected). Extrapolates past the
|
|
830
|
+
* last bar into future space using the median bar interval, so layers can
|
|
831
|
+
* anchor trendlines to tomorrow, not just to history.
|
|
832
|
+
* @param {number} time
|
|
833
|
+
* @returns {number|null}
|
|
834
|
+
*/
|
|
835
|
+
timeToX(time: number): number | null;
|
|
836
|
+
/**
|
|
837
|
+
* Bar time (ms) at an x-pixel — the inverse of timeToX, interpolating
|
|
838
|
+
* between bars and extrapolating beyond both data edges.
|
|
839
|
+
* @param {number} x
|
|
840
|
+
* @returns {number|null}
|
|
841
|
+
*/
|
|
842
|
+
xToTime(x: number): number | null;
|
|
843
|
+
/**
|
|
844
|
+
* y-pixel for a price in the main pane (current scale; log-aware).
|
|
845
|
+
* Unclamped — values off-screen still map, layers decide how to clip.
|
|
846
|
+
* @param {number} price
|
|
847
|
+
* @returns {number|null}
|
|
848
|
+
*/
|
|
849
|
+
priceToY(price: number): number | null;
|
|
850
|
+
/**
|
|
851
|
+
* Price at a y-pixel in the main pane — the inverse of priceToY.
|
|
852
|
+
* @param {number} y
|
|
853
|
+
* @returns {number|null}
|
|
854
|
+
*/
|
|
855
|
+
yToPrice(y: number): number | null;
|
|
626
856
|
_localPoint(e: any): {
|
|
627
857
|
x: number;
|
|
628
858
|
y: number;
|