@chartspire/chartspire-chart 1.1.0 → 10.0.0-alpha2
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/{LICENSE_APACHE_2.0 → LICENSE} +201 -201
- package/NOTICE +5 -17
- package/README.md +14 -109
- package/README.zh-CN.md +114 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +241 -258
- package/dist/index.esm.js +4478 -5752
- package/dist/umd/klinecharts.js +4481 -5755
- package/dist/umd/klinecharts.js.map +1 -1
- package/dist/umd/klinecharts.min.js +2 -2
- package/licenses/LICENSE-lightweight-charts +202 -0
- package/{LICENSE_AGPL3 → licenses/LICENSE_AGPL3} +662 -662
- package/package.json +98 -98
- package/CHANGELOG.md +0 -26
package/dist/index.d.ts
CHANGED
|
@@ -12,20 +12,7 @@
|
|
|
12
12
|
* limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
export type Nullable<T> = T | null;
|
|
15
|
-
|
|
16
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
17
|
-
* you may not use this file except in compliance with the License.
|
|
18
|
-
* You may obtain a copy of the License at
|
|
19
|
-
|
|
20
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
-
|
|
22
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
23
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
24
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
25
|
-
* See the License for the specific language governing permissions and
|
|
26
|
-
* limitations under the License.
|
|
27
|
-
*/
|
|
28
|
-
export interface CandleStickData {
|
|
15
|
+
export interface KLineData {
|
|
29
16
|
timestamp: number;
|
|
30
17
|
open: number;
|
|
31
18
|
high: number;
|
|
@@ -33,14 +20,8 @@ export interface CandleStickData {
|
|
|
33
20
|
close: number;
|
|
34
21
|
volume?: number;
|
|
35
22
|
turnover?: number;
|
|
36
|
-
|
|
37
|
-
* Modified code
|
|
38
|
-
*/
|
|
39
|
-
hh?: boolean;
|
|
40
|
-
lh?: boolean;
|
|
41
|
-
[key: string]: any;
|
|
23
|
+
[key: string]: unknown;
|
|
42
24
|
}
|
|
43
|
-
export type TooltipTextStyle = Pick<TextStyle, "color" | "size" | "family" | "weight" | "backgroundColor" | "borderSize" | "borderRadius"> & Margin;
|
|
44
25
|
export interface Margin {
|
|
45
26
|
marginLeft: number;
|
|
46
27
|
marginTop: number;
|
|
@@ -93,8 +74,6 @@ export interface PolygonStyle {
|
|
|
93
74
|
}
|
|
94
75
|
export interface RectStyle extends PolygonStyle {
|
|
95
76
|
borderRadius: number;
|
|
96
|
-
positionX: number;
|
|
97
|
-
positionY: number;
|
|
98
77
|
}
|
|
99
78
|
export interface TextStyle extends Padding {
|
|
100
79
|
style: PolygonType;
|
|
@@ -136,6 +115,7 @@ export interface GridStyle {
|
|
|
136
115
|
horizontal: StateLineStyle;
|
|
137
116
|
vertical: StateLineStyle;
|
|
138
117
|
}
|
|
118
|
+
export type TooltipTextStyle = Pick<TextStyle, "color" | "size" | "family" | "weight"> & Margin;
|
|
139
119
|
export interface TooltipLegendChild {
|
|
140
120
|
text: string;
|
|
141
121
|
color: string;
|
|
@@ -204,7 +184,7 @@ export interface CandlePriceMarkStyle {
|
|
|
204
184
|
low: CandleHighLowPriceMarkStyle;
|
|
205
185
|
last: CandleLastPriceMarkStyle;
|
|
206
186
|
}
|
|
207
|
-
declare enum CandleTooltipRectPosition {
|
|
187
|
+
export declare enum CandleTooltipRectPosition {
|
|
208
188
|
Fixed = "fixed",
|
|
209
189
|
Pointer = "pointer"
|
|
210
190
|
}
|
|
@@ -212,9 +192,9 @@ export interface CandleTooltipRectStyle extends Omit<RectStyle, "style" | "borde
|
|
|
212
192
|
position: CandleTooltipRectPosition;
|
|
213
193
|
}
|
|
214
194
|
export interface CandleTooltipCustomCallbackData {
|
|
215
|
-
prev: Nullable<
|
|
216
|
-
current:
|
|
217
|
-
next: Nullable<
|
|
195
|
+
prev: Nullable<KLineData>;
|
|
196
|
+
current: KLineData;
|
|
197
|
+
next: Nullable<KLineData>;
|
|
218
198
|
}
|
|
219
199
|
export type CandleTooltipCustomCallback = (data: CandleTooltipCustomCallbackData, styles: CandleStyle) => TooltipLegend[];
|
|
220
200
|
export interface CandleTooltipStyle extends TooltipStyle, Offset {
|
|
@@ -222,6 +202,7 @@ export interface CandleTooltipStyle extends TooltipStyle, Offset {
|
|
|
222
202
|
rect: CandleTooltipRectStyle;
|
|
223
203
|
}
|
|
224
204
|
export declare enum CandleType {
|
|
205
|
+
HeikinAshi = "heikin_ashi",
|
|
225
206
|
CandleSolid = "candle_solid",
|
|
226
207
|
CandleStroke = "candle_stroke",
|
|
227
208
|
CandleUpStroke = "candle_up_stroke",
|
|
@@ -260,7 +241,7 @@ export interface IndicatorStyle {
|
|
|
260
241
|
circles: IndicatorPolygonStyle[];
|
|
261
242
|
lastValueMark: IndicatorLastValueMarkStyle;
|
|
262
243
|
tooltip: IndicatorTooltipStyle;
|
|
263
|
-
[key: string]:
|
|
244
|
+
[key: string]: unknown;
|
|
264
245
|
}
|
|
265
246
|
export type AxisLineStyle = Omit<StateLineStyle, "style" | "dashedValue">;
|
|
266
247
|
export interface AxisTickLineStyle extends AxisLineStyle {
|
|
@@ -277,22 +258,6 @@ export interface AxisStyle {
|
|
|
277
258
|
tickLine: AxisTickLineStyle;
|
|
278
259
|
tickText: AxisTickTextStyle;
|
|
279
260
|
}
|
|
280
|
-
export type XAxisStyle = AxisStyle;
|
|
281
|
-
export declare enum YAxisPosition {
|
|
282
|
-
Left = "left",
|
|
283
|
-
Right = "right"
|
|
284
|
-
}
|
|
285
|
-
export declare enum YAxisType {
|
|
286
|
-
Normal = "normal",
|
|
287
|
-
Percentage = "percentage",
|
|
288
|
-
Log = "log"
|
|
289
|
-
}
|
|
290
|
-
export interface YAxisStyle extends AxisStyle {
|
|
291
|
-
type: YAxisType;
|
|
292
|
-
position: YAxisPosition;
|
|
293
|
-
inside: boolean;
|
|
294
|
-
reverse: boolean;
|
|
295
|
-
}
|
|
296
261
|
export interface CrosshairDirectionStyle {
|
|
297
262
|
show: boolean;
|
|
298
263
|
line: StateLineStyle;
|
|
@@ -321,12 +286,7 @@ export interface OverlayStyle {
|
|
|
321
286
|
circle: PolygonStyle;
|
|
322
287
|
arc: LineStyle;
|
|
323
288
|
text: TextStyle;
|
|
324
|
-
|
|
325
|
-
* @deprecated
|
|
326
|
-
* Starting from v10, it will be deleted
|
|
327
|
-
*/
|
|
328
|
-
rectText: TextStyle;
|
|
329
|
-
[key: string]: any;
|
|
289
|
+
[key: string]: unknown;
|
|
330
290
|
}
|
|
331
291
|
export interface SeparatorStyle {
|
|
332
292
|
size: number;
|
|
@@ -338,23 +298,23 @@ export interface Styles {
|
|
|
338
298
|
grid: GridStyle;
|
|
339
299
|
candle: CandleStyle;
|
|
340
300
|
indicator: IndicatorStyle;
|
|
341
|
-
xAxis:
|
|
342
|
-
yAxis:
|
|
301
|
+
xAxis: AxisStyle;
|
|
302
|
+
yAxis: AxisStyle;
|
|
343
303
|
separator: SeparatorStyle;
|
|
344
304
|
crosshair: CrosshairStyle;
|
|
345
305
|
overlay: OverlayStyle;
|
|
346
306
|
}
|
|
347
307
|
declare function merge(target: any, source: any): void;
|
|
348
308
|
declare function clone<T>(target: T): T;
|
|
349
|
-
declare function isArray<T =
|
|
350
|
-
declare function isFunction<T = (...args:
|
|
351
|
-
declare function isObject(value:
|
|
352
|
-
declare function isNumber(value:
|
|
309
|
+
declare function isArray<T = unknown>(value: unknown): value is T[];
|
|
310
|
+
declare function isFunction<T = (...args: unknown[]) => unknown>(value: unknown): value is T;
|
|
311
|
+
declare function isObject(value: unknown): value is object;
|
|
312
|
+
declare function isNumber(value: unknown): value is number;
|
|
353
313
|
declare function isValid<T>(value: T | null | undefined): value is T;
|
|
354
|
-
declare function isBoolean(value:
|
|
355
|
-
declare function isString(value:
|
|
314
|
+
declare function isBoolean(value: unknown): value is boolean;
|
|
315
|
+
declare function isString(value: unknown): value is string;
|
|
356
316
|
declare function formatValue(data: unknown, key: string, defaultValue?: unknown): unknown;
|
|
357
|
-
declare function
|
|
317
|
+
declare function formatTimestampToString(dateTimeFormat: Intl.DateTimeFormat, timestamp: number, format: string): string;
|
|
358
318
|
declare function formatPrecision(value: string | number, precision?: number): string;
|
|
359
319
|
declare function formatBigNumber(value: string | number): string;
|
|
360
320
|
declare function formatThousands(value: string | number, sign: string): string;
|
|
@@ -373,9 +333,8 @@ declare function calcTextWidth(text: string, size?: number, weight?: string | nu
|
|
|
373
333
|
* See the License for the specific language governing permissions and
|
|
374
334
|
* limitations under the License.
|
|
375
335
|
*/
|
|
376
|
-
export type ActionCallback = (data?:
|
|
336
|
+
export type ActionCallback = (data?: unknown) => void;
|
|
377
337
|
export declare enum ActionType {
|
|
378
|
-
OnDataReady = "onDataReady",
|
|
379
338
|
OnZoom = "onZoom",
|
|
380
339
|
OnScroll = "onScroll",
|
|
381
340
|
OnVisibleRangeChange = "onVisibleRangeChange",
|
|
@@ -397,7 +356,9 @@ export declare enum ActionType {
|
|
|
397
356
|
* See the License for the specific language governing permissions and
|
|
398
357
|
* limitations under the License.
|
|
399
358
|
*/
|
|
400
|
-
export type
|
|
359
|
+
export type DeepPartial<T> = {
|
|
360
|
+
[P in keyof T]?: T[P] extends Array<infer U> ? Array<DeepPartial<U>> : T[P] extends ReadonlyArray<infer X> ? ReadonlyArray<DeepPartial<X>> : T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
361
|
+
};
|
|
401
362
|
/**
|
|
402
363
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
403
364
|
* you may not use this file except in compliance with the License.
|
|
@@ -411,14 +372,8 @@ export type ExcludePickPartial<T, K extends keyof T> = Partial<Omit<T, K>> & Pic
|
|
|
411
372
|
* See the License for the specific language governing permissions and
|
|
412
373
|
* limitations under the License.
|
|
413
374
|
*/
|
|
414
|
-
export
|
|
415
|
-
|
|
416
|
-
height: number;
|
|
417
|
-
left: number;
|
|
418
|
-
right: number;
|
|
419
|
-
top: number;
|
|
420
|
-
bottom: number;
|
|
421
|
-
}
|
|
375
|
+
export type PickRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
|
376
|
+
export type ExcludePickPartial<T, K extends keyof T> = PickRequired<Partial<T>, K>;
|
|
422
377
|
/**
|
|
423
378
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
424
379
|
* you may not use this file except in compliance with the License.
|
|
@@ -432,11 +387,13 @@ export interface Bounding {
|
|
|
432
387
|
* See the License for the specific language governing permissions and
|
|
433
388
|
* limitations under the License.
|
|
434
389
|
*/
|
|
435
|
-
export interface
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
390
|
+
export interface Bounding {
|
|
391
|
+
width: number;
|
|
392
|
+
height: number;
|
|
393
|
+
left: number;
|
|
394
|
+
right: number;
|
|
395
|
+
top: number;
|
|
396
|
+
bottom: number;
|
|
440
397
|
}
|
|
441
398
|
/**
|
|
442
399
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -477,16 +434,11 @@ export interface Coordinate {
|
|
|
477
434
|
export interface Crosshair extends Partial<Coordinate> {
|
|
478
435
|
paneId?: string;
|
|
479
436
|
realX?: number;
|
|
480
|
-
|
|
437
|
+
timestamp?: number;
|
|
438
|
+
kLineData?: KLineData;
|
|
481
439
|
dataIndex?: number;
|
|
482
440
|
realDataIndex?: number;
|
|
483
441
|
}
|
|
484
|
-
export interface MouseTouchEvent extends Coordinate {
|
|
485
|
-
pageX: number;
|
|
486
|
-
pageY: number;
|
|
487
|
-
isTouch?: boolean;
|
|
488
|
-
preventDefault?: () => void;
|
|
489
|
-
}
|
|
490
442
|
/**
|
|
491
443
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
492
444
|
* you may not use this file except in compliance with the License.
|
|
@@ -500,9 +452,18 @@ export interface MouseTouchEvent extends Coordinate {
|
|
|
500
452
|
* See the License for the specific language governing permissions and
|
|
501
453
|
* limitations under the License.
|
|
502
454
|
*/
|
|
503
|
-
export
|
|
504
|
-
|
|
505
|
-
|
|
455
|
+
export interface VisibleRange {
|
|
456
|
+
readonly from: number;
|
|
457
|
+
readonly to: number;
|
|
458
|
+
readonly realFrom: number;
|
|
459
|
+
readonly realTo: number;
|
|
460
|
+
}
|
|
461
|
+
export interface MouseTouchEvent extends Coordinate {
|
|
462
|
+
pageX: number;
|
|
463
|
+
pageY: number;
|
|
464
|
+
isTouch?: boolean;
|
|
465
|
+
preventDefault?: () => void;
|
|
466
|
+
}
|
|
506
467
|
/**
|
|
507
468
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
508
469
|
* you may not use this file except in compliance with the License.
|
|
@@ -521,20 +482,20 @@ export interface Point {
|
|
|
521
482
|
timestamp: number;
|
|
522
483
|
value: number;
|
|
523
484
|
}
|
|
524
|
-
/**
|
|
525
|
-
* Since v9.8.0 deprecated, since v10 removed
|
|
526
|
-
* @deprecated
|
|
527
|
-
*/
|
|
528
|
-
export type LoadMoreCallback = (timestamp: Nullable<number>) => void;
|
|
529
485
|
declare enum LoadDataType {
|
|
530
486
|
Init = "init",
|
|
531
487
|
Forward = "forward",
|
|
532
|
-
Backward = "backward"
|
|
488
|
+
Backward = "backward",
|
|
489
|
+
Update = "update"
|
|
533
490
|
}
|
|
534
491
|
export interface LoadDataParams {
|
|
535
492
|
type: LoadDataType;
|
|
536
|
-
data: Nullable<
|
|
537
|
-
callback: (dataList:
|
|
493
|
+
data: Nullable<KLineData>;
|
|
494
|
+
callback: (dataList: KLineData[], more?: boolean) => void;
|
|
495
|
+
}
|
|
496
|
+
export interface LoadDataMore {
|
|
497
|
+
[LoadDataType.Backward]: boolean;
|
|
498
|
+
[LoadDataType.Forward]: boolean;
|
|
538
499
|
}
|
|
539
500
|
export type LoadDataCallback = (params: LoadDataParams) => void;
|
|
540
501
|
/**
|
|
@@ -554,46 +515,26 @@ export interface Precision {
|
|
|
554
515
|
price: number;
|
|
555
516
|
volume: number;
|
|
556
517
|
}
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
563
|
-
|
|
564
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
565
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
566
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
567
|
-
* See the License for the specific language governing permissions and
|
|
568
|
-
* limitations under the License.
|
|
569
|
-
*/
|
|
570
|
-
export interface PaneGap {
|
|
571
|
-
top?: number;
|
|
572
|
-
bottom?: number;
|
|
573
|
-
}
|
|
574
|
-
export interface PaneAxisOptions {
|
|
575
|
-
name?: string;
|
|
576
|
-
scrollZoomEnabled?: boolean;
|
|
577
|
-
}
|
|
578
|
-
export declare const enum PanePosition {
|
|
579
|
-
Top = "top",
|
|
580
|
-
Bottom = "bottom"
|
|
518
|
+
export declare const enum PaneState {
|
|
519
|
+
Normal = "normal",
|
|
520
|
+
Maximize = "maximize",
|
|
521
|
+
Minimize = "minimize"
|
|
581
522
|
}
|
|
582
523
|
export interface PaneOptions {
|
|
583
524
|
id?: string;
|
|
584
525
|
height?: number;
|
|
585
526
|
minHeight?: number;
|
|
586
527
|
dragEnabled?: boolean;
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
528
|
+
order?: number;
|
|
529
|
+
state?: PaneState;
|
|
530
|
+
axis?: Partial<AxisCreate>;
|
|
590
531
|
}
|
|
591
532
|
export declare enum FormatDateType {
|
|
592
533
|
Tooltip = 0,
|
|
593
534
|
Crosshair = 1,
|
|
594
535
|
XAxis = 2
|
|
595
536
|
}
|
|
596
|
-
export type FormatDate = (
|
|
537
|
+
export type FormatDate = (timestamp: number, format: string, type: FormatDateType) => string;
|
|
597
538
|
export type FormatBigNumber = (value: string | number) => string;
|
|
598
539
|
export interface CustomApi {
|
|
599
540
|
formatDate: FormatDate;
|
|
@@ -620,17 +561,28 @@ export interface LayoutChild {
|
|
|
620
561
|
content?: Array<string | IndicatorCreate>;
|
|
621
562
|
options?: PaneOptions;
|
|
622
563
|
}
|
|
564
|
+
export interface DecimalFold {
|
|
565
|
+
threshold: number;
|
|
566
|
+
format: (value: string | number) => string;
|
|
567
|
+
}
|
|
568
|
+
export interface ThousandsSeparator {
|
|
569
|
+
sign: string;
|
|
570
|
+
format: (value: string | number) => string;
|
|
571
|
+
}
|
|
623
572
|
export interface Options {
|
|
624
|
-
layout?: LayoutChild[];
|
|
625
573
|
locale?: string;
|
|
626
574
|
timezone?: string;
|
|
627
575
|
styles?: string | DeepPartial<Styles>;
|
|
628
576
|
customApi?: Partial<CustomApi>;
|
|
629
|
-
thousandsSeparator?:
|
|
630
|
-
|
|
577
|
+
thousandsSeparator?: Partial<ThousandsSeparator>;
|
|
578
|
+
decimalFold?: Partial<DecimalFold>;
|
|
579
|
+
layout?: LayoutChild[];
|
|
631
580
|
}
|
|
632
|
-
export
|
|
581
|
+
export type YAxisTemplate = AxisTemplate;
|
|
582
|
+
export interface YAxis extends Axis, Required<YAxisTemplate> {
|
|
633
583
|
isFromZero: () => boolean;
|
|
584
|
+
isInCandle: () => boolean;
|
|
585
|
+
convertToNicePixel: (value: number) => number;
|
|
634
586
|
}
|
|
635
587
|
export declare enum OverlayMode {
|
|
636
588
|
Normal = "normal",
|
|
@@ -648,20 +600,15 @@ export type OverlayFigureIgnoreEventType = "mouseClickEvent" | "mouseRightClickE
|
|
|
648
600
|
export interface OverlayFigure {
|
|
649
601
|
key?: string;
|
|
650
602
|
type: string;
|
|
651
|
-
attrs:
|
|
652
|
-
styles?:
|
|
603
|
+
attrs: unknown;
|
|
604
|
+
styles?: unknown;
|
|
653
605
|
ignoreEvent?: boolean | OverlayFigureIgnoreEventType[];
|
|
654
606
|
}
|
|
655
607
|
export interface OverlayCreateFiguresCallbackParams {
|
|
608
|
+
chart: Chart;
|
|
656
609
|
overlay: Overlay;
|
|
657
610
|
coordinates: Coordinate[];
|
|
658
611
|
bounding: Bounding;
|
|
659
|
-
barSpace: BarSpace;
|
|
660
|
-
precision: Precision;
|
|
661
|
-
thousandsSeparator: string;
|
|
662
|
-
decimalFoldThreshold: number;
|
|
663
|
-
dateTimeFormat: Intl.DateTimeFormat;
|
|
664
|
-
defaultStyles: OverlayStyle;
|
|
665
612
|
xAxis: Nullable<XAxis>;
|
|
666
613
|
yAxis: Nullable<YAxis>;
|
|
667
614
|
}
|
|
@@ -669,6 +616,7 @@ export interface OverlayEvent extends Partial<MouseTouchEvent> {
|
|
|
669
616
|
figureKey?: string;
|
|
670
617
|
figureIndex?: number;
|
|
671
618
|
overlay: Overlay;
|
|
619
|
+
chart: Chart;
|
|
672
620
|
}
|
|
673
621
|
export type OverlayEventCallback = (event: OverlayEvent) => boolean;
|
|
674
622
|
export type OverlayCreateFiguresCallback = (params: OverlayCreateFiguresCallbackParams) => OverlayFigure | OverlayFigure[];
|
|
@@ -736,7 +684,7 @@ export interface Overlay {
|
|
|
736
684
|
/**
|
|
737
685
|
* Extended Data
|
|
738
686
|
*/
|
|
739
|
-
extendData:
|
|
687
|
+
extendData: unknown;
|
|
740
688
|
/**
|
|
741
689
|
* The style information and format are consistent with the overlay in the unified configuration
|
|
742
690
|
*/
|
|
@@ -819,31 +767,25 @@ export interface Overlay {
|
|
|
819
767
|
onDeselected: Nullable<OverlayEventCallback>;
|
|
820
768
|
}
|
|
821
769
|
export type OverlayTemplate = ExcludePickPartial<Omit<Overlay, "id" | "groupId" | "paneId" | "points" | "currentStep">, "name">;
|
|
822
|
-
export type OverlayCreate = ExcludePickPartial<Omit<Overlay, "
|
|
823
|
-
export type
|
|
770
|
+
export type OverlayCreate = ExcludePickPartial<Omit<Overlay, "currentStep" | "totalStep" | "createPointFigures" | "createXAxisFigures" | "createYAxisFigures" | "performEventPressedMove" | "performEventMoveForDrawing">, "name">;
|
|
771
|
+
export type OverlayFilter = Partial<Pick<Overlay, "id" | "groupId" | "name" | "paneId">>;
|
|
824
772
|
export type OverlayConstructor = new () => Overlay;
|
|
825
|
-
export
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
export interface ConvertFinder {
|
|
831
|
-
paneId?: string;
|
|
832
|
-
absolute?: boolean;
|
|
833
|
-
}
|
|
834
|
-
export interface Chart {
|
|
835
|
-
id: string;
|
|
836
|
-
getDom: (paneId?: string, position?: DomPosition) => Nullable<HTMLElement>;
|
|
837
|
-
getSize: (paneId?: string, position?: DomPosition) => Nullable<Bounding>;
|
|
773
|
+
export interface Store {
|
|
774
|
+
setStyles: (value: string | DeepPartial<Styles>) => void;
|
|
775
|
+
getStyles: () => Styles;
|
|
776
|
+
setCustomApi: (api: Partial<CustomApi>) => void;
|
|
777
|
+
getCustomApi: () => CustomApi;
|
|
838
778
|
setLocale: (locale: string) => void;
|
|
839
779
|
getLocale: () => string;
|
|
840
|
-
setStyles: (styles: string | DeepPartial<Styles>) => void;
|
|
841
|
-
getStyles: () => Styles;
|
|
842
|
-
setCustomApi: (customApi: Partial<CustomApi>) => void;
|
|
843
|
-
setPriceVolumePrecision: (pricePrecision: number, volumePrecision: number) => void;
|
|
844
|
-
getPriceVolumePrecision: () => Precision;
|
|
845
780
|
setTimezone: (timezone: string) => void;
|
|
846
781
|
getTimezone: () => string;
|
|
782
|
+
setThousandsSeparator: (thousandsSeparator: Partial<ThousandsSeparator>) => void;
|
|
783
|
+
getThousandsSeparator: () => ThousandsSeparator;
|
|
784
|
+
setDecimalFold: (decimalFold: Partial<DecimalFold>) => void;
|
|
785
|
+
getDecimalFold: () => DecimalFold;
|
|
786
|
+
getPrecision: () => Precision;
|
|
787
|
+
setPrecision: (precision: Partial<Precision>) => void;
|
|
788
|
+
getDataList: () => KLineData[];
|
|
847
789
|
setOffsetRightDistance: (distance: number) => void;
|
|
848
790
|
getOffsetRightDistance: () => number;
|
|
849
791
|
setMaxOffsetLeftDistance: (distance: number) => void;
|
|
@@ -851,36 +793,40 @@ export interface Chart {
|
|
|
851
793
|
setLeftMinVisibleBarCount: (barCount: number) => void;
|
|
852
794
|
setRightMinVisibleBarCount: (barCount: number) => void;
|
|
853
795
|
setBarSpace: (space: number) => void;
|
|
854
|
-
getBarSpace: () =>
|
|
796
|
+
getBarSpace: () => BarSpace;
|
|
855
797
|
getVisibleRange: () => VisibleRange;
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
* Since v9.8.0 deprecated, since v10 removed
|
|
862
|
-
*/
|
|
863
|
-
applyMoreData: (dataList: CandleStickData[], more?: boolean, callback?: () => void) => void;
|
|
864
|
-
updateData: (data: CandleStickData, callback?: () => void) => void;
|
|
865
|
-
/**
|
|
866
|
-
* @deprecated
|
|
867
|
-
* Since v9.8.0 deprecated, since v10 removed
|
|
868
|
-
*/
|
|
869
|
-
loadMore: (cb: LoadMoreCallback) => void;
|
|
870
|
-
setLoadDataCallback: (cb: LoadDataCallback) => void;
|
|
871
|
-
createIndicator: (value: string | IndicatorCreate, isStack?: boolean, paneOptions?: PaneOptions, callback?: () => void) => Nullable<string>;
|
|
872
|
-
overrideIndicator: (override: IndicatorCreate, paneId?: string, callback?: () => void) => void;
|
|
873
|
-
getIndicatorByPaneId: (paneId?: string, name?: string) => Nullable<Indicator> | Nullable<Map<string, Indicator>> | Map<string, Map<string, Indicator>>;
|
|
874
|
-
removeIndicator: (paneId: string, name?: string) => void;
|
|
875
|
-
createOverlay: (value: string | OverlayCreate | Array<string | OverlayCreate>, paneId?: string) => Nullable<string> | Array<Nullable<string>>;
|
|
876
|
-
getOverlayById: (id: string) => Nullable<Overlay>;
|
|
877
|
-
overrideOverlay: (override: Partial<OverlayCreate>) => void;
|
|
878
|
-
removeOverlay: (remove?: string | OverlayRemove) => void;
|
|
879
|
-
setPaneOptions: (options: PaneOptions) => void;
|
|
798
|
+
setLoadMoreDataCallback: (callback: LoadDataCallback) => void;
|
|
799
|
+
overrideIndicator: (override: IndicatorCreate, paneId?: string) => boolean;
|
|
800
|
+
removeIndicator: (filter?: IndicatorFilter) => boolean;
|
|
801
|
+
overrideOverlay: (override: Partial<OverlayCreate>) => boolean;
|
|
802
|
+
removeOverlay: (filter?: OverlayFilter) => boolean;
|
|
880
803
|
setZoomEnabled: (enabled: boolean) => void;
|
|
881
804
|
isZoomEnabled: () => boolean;
|
|
882
805
|
setScrollEnabled: (enabled: boolean) => void;
|
|
883
806
|
isScrollEnabled: () => boolean;
|
|
807
|
+
clearData: () => void;
|
|
808
|
+
}
|
|
809
|
+
export declare enum DomPosition {
|
|
810
|
+
Root = "root",
|
|
811
|
+
Main = "main",
|
|
812
|
+
YAxis = "yAxis"
|
|
813
|
+
}
|
|
814
|
+
export interface ConvertFilter {
|
|
815
|
+
paneId?: string;
|
|
816
|
+
absolute?: boolean;
|
|
817
|
+
}
|
|
818
|
+
export interface Chart extends Store {
|
|
819
|
+
id: string;
|
|
820
|
+
getDom: (paneId?: string, position?: DomPosition) => Nullable<HTMLElement>;
|
|
821
|
+
getSize: (paneId?: string, position?: DomPosition) => Nullable<Bounding>;
|
|
822
|
+
applyNewData: (dataList: KLineData[], more?: boolean | Partial<LoadDataMore>) => void;
|
|
823
|
+
updateData: (data: KLineData) => void;
|
|
824
|
+
createIndicator: (value: string | IndicatorCreate, isStack?: boolean, paneOptions?: PaneOptions) => Nullable<string>;
|
|
825
|
+
getIndicators: (filter?: IndicatorFilter) => Map<string, Indicator[]>;
|
|
826
|
+
createOverlay: (value: string | OverlayCreate | Array<string | OverlayCreate>) => Nullable<string> | Array<Nullable<string>>;
|
|
827
|
+
getOverlays: (filter?: OverlayFilter) => Map<string, Overlay[]>;
|
|
828
|
+
setPaneOptions: (options: PaneOptions) => void;
|
|
829
|
+
getPaneOptions: (id?: string) => Nullable<PaneOptions> | PaneOptions[];
|
|
884
830
|
scrollByDistance: (distance: number, animationDuration?: number) => void;
|
|
885
831
|
scrollToRealTime: (animationDuration?: number) => void;
|
|
886
832
|
scrollToDataIndex: (dataIndex: number, animationDuration?: number) => void;
|
|
@@ -888,12 +834,12 @@ export interface Chart {
|
|
|
888
834
|
zoomAtCoordinate: (scale: number, coordinate?: Coordinate, animationDuration?: number) => void;
|
|
889
835
|
zoomAtDataIndex: (scale: number, dataIndex: number, animationDuration?: number) => void;
|
|
890
836
|
zoomAtTimestamp: (scale: number, timestamp: number, animationDuration?: number) => void;
|
|
891
|
-
convertToPixel: (points: Partial<Point> | Array<Partial<Point>>,
|
|
892
|
-
convertFromPixel: (coordinates: Array<Partial<Coordinate>>,
|
|
893
|
-
executeAction: (type: ActionType, data:
|
|
837
|
+
convertToPixel: (points: Partial<Point> | Array<Partial<Point>>, filter?: ConvertFilter) => Partial<Coordinate> | Array<Partial<Coordinate>>;
|
|
838
|
+
convertFromPixel: (coordinates: Array<Partial<Coordinate>>, filter?: ConvertFilter) => Partial<Point> | Array<Partial<Point>>;
|
|
839
|
+
executeAction: (type: ActionType, data: Crosshair) => void;
|
|
894
840
|
subscribeAction: (type: ActionType, callback: ActionCallback) => void;
|
|
895
841
|
unsubscribeAction: (type: ActionType, callback?: ActionCallback) => void;
|
|
896
|
-
getConvertPictureUrl: (includeOverlay?: boolean, type?:
|
|
842
|
+
getConvertPictureUrl: (includeOverlay?: boolean, type?: "png" | "jpeg" | "bmp", backgroundColor?: string) => string;
|
|
897
843
|
resize: () => void;
|
|
898
844
|
}
|
|
899
845
|
export interface AxisTick {
|
|
@@ -904,49 +850,89 @@ export interface AxisTick {
|
|
|
904
850
|
export interface AxisRange extends VisibleRange {
|
|
905
851
|
readonly range: number;
|
|
906
852
|
readonly realRange: number;
|
|
853
|
+
readonly displayFrom: number;
|
|
854
|
+
readonly displayTo: number;
|
|
855
|
+
readonly displayRange: number;
|
|
907
856
|
}
|
|
908
|
-
export interface
|
|
909
|
-
|
|
910
|
-
|
|
857
|
+
export interface AxisGap {
|
|
858
|
+
top?: number;
|
|
859
|
+
bottom?: number;
|
|
860
|
+
}
|
|
861
|
+
declare enum AxisPosition {
|
|
862
|
+
Left = "left",
|
|
863
|
+
Right = "right"
|
|
864
|
+
}
|
|
865
|
+
export interface AxisValueToValueParams {
|
|
866
|
+
range: AxisRange;
|
|
867
|
+
}
|
|
868
|
+
export type AxisValueToValueCallback = (value: number, params: AxisValueToValueParams) => number;
|
|
869
|
+
export interface AxisCreateRangeParams {
|
|
870
|
+
chart: Chart;
|
|
871
|
+
paneId: string;
|
|
872
|
+
defaultRange: AxisRange;
|
|
911
873
|
}
|
|
874
|
+
export type AxisCreateRangeCallback = (params: AxisCreateRangeParams) => AxisRange;
|
|
912
875
|
export interface AxisCreateTicksParams {
|
|
913
876
|
range: AxisRange;
|
|
914
877
|
bounding: Bounding;
|
|
915
878
|
defaultTicks: AxisTick[];
|
|
916
879
|
}
|
|
917
880
|
export type AxisCreateTicksCallback = (params: AxisCreateTicksParams) => AxisTick[];
|
|
881
|
+
export type AxisMinSpanCallback = (value: number) => number;
|
|
918
882
|
export interface AxisTemplate {
|
|
919
883
|
name: string;
|
|
920
|
-
|
|
884
|
+
reverse?: boolean;
|
|
885
|
+
inside?: boolean;
|
|
886
|
+
position?: AxisPosition;
|
|
887
|
+
scrollZoomEnabled?: boolean;
|
|
888
|
+
gap?: AxisGap;
|
|
889
|
+
valueToRealValue?: AxisValueToValueCallback;
|
|
890
|
+
realValueToDisplayValue?: AxisValueToValueCallback;
|
|
891
|
+
displayValueToRealValue?: AxisValueToValueCallback;
|
|
892
|
+
realValueToValue?: AxisValueToValueCallback;
|
|
893
|
+
displayValueToText?: (value: number, precision: number) => string;
|
|
894
|
+
minSpan?: AxisMinSpanCallback;
|
|
895
|
+
createRange?: AxisCreateRangeCallback;
|
|
896
|
+
createTicks?: AxisCreateTicksCallback;
|
|
897
|
+
}
|
|
898
|
+
export interface Axis {
|
|
899
|
+
override: (axis: AxisTemplate) => void;
|
|
900
|
+
getTicks: () => AxisTick[];
|
|
901
|
+
getRange: () => AxisRange;
|
|
902
|
+
getAutoSize: () => number;
|
|
903
|
+
convertToPixel: (value: number) => number;
|
|
904
|
+
convertFromPixel: (px: number) => number;
|
|
921
905
|
}
|
|
922
|
-
export type
|
|
923
|
-
export
|
|
906
|
+
export type AxisCreate = Omit<AxisTemplate, "displayValueToText" | "valueToRealValue" | "realValueToDisplayValue" | "displayValueToRealValue" | "realValueToValue">;
|
|
907
|
+
export type XAxisTemplate = Pick<AxisTemplate, "name" | "scrollZoomEnabled" | "createTicks">;
|
|
908
|
+
export interface XAxis extends Axis, Required<XAxisTemplate> {
|
|
909
|
+
convertTimestampFromPixel: (pixel: number) => Nullable<number>;
|
|
910
|
+
convertTimestampToPixel: (timestamp: number) => number;
|
|
911
|
+
}
|
|
912
|
+
export interface Figure<A = unknown, S = unknown> {
|
|
924
913
|
name: string;
|
|
925
914
|
attrs: A;
|
|
926
915
|
styles: S;
|
|
927
916
|
draw: (ctx: CanvasRenderingContext2D, attrs: A, styles: S) => void;
|
|
928
917
|
checkEventOn: (coordinate: Coordinate, attrs: A, styles: S) => boolean;
|
|
929
918
|
}
|
|
930
|
-
export type FigureTemplate<A =
|
|
931
|
-
export type FigureCreate<A =
|
|
932
|
-
export type FigureConstructor<A =
|
|
919
|
+
export type FigureTemplate<A = unknown, S = unknown> = Pick<Figure<A, S>, "name" | "draw" | "checkEventOn">;
|
|
920
|
+
export type FigureCreate<A = unknown, S = unknown> = Pick<Figure<A, S>, "name" | "attrs" | "styles">;
|
|
921
|
+
export type FigureConstructor<A = unknown, S = unknown> = new (figure: FigureCreate<A, S>) => ({
|
|
933
922
|
draw: (ctx: CanvasRenderingContext2D) => void;
|
|
934
923
|
});
|
|
935
924
|
declare function checkCoordinateOnCircle(coordinate: Coordinate, attrs: CircleAttrs | CircleAttrs[]): boolean;
|
|
936
|
-
declare function drawCircle(ctx: CanvasRenderingContext2D, attrs: CircleAttrs | CircleAttrs[], styles: Partial<PolygonStyle>): void;
|
|
937
925
|
export interface CircleAttrs {
|
|
938
926
|
x: number;
|
|
939
927
|
y: number;
|
|
940
928
|
r: number;
|
|
941
929
|
}
|
|
942
930
|
declare function checkCoordinateOnArc(coordinate: Coordinate, attrs: ArcAttrs | ArcAttrs[]): boolean;
|
|
943
|
-
declare function drawArc(ctx: CanvasRenderingContext2D, attrs: ArcAttrs | ArcAttrs[], styles: Partial<LineStyle>): void;
|
|
944
931
|
export interface ArcAttrs extends CircleAttrs {
|
|
945
932
|
startAngle: number;
|
|
946
933
|
endAngle: number;
|
|
947
934
|
}
|
|
948
935
|
declare function checkCoordinateOnRect(coordinate: Coordinate, attrs: RectAttrs | RectAttrs[]): boolean;
|
|
949
|
-
declare function drawRect(ctx: CanvasRenderingContext2D, attrs: RectAttrs | RectAttrs[], styles: Partial<RectStyle>): void;
|
|
950
936
|
export interface RectAttrs {
|
|
951
937
|
x: number;
|
|
952
938
|
y: number;
|
|
@@ -954,7 +940,6 @@ export interface RectAttrs {
|
|
|
954
940
|
height: number;
|
|
955
941
|
}
|
|
956
942
|
declare function checkCoordinateOnText(coordinate: Coordinate, attrs: TextAttrs | TextAttrs[], styles: Partial<TextStyle>): boolean;
|
|
957
|
-
declare function drawText(ctx: CanvasRenderingContext2D, attrs: TextAttrs | TextAttrs[], styles: Partial<TextStyle>, toolTipType: string): void;
|
|
958
943
|
export interface TextAttrs {
|
|
959
944
|
x: number;
|
|
960
945
|
y: number;
|
|
@@ -969,81 +954,82 @@ export declare enum IndicatorSeries {
|
|
|
969
954
|
Price = "price",
|
|
970
955
|
Volume = "volume"
|
|
971
956
|
}
|
|
972
|
-
export type
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
export type IndicatorFigureAttrs = Partial<ArcAttrs> & Partial<LineStyle> & Partial<RectAttrs> & Partial<TextAttrs> & Record<string, any>;
|
|
957
|
+
export type IndicatorFigureStyle = Partial<Omit<SmoothLineStyle, "style">> & Partial<Omit<RectStyle, "style">> & Partial<TextStyle> & Partial<{
|
|
958
|
+
style: LineType[keyof LineType];
|
|
959
|
+
}> & Record<string, unknown>;
|
|
960
|
+
export type IndicatorFigureAttrs = Partial<ArcAttrs> & Partial<LineStyle> & Partial<RectAttrs> & Partial<TextAttrs> & Record<string, unknown>;
|
|
977
961
|
export interface IndicatorFigureCallbackBrother<PCN> {
|
|
978
962
|
prev: PCN;
|
|
979
963
|
current: PCN;
|
|
980
964
|
next: PCN;
|
|
981
965
|
}
|
|
982
|
-
export type IndicatorFigureAttrsCallbackCoordinate<D> = IndicatorFigureCallbackBrother<Record<keyof D, number> & {
|
|
983
|
-
x: number;
|
|
984
|
-
}>;
|
|
985
966
|
export interface IndicatorFigureAttrsCallbackParams<D> {
|
|
986
|
-
|
|
967
|
+
data: IndicatorFigureCallbackBrother<Nullable<D>>;
|
|
968
|
+
coordinate: IndicatorFigureCallbackBrother<Record<keyof D, number> & {
|
|
969
|
+
x: number;
|
|
970
|
+
}>;
|
|
987
971
|
bounding: Bounding;
|
|
988
972
|
barSpace: BarSpace;
|
|
989
973
|
xAxis: XAxis;
|
|
990
974
|
yAxis: YAxis;
|
|
991
975
|
}
|
|
992
|
-
export interface
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
export interface PatternFigureDataCallbackInterface<D> {
|
|
997
|
-
kLineData?: CandleStickData;
|
|
998
|
-
indicatorData?: D;
|
|
976
|
+
export interface IndicatorFigureStylesCallbackParams<D> {
|
|
977
|
+
data: IndicatorFigureCallbackBrother<Nullable<D>>;
|
|
978
|
+
indicator: Indicator<D>;
|
|
979
|
+
defaultStyles?: IndicatorStyle;
|
|
999
980
|
}
|
|
1000
|
-
export type IndicatorFigureStylesCallbackData<D> = IndicatorFigureCallbackBrother<IndicatorFigureStylesCallbackDataChild<D>>;
|
|
1001
|
-
export type PatternFigureDataCallbackData<D> = PatternFigureDataCallbackInterface<D>;
|
|
1002
981
|
export type IndicatorFigureAttrsCallback<D> = (params: IndicatorFigureAttrsCallbackParams<D>) => IndicatorFigureAttrs;
|
|
1003
|
-
export type IndicatorFigureStylesCallback<D> = (
|
|
1004
|
-
export
|
|
1005
|
-
export interface IndicatorFigure<D = any> {
|
|
982
|
+
export type IndicatorFigureStylesCallback<D> = (params: IndicatorFigureStylesCallbackParams<D>) => IndicatorFigureStyle;
|
|
983
|
+
export interface IndicatorFigure<D = unknown> {
|
|
1006
984
|
key: string;
|
|
1007
985
|
title?: string;
|
|
1008
986
|
type?: string;
|
|
1009
987
|
baseValue?: number;
|
|
1010
988
|
attrs?: IndicatorFigureAttrsCallback<D>;
|
|
1011
989
|
styles?: IndicatorFigureStylesCallback<D>;
|
|
1012
|
-
patternData?: PatternFigureCallback<D>;
|
|
1013
|
-
textMessage?: string;
|
|
1014
990
|
}
|
|
1015
|
-
export type IndicatorRegenerateFiguresCallback<D
|
|
991
|
+
export type IndicatorRegenerateFiguresCallback<D> = (calcParams: unknown[]) => Array<IndicatorFigure<D>>;
|
|
1016
992
|
export interface IndicatorTooltipData {
|
|
1017
993
|
name: string;
|
|
1018
994
|
calcParamsText: string;
|
|
1019
995
|
icons: TooltipIconStyle[];
|
|
1020
|
-
|
|
996
|
+
legends: TooltipLegend[];
|
|
1021
997
|
}
|
|
1022
|
-
export interface IndicatorCreateTooltipDataSourceParams<D
|
|
1023
|
-
|
|
998
|
+
export interface IndicatorCreateTooltipDataSourceParams<D> {
|
|
999
|
+
chart: Chart;
|
|
1024
1000
|
indicator: Indicator<D>;
|
|
1025
|
-
visibleRange: VisibleRange;
|
|
1026
1001
|
bounding: Bounding;
|
|
1027
1002
|
crosshair: Crosshair;
|
|
1028
|
-
defaultStyles: IndicatorStyle;
|
|
1029
1003
|
xAxis: XAxis;
|
|
1030
1004
|
yAxis: YAxis;
|
|
1031
1005
|
}
|
|
1032
|
-
export type IndicatorCreateTooltipDataSourceCallback<D
|
|
1033
|
-
export interface IndicatorDrawParams<D
|
|
1006
|
+
export type IndicatorCreateTooltipDataSourceCallback<D> = (params: IndicatorCreateTooltipDataSourceParams<D>) => IndicatorTooltipData;
|
|
1007
|
+
export interface IndicatorDrawParams<D> {
|
|
1034
1008
|
ctx: CanvasRenderingContext2D;
|
|
1035
|
-
|
|
1009
|
+
chart: Chart;
|
|
1036
1010
|
indicator: Indicator<D>;
|
|
1037
|
-
visibleRange: VisibleRange;
|
|
1038
1011
|
bounding: Bounding;
|
|
1039
|
-
barSpace: BarSpace;
|
|
1040
|
-
defaultStyles: IndicatorStyle;
|
|
1041
1012
|
xAxis: XAxis;
|
|
1042
1013
|
yAxis: YAxis;
|
|
1043
1014
|
}
|
|
1044
|
-
export type IndicatorDrawCallback<D
|
|
1045
|
-
export type IndicatorCalcCallback<D> = (dataList:
|
|
1046
|
-
export
|
|
1015
|
+
export type IndicatorDrawCallback<D> = (params: IndicatorDrawParams<D>) => boolean;
|
|
1016
|
+
export type IndicatorCalcCallback<D> = (dataList: KLineData[], indicator: Indicator<D>) => Promise<D[]> | D[];
|
|
1017
|
+
export type IndicatorShouldUpdateCallback<D> = (prev: Indicator<D>, current: Indicator<D>) => (boolean | {
|
|
1018
|
+
calc: boolean;
|
|
1019
|
+
draw: boolean;
|
|
1020
|
+
});
|
|
1021
|
+
declare enum IndicatorDataState {
|
|
1022
|
+
Loading = "loading",
|
|
1023
|
+
Error = "error",
|
|
1024
|
+
Ready = "ready"
|
|
1025
|
+
}
|
|
1026
|
+
export interface IndicatorOnDataStateChangeParams<D> {
|
|
1027
|
+
state: IndicatorDataState;
|
|
1028
|
+
type: LoadDataType;
|
|
1029
|
+
indicator: Indicator<D>;
|
|
1030
|
+
}
|
|
1031
|
+
export type IndicatorOnDataStateChangeCallback<D> = (params: IndicatorOnDataStateChangeParams<D>) => void;
|
|
1032
|
+
export interface Indicator<D = unknown> {
|
|
1047
1033
|
/**
|
|
1048
1034
|
* Indicator name
|
|
1049
1035
|
*/
|
|
@@ -1059,7 +1045,7 @@ export interface Indicator<D = any> {
|
|
|
1059
1045
|
/**
|
|
1060
1046
|
* Calculation parameters
|
|
1061
1047
|
*/
|
|
1062
|
-
calcParams:
|
|
1048
|
+
calcParams: unknown[];
|
|
1063
1049
|
/**
|
|
1064
1050
|
* Whether ohlc column is required
|
|
1065
1051
|
*/
|
|
@@ -1079,7 +1065,7 @@ export interface Indicator<D = any> {
|
|
|
1079
1065
|
/**
|
|
1080
1066
|
* Extend data
|
|
1081
1067
|
*/
|
|
1082
|
-
extendData:
|
|
1068
|
+
extendData: unknown;
|
|
1083
1069
|
/**
|
|
1084
1070
|
* Indicator series
|
|
1085
1071
|
*/
|
|
@@ -1099,11 +1085,11 @@ export interface Indicator<D = any> {
|
|
|
1099
1085
|
/**
|
|
1100
1086
|
* Style configuration
|
|
1101
1087
|
*/
|
|
1102
|
-
styles: Nullable<
|
|
1088
|
+
styles: Nullable<DeepPartial<IndicatorStyle>>;
|
|
1103
1089
|
/**
|
|
1104
|
-
*
|
|
1090
|
+
* Should update, should calc or draw
|
|
1105
1091
|
*/
|
|
1106
|
-
|
|
1092
|
+
shouldUpdate: Nullable<IndicatorShouldUpdateCallback<D>>;
|
|
1107
1093
|
/**
|
|
1108
1094
|
* Indicator calculation
|
|
1109
1095
|
*/
|
|
@@ -1115,35 +1101,40 @@ export interface Indicator<D = any> {
|
|
|
1115
1101
|
/**
|
|
1116
1102
|
* Create custom tooltip text
|
|
1117
1103
|
*/
|
|
1118
|
-
createTooltipDataSource: Nullable<IndicatorCreateTooltipDataSourceCallback
|
|
1104
|
+
createTooltipDataSource: Nullable<IndicatorCreateTooltipDataSourceCallback<D>>;
|
|
1119
1105
|
/**
|
|
1120
1106
|
* Custom draw
|
|
1121
1107
|
*/
|
|
1122
1108
|
draw: Nullable<IndicatorDrawCallback<D>>;
|
|
1109
|
+
/**
|
|
1110
|
+
* Data state change
|
|
1111
|
+
*/
|
|
1112
|
+
onDataStateChange: Nullable<IndicatorOnDataStateChangeCallback<D>>;
|
|
1123
1113
|
/**
|
|
1124
1114
|
* Calculation result
|
|
1125
1115
|
*/
|
|
1126
1116
|
result: D[];
|
|
1127
1117
|
}
|
|
1128
|
-
export type IndicatorTemplate<D =
|
|
1129
|
-
export type IndicatorCreate<D =
|
|
1118
|
+
export type IndicatorTemplate<D = unknown> = ExcludePickPartial<Omit<Indicator<D>, "result">, "name" | "calc">;
|
|
1119
|
+
export type IndicatorCreate<D = unknown> = ExcludePickPartial<Omit<Indicator<D>, "result">, "name">;
|
|
1120
|
+
export interface IndicatorFilter {
|
|
1121
|
+
name?: string;
|
|
1122
|
+
paneId?: string;
|
|
1123
|
+
}
|
|
1130
1124
|
declare function checkCoordinateOnLine(coordinate: Coordinate, attrs: LineAttrs | LineAttrs[]): boolean;
|
|
1131
1125
|
declare function getLinearYFromSlopeIntercept(kb: Nullable<number[]>, coordinate: Coordinate): number;
|
|
1132
1126
|
declare function getLinearYFromCoordinates(coordinate1: Coordinate, coordinate2: Coordinate, targetCoordinate: Coordinate): number;
|
|
1133
1127
|
declare function getLinearSlopeIntercept(coordinate1: Coordinate, coordinate2: Coordinate): Nullable<number[]>;
|
|
1134
|
-
declare function drawLine(ctx: CanvasRenderingContext2D, attrs: LineAttrs | LineAttrs[], styles: Partial<SmoothLineStyle>): void;
|
|
1135
|
-
declare function drawLineBetweenTwoPoints(ctx: CanvasRenderingContext2D, c1: Coordinate, c2: Coordinate, styles: Partial<SmoothLineStyle>): void;
|
|
1136
1128
|
export interface LineAttrs {
|
|
1137
1129
|
coordinates: Coordinate[];
|
|
1138
1130
|
}
|
|
1139
1131
|
declare function checkCoordinateOnPolygon(coordinate: Coordinate, attrs: PolygonAttrs | PolygonAttrs[]): boolean;
|
|
1140
|
-
declare function drawPolygon(ctx: CanvasRenderingContext2D, attrs: PolygonAttrs | PolygonAttrs[], styles: Partial<PolygonStyle>): void;
|
|
1141
1132
|
export interface PolygonAttrs {
|
|
1142
1133
|
coordinates: Coordinate[];
|
|
1143
1134
|
}
|
|
1144
1135
|
export declare function getSupportedFigures(): string[];
|
|
1145
|
-
export declare function registerFigure<A =
|
|
1146
|
-
export declare function getFigureClass<A =
|
|
1136
|
+
export declare function registerFigure<A = unknown, S = unknown>(figure: FigureTemplate<A, S>): void;
|
|
1137
|
+
export declare function getFigureClass<A = unknown, S = unknown>(name: string): Nullable<FigureConstructor<A, S>>;
|
|
1147
1138
|
export declare function registerIndicator<D>(indicator: IndicatorTemplate<D>): void;
|
|
1148
1139
|
export declare function getSupportedIndicators(): string[];
|
|
1149
1140
|
export declare function registerLocale(locale: string, ls: Locales): void;
|
|
@@ -1152,8 +1143,8 @@ export declare function registerOverlay(template: OverlayTemplate): void;
|
|
|
1152
1143
|
export declare function getOverlayClass(name: string): Nullable<OverlayConstructor>;
|
|
1153
1144
|
export declare function getSupportedOverlays(): string[];
|
|
1154
1145
|
export declare function registerStyles(name: string, ss: DeepPartial<Styles>): void;
|
|
1155
|
-
export declare function registerXAxis(axis:
|
|
1156
|
-
export declare function registerYAxis(axis:
|
|
1146
|
+
export declare function registerXAxis(axis: XAxisTemplate): void;
|
|
1147
|
+
export declare function registerYAxis(axis: YAxisTemplate): void;
|
|
1157
1148
|
/**
|
|
1158
1149
|
* Chart version
|
|
1159
1150
|
* @return {string}
|
|
@@ -1184,7 +1175,7 @@ export declare const utils: {
|
|
|
1184
1175
|
formatValue: typeof formatValue;
|
|
1185
1176
|
formatPrecision: typeof formatPrecision;
|
|
1186
1177
|
formatBigNumber: typeof formatBigNumber;
|
|
1187
|
-
formatDate: typeof
|
|
1178
|
+
formatDate: typeof formatTimestampToString;
|
|
1188
1179
|
formatThousands: typeof formatThousands;
|
|
1189
1180
|
formatFoldDecimal: typeof formatFoldDecimal;
|
|
1190
1181
|
calcTextWidth: typeof calcTextWidth;
|
|
@@ -1197,14 +1188,6 @@ export declare const utils: {
|
|
|
1197
1188
|
checkCoordinateOnPolygon: typeof checkCoordinateOnPolygon;
|
|
1198
1189
|
checkCoordinateOnRect: typeof checkCoordinateOnRect;
|
|
1199
1190
|
checkCoordinateOnText: typeof checkCoordinateOnText;
|
|
1200
|
-
drawArc: typeof drawArc;
|
|
1201
|
-
drawCircle: typeof drawCircle;
|
|
1202
|
-
drawLine: typeof drawLine;
|
|
1203
|
-
drawLineBetweenTwoPoints: typeof drawLineBetweenTwoPoints;
|
|
1204
|
-
drawPolygon: typeof drawPolygon;
|
|
1205
|
-
drawRect: typeof drawRect;
|
|
1206
|
-
drawText: typeof drawText;
|
|
1207
|
-
drawRectText: typeof drawText;
|
|
1208
1191
|
};
|
|
1209
1192
|
|
|
1210
1193
|
export as namespace klinecharts;
|