@chartspire/chartspire-chart 1.1.0 → 10.0.0-alpha3
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 +247 -258
- package/dist/index.esm.js +4557 -5675
- package/dist/umd/klinecharts.js +4560 -5678
- 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,16 +192,22 @@ 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 {
|
|
221
201
|
custom: CandleTooltipCustomCallback | TooltipLegend[];
|
|
222
202
|
rect: CandleTooltipRectStyle;
|
|
223
203
|
}
|
|
204
|
+
export interface RenkoStyle {
|
|
205
|
+
brick: {
|
|
206
|
+
size: number;
|
|
207
|
+
};
|
|
208
|
+
}
|
|
224
209
|
export declare enum CandleType {
|
|
210
|
+
HeikinAshi = "heikin_ashi",
|
|
225
211
|
CandleSolid = "candle_solid",
|
|
226
212
|
CandleStroke = "candle_stroke",
|
|
227
213
|
CandleUpStroke = "candle_up_stroke",
|
|
@@ -243,6 +229,7 @@ export interface CandleStyle {
|
|
|
243
229
|
area: CandleAreaStyle;
|
|
244
230
|
priceMark: CandlePriceMarkStyle;
|
|
245
231
|
tooltip: CandleTooltipStyle;
|
|
232
|
+
renko?: RenkoStyle;
|
|
246
233
|
}
|
|
247
234
|
export type IndicatorPolygonStyle = Omit<PolygonStyle, "color" | "borderColor"> & ChangeColor;
|
|
248
235
|
export interface IndicatorLastValueMarkStyle {
|
|
@@ -260,7 +247,7 @@ export interface IndicatorStyle {
|
|
|
260
247
|
circles: IndicatorPolygonStyle[];
|
|
261
248
|
lastValueMark: IndicatorLastValueMarkStyle;
|
|
262
249
|
tooltip: IndicatorTooltipStyle;
|
|
263
|
-
[key: string]:
|
|
250
|
+
[key: string]: unknown;
|
|
264
251
|
}
|
|
265
252
|
export type AxisLineStyle = Omit<StateLineStyle, "style" | "dashedValue">;
|
|
266
253
|
export interface AxisTickLineStyle extends AxisLineStyle {
|
|
@@ -277,22 +264,6 @@ export interface AxisStyle {
|
|
|
277
264
|
tickLine: AxisTickLineStyle;
|
|
278
265
|
tickText: AxisTickTextStyle;
|
|
279
266
|
}
|
|
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
267
|
export interface CrosshairDirectionStyle {
|
|
297
268
|
show: boolean;
|
|
298
269
|
line: StateLineStyle;
|
|
@@ -321,12 +292,7 @@ export interface OverlayStyle {
|
|
|
321
292
|
circle: PolygonStyle;
|
|
322
293
|
arc: LineStyle;
|
|
323
294
|
text: TextStyle;
|
|
324
|
-
|
|
325
|
-
* @deprecated
|
|
326
|
-
* Starting from v10, it will be deleted
|
|
327
|
-
*/
|
|
328
|
-
rectText: TextStyle;
|
|
329
|
-
[key: string]: any;
|
|
295
|
+
[key: string]: unknown;
|
|
330
296
|
}
|
|
331
297
|
export interface SeparatorStyle {
|
|
332
298
|
size: number;
|
|
@@ -338,23 +304,23 @@ export interface Styles {
|
|
|
338
304
|
grid: GridStyle;
|
|
339
305
|
candle: CandleStyle;
|
|
340
306
|
indicator: IndicatorStyle;
|
|
341
|
-
xAxis:
|
|
342
|
-
yAxis:
|
|
307
|
+
xAxis: AxisStyle;
|
|
308
|
+
yAxis: AxisStyle;
|
|
343
309
|
separator: SeparatorStyle;
|
|
344
310
|
crosshair: CrosshairStyle;
|
|
345
311
|
overlay: OverlayStyle;
|
|
346
312
|
}
|
|
347
313
|
declare function merge(target: any, source: any): void;
|
|
348
314
|
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:
|
|
315
|
+
declare function isArray<T = unknown>(value: unknown): value is T[];
|
|
316
|
+
declare function isFunction<T = (...args: unknown[]) => unknown>(value: unknown): value is T;
|
|
317
|
+
declare function isObject(value: unknown): value is object;
|
|
318
|
+
declare function isNumber(value: unknown): value is number;
|
|
353
319
|
declare function isValid<T>(value: T | null | undefined): value is T;
|
|
354
|
-
declare function isBoolean(value:
|
|
355
|
-
declare function isString(value:
|
|
320
|
+
declare function isBoolean(value: unknown): value is boolean;
|
|
321
|
+
declare function isString(value: unknown): value is string;
|
|
356
322
|
declare function formatValue(data: unknown, key: string, defaultValue?: unknown): unknown;
|
|
357
|
-
declare function
|
|
323
|
+
declare function formatTimestampToString(dateTimeFormat: Intl.DateTimeFormat, timestamp: number, format: string): string;
|
|
358
324
|
declare function formatPrecision(value: string | number, precision?: number): string;
|
|
359
325
|
declare function formatBigNumber(value: string | number): string;
|
|
360
326
|
declare function formatThousands(value: string | number, sign: string): string;
|
|
@@ -373,9 +339,8 @@ declare function calcTextWidth(text: string, size?: number, weight?: string | nu
|
|
|
373
339
|
* See the License for the specific language governing permissions and
|
|
374
340
|
* limitations under the License.
|
|
375
341
|
*/
|
|
376
|
-
export type ActionCallback = (data?:
|
|
342
|
+
export type ActionCallback = (data?: unknown) => void;
|
|
377
343
|
export declare enum ActionType {
|
|
378
|
-
OnDataReady = "onDataReady",
|
|
379
344
|
OnZoom = "onZoom",
|
|
380
345
|
OnScroll = "onScroll",
|
|
381
346
|
OnVisibleRangeChange = "onVisibleRangeChange",
|
|
@@ -397,7 +362,9 @@ export declare enum ActionType {
|
|
|
397
362
|
* See the License for the specific language governing permissions and
|
|
398
363
|
* limitations under the License.
|
|
399
364
|
*/
|
|
400
|
-
export type
|
|
365
|
+
export type DeepPartial<T> = {
|
|
366
|
+
[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];
|
|
367
|
+
};
|
|
401
368
|
/**
|
|
402
369
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
403
370
|
* you may not use this file except in compliance with the License.
|
|
@@ -411,14 +378,8 @@ export type ExcludePickPartial<T, K extends keyof T> = Partial<Omit<T, K>> & Pic
|
|
|
411
378
|
* See the License for the specific language governing permissions and
|
|
412
379
|
* limitations under the License.
|
|
413
380
|
*/
|
|
414
|
-
export
|
|
415
|
-
|
|
416
|
-
height: number;
|
|
417
|
-
left: number;
|
|
418
|
-
right: number;
|
|
419
|
-
top: number;
|
|
420
|
-
bottom: number;
|
|
421
|
-
}
|
|
381
|
+
export type PickRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
|
382
|
+
export type ExcludePickPartial<T, K extends keyof T> = PickRequired<Partial<T>, K>;
|
|
422
383
|
/**
|
|
423
384
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
424
385
|
* you may not use this file except in compliance with the License.
|
|
@@ -432,11 +393,13 @@ export interface Bounding {
|
|
|
432
393
|
* See the License for the specific language governing permissions and
|
|
433
394
|
* limitations under the License.
|
|
434
395
|
*/
|
|
435
|
-
export interface
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
396
|
+
export interface Bounding {
|
|
397
|
+
width: number;
|
|
398
|
+
height: number;
|
|
399
|
+
left: number;
|
|
400
|
+
right: number;
|
|
401
|
+
top: number;
|
|
402
|
+
bottom: number;
|
|
440
403
|
}
|
|
441
404
|
/**
|
|
442
405
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -477,16 +440,11 @@ export interface Coordinate {
|
|
|
477
440
|
export interface Crosshair extends Partial<Coordinate> {
|
|
478
441
|
paneId?: string;
|
|
479
442
|
realX?: number;
|
|
480
|
-
|
|
443
|
+
timestamp?: number;
|
|
444
|
+
kLineData?: KLineData;
|
|
481
445
|
dataIndex?: number;
|
|
482
446
|
realDataIndex?: number;
|
|
483
447
|
}
|
|
484
|
-
export interface MouseTouchEvent extends Coordinate {
|
|
485
|
-
pageX: number;
|
|
486
|
-
pageY: number;
|
|
487
|
-
isTouch?: boolean;
|
|
488
|
-
preventDefault?: () => void;
|
|
489
|
-
}
|
|
490
448
|
/**
|
|
491
449
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
492
450
|
* you may not use this file except in compliance with the License.
|
|
@@ -500,9 +458,18 @@ export interface MouseTouchEvent extends Coordinate {
|
|
|
500
458
|
* See the License for the specific language governing permissions and
|
|
501
459
|
* limitations under the License.
|
|
502
460
|
*/
|
|
503
|
-
export
|
|
504
|
-
|
|
505
|
-
|
|
461
|
+
export interface VisibleRange {
|
|
462
|
+
readonly from: number;
|
|
463
|
+
readonly to: number;
|
|
464
|
+
readonly realFrom: number;
|
|
465
|
+
readonly realTo: number;
|
|
466
|
+
}
|
|
467
|
+
export interface MouseTouchEvent extends Coordinate {
|
|
468
|
+
pageX: number;
|
|
469
|
+
pageY: number;
|
|
470
|
+
isTouch?: boolean;
|
|
471
|
+
preventDefault?: () => void;
|
|
472
|
+
}
|
|
506
473
|
/**
|
|
507
474
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
508
475
|
* you may not use this file except in compliance with the License.
|
|
@@ -521,20 +488,20 @@ export interface Point {
|
|
|
521
488
|
timestamp: number;
|
|
522
489
|
value: number;
|
|
523
490
|
}
|
|
524
|
-
/**
|
|
525
|
-
* Since v9.8.0 deprecated, since v10 removed
|
|
526
|
-
* @deprecated
|
|
527
|
-
*/
|
|
528
|
-
export type LoadMoreCallback = (timestamp: Nullable<number>) => void;
|
|
529
491
|
declare enum LoadDataType {
|
|
530
492
|
Init = "init",
|
|
531
493
|
Forward = "forward",
|
|
532
|
-
Backward = "backward"
|
|
494
|
+
Backward = "backward",
|
|
495
|
+
Update = "update"
|
|
533
496
|
}
|
|
534
497
|
export interface LoadDataParams {
|
|
535
498
|
type: LoadDataType;
|
|
536
|
-
data: Nullable<
|
|
537
|
-
callback: (dataList:
|
|
499
|
+
data: Nullable<KLineData>;
|
|
500
|
+
callback: (dataList: KLineData[], more?: boolean) => void;
|
|
501
|
+
}
|
|
502
|
+
export interface LoadDataMore {
|
|
503
|
+
[LoadDataType.Backward]: boolean;
|
|
504
|
+
[LoadDataType.Forward]: boolean;
|
|
538
505
|
}
|
|
539
506
|
export type LoadDataCallback = (params: LoadDataParams) => void;
|
|
540
507
|
/**
|
|
@@ -554,46 +521,26 @@ export interface Precision {
|
|
|
554
521
|
price: number;
|
|
555
522
|
volume: number;
|
|
556
523
|
}
|
|
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"
|
|
524
|
+
export declare const enum PaneState {
|
|
525
|
+
Normal = "normal",
|
|
526
|
+
Maximize = "maximize",
|
|
527
|
+
Minimize = "minimize"
|
|
581
528
|
}
|
|
582
529
|
export interface PaneOptions {
|
|
583
530
|
id?: string;
|
|
584
531
|
height?: number;
|
|
585
532
|
minHeight?: number;
|
|
586
533
|
dragEnabled?: boolean;
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
534
|
+
order?: number;
|
|
535
|
+
state?: PaneState;
|
|
536
|
+
axis?: Partial<AxisCreate>;
|
|
590
537
|
}
|
|
591
538
|
export declare enum FormatDateType {
|
|
592
539
|
Tooltip = 0,
|
|
593
540
|
Crosshair = 1,
|
|
594
541
|
XAxis = 2
|
|
595
542
|
}
|
|
596
|
-
export type FormatDate = (
|
|
543
|
+
export type FormatDate = (timestamp: number, format: string, type: FormatDateType) => string;
|
|
597
544
|
export type FormatBigNumber = (value: string | number) => string;
|
|
598
545
|
export interface CustomApi {
|
|
599
546
|
formatDate: FormatDate;
|
|
@@ -620,17 +567,28 @@ export interface LayoutChild {
|
|
|
620
567
|
content?: Array<string | IndicatorCreate>;
|
|
621
568
|
options?: PaneOptions;
|
|
622
569
|
}
|
|
570
|
+
export interface DecimalFold {
|
|
571
|
+
threshold: number;
|
|
572
|
+
format: (value: string | number) => string;
|
|
573
|
+
}
|
|
574
|
+
export interface ThousandsSeparator {
|
|
575
|
+
sign: string;
|
|
576
|
+
format: (value: string | number) => string;
|
|
577
|
+
}
|
|
623
578
|
export interface Options {
|
|
624
|
-
layout?: LayoutChild[];
|
|
625
579
|
locale?: string;
|
|
626
580
|
timezone?: string;
|
|
627
581
|
styles?: string | DeepPartial<Styles>;
|
|
628
582
|
customApi?: Partial<CustomApi>;
|
|
629
|
-
thousandsSeparator?:
|
|
630
|
-
|
|
583
|
+
thousandsSeparator?: Partial<ThousandsSeparator>;
|
|
584
|
+
decimalFold?: Partial<DecimalFold>;
|
|
585
|
+
layout?: LayoutChild[];
|
|
631
586
|
}
|
|
632
|
-
export
|
|
587
|
+
export type YAxisTemplate = AxisTemplate;
|
|
588
|
+
export interface YAxis extends Axis, Required<YAxisTemplate> {
|
|
633
589
|
isFromZero: () => boolean;
|
|
590
|
+
isInCandle: () => boolean;
|
|
591
|
+
convertToNicePixel: (value: number) => number;
|
|
634
592
|
}
|
|
635
593
|
export declare enum OverlayMode {
|
|
636
594
|
Normal = "normal",
|
|
@@ -648,20 +606,15 @@ export type OverlayFigureIgnoreEventType = "mouseClickEvent" | "mouseRightClickE
|
|
|
648
606
|
export interface OverlayFigure {
|
|
649
607
|
key?: string;
|
|
650
608
|
type: string;
|
|
651
|
-
attrs:
|
|
652
|
-
styles?:
|
|
609
|
+
attrs: unknown;
|
|
610
|
+
styles?: unknown;
|
|
653
611
|
ignoreEvent?: boolean | OverlayFigureIgnoreEventType[];
|
|
654
612
|
}
|
|
655
613
|
export interface OverlayCreateFiguresCallbackParams {
|
|
614
|
+
chart: Chart;
|
|
656
615
|
overlay: Overlay;
|
|
657
616
|
coordinates: Coordinate[];
|
|
658
617
|
bounding: Bounding;
|
|
659
|
-
barSpace: BarSpace;
|
|
660
|
-
precision: Precision;
|
|
661
|
-
thousandsSeparator: string;
|
|
662
|
-
decimalFoldThreshold: number;
|
|
663
|
-
dateTimeFormat: Intl.DateTimeFormat;
|
|
664
|
-
defaultStyles: OverlayStyle;
|
|
665
618
|
xAxis: Nullable<XAxis>;
|
|
666
619
|
yAxis: Nullable<YAxis>;
|
|
667
620
|
}
|
|
@@ -669,6 +622,7 @@ export interface OverlayEvent extends Partial<MouseTouchEvent> {
|
|
|
669
622
|
figureKey?: string;
|
|
670
623
|
figureIndex?: number;
|
|
671
624
|
overlay: Overlay;
|
|
625
|
+
chart: Chart;
|
|
672
626
|
}
|
|
673
627
|
export type OverlayEventCallback = (event: OverlayEvent) => boolean;
|
|
674
628
|
export type OverlayCreateFiguresCallback = (params: OverlayCreateFiguresCallbackParams) => OverlayFigure | OverlayFigure[];
|
|
@@ -736,7 +690,7 @@ export interface Overlay {
|
|
|
736
690
|
/**
|
|
737
691
|
* Extended Data
|
|
738
692
|
*/
|
|
739
|
-
extendData:
|
|
693
|
+
extendData: unknown;
|
|
740
694
|
/**
|
|
741
695
|
* The style information and format are consistent with the overlay in the unified configuration
|
|
742
696
|
*/
|
|
@@ -819,31 +773,25 @@ export interface Overlay {
|
|
|
819
773
|
onDeselected: Nullable<OverlayEventCallback>;
|
|
820
774
|
}
|
|
821
775
|
export type OverlayTemplate = ExcludePickPartial<Omit<Overlay, "id" | "groupId" | "paneId" | "points" | "currentStep">, "name">;
|
|
822
|
-
export type OverlayCreate = ExcludePickPartial<Omit<Overlay, "
|
|
823
|
-
export type
|
|
776
|
+
export type OverlayCreate = ExcludePickPartial<Omit<Overlay, "currentStep" | "totalStep" | "createPointFigures" | "createXAxisFigures" | "createYAxisFigures" | "performEventPressedMove" | "performEventMoveForDrawing">, "name">;
|
|
777
|
+
export type OverlayFilter = Partial<Pick<Overlay, "id" | "groupId" | "name" | "paneId">>;
|
|
824
778
|
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>;
|
|
779
|
+
export interface Store {
|
|
780
|
+
setStyles: (value: string | DeepPartial<Styles>) => void;
|
|
781
|
+
getStyles: () => Styles;
|
|
782
|
+
setCustomApi: (api: Partial<CustomApi>) => void;
|
|
783
|
+
getCustomApi: () => CustomApi;
|
|
838
784
|
setLocale: (locale: string) => void;
|
|
839
785
|
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
786
|
setTimezone: (timezone: string) => void;
|
|
846
787
|
getTimezone: () => string;
|
|
788
|
+
setThousandsSeparator: (thousandsSeparator: Partial<ThousandsSeparator>) => void;
|
|
789
|
+
getThousandsSeparator: () => ThousandsSeparator;
|
|
790
|
+
setDecimalFold: (decimalFold: Partial<DecimalFold>) => void;
|
|
791
|
+
getDecimalFold: () => DecimalFold;
|
|
792
|
+
getPrecision: () => Precision;
|
|
793
|
+
setPrecision: (precision: Partial<Precision>) => void;
|
|
794
|
+
getDataList: () => KLineData[];
|
|
847
795
|
setOffsetRightDistance: (distance: number) => void;
|
|
848
796
|
getOffsetRightDistance: () => number;
|
|
849
797
|
setMaxOffsetLeftDistance: (distance: number) => void;
|
|
@@ -851,36 +799,40 @@ export interface Chart {
|
|
|
851
799
|
setLeftMinVisibleBarCount: (barCount: number) => void;
|
|
852
800
|
setRightMinVisibleBarCount: (barCount: number) => void;
|
|
853
801
|
setBarSpace: (space: number) => void;
|
|
854
|
-
getBarSpace: () =>
|
|
802
|
+
getBarSpace: () => BarSpace;
|
|
855
803
|
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;
|
|
804
|
+
setLoadMoreDataCallback: (callback: LoadDataCallback) => void;
|
|
805
|
+
overrideIndicator: (override: IndicatorCreate, paneId?: string) => boolean;
|
|
806
|
+
removeIndicator: (filter?: IndicatorFilter) => boolean;
|
|
807
|
+
overrideOverlay: (override: Partial<OverlayCreate>) => boolean;
|
|
808
|
+
removeOverlay: (filter?: OverlayFilter) => boolean;
|
|
880
809
|
setZoomEnabled: (enabled: boolean) => void;
|
|
881
810
|
isZoomEnabled: () => boolean;
|
|
882
811
|
setScrollEnabled: (enabled: boolean) => void;
|
|
883
812
|
isScrollEnabled: () => boolean;
|
|
813
|
+
clearData: () => void;
|
|
814
|
+
}
|
|
815
|
+
export declare enum DomPosition {
|
|
816
|
+
Root = "root",
|
|
817
|
+
Main = "main",
|
|
818
|
+
YAxis = "yAxis"
|
|
819
|
+
}
|
|
820
|
+
export interface ConvertFilter {
|
|
821
|
+
paneId?: string;
|
|
822
|
+
absolute?: boolean;
|
|
823
|
+
}
|
|
824
|
+
export interface Chart extends Store {
|
|
825
|
+
id: string;
|
|
826
|
+
getDom: (paneId?: string, position?: DomPosition) => Nullable<HTMLElement>;
|
|
827
|
+
getSize: (paneId?: string, position?: DomPosition) => Nullable<Bounding>;
|
|
828
|
+
applyNewData: (dataList: KLineData[], more?: boolean | Partial<LoadDataMore>) => void;
|
|
829
|
+
updateData: (data: KLineData) => void;
|
|
830
|
+
createIndicator: (value: string | IndicatorCreate, isStack?: boolean, paneOptions?: PaneOptions) => Nullable<string>;
|
|
831
|
+
getIndicators: (filter?: IndicatorFilter) => Map<string, Indicator[]>;
|
|
832
|
+
createOverlay: (value: string | OverlayCreate | Array<string | OverlayCreate>) => Nullable<string> | Array<Nullable<string>>;
|
|
833
|
+
getOverlays: (filter?: OverlayFilter) => Map<string, Overlay[]>;
|
|
834
|
+
setPaneOptions: (options: PaneOptions) => void;
|
|
835
|
+
getPaneOptions: (id?: string) => Nullable<PaneOptions> | PaneOptions[];
|
|
884
836
|
scrollByDistance: (distance: number, animationDuration?: number) => void;
|
|
885
837
|
scrollToRealTime: (animationDuration?: number) => void;
|
|
886
838
|
scrollToDataIndex: (dataIndex: number, animationDuration?: number) => void;
|
|
@@ -888,12 +840,12 @@ export interface Chart {
|
|
|
888
840
|
zoomAtCoordinate: (scale: number, coordinate?: Coordinate, animationDuration?: number) => void;
|
|
889
841
|
zoomAtDataIndex: (scale: number, dataIndex: number, animationDuration?: number) => void;
|
|
890
842
|
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:
|
|
843
|
+
convertToPixel: (points: Partial<Point> | Array<Partial<Point>>, filter?: ConvertFilter) => Partial<Coordinate> | Array<Partial<Coordinate>>;
|
|
844
|
+
convertFromPixel: (coordinates: Array<Partial<Coordinate>>, filter?: ConvertFilter) => Partial<Point> | Array<Partial<Point>>;
|
|
845
|
+
executeAction: (type: ActionType, data: Crosshair) => void;
|
|
894
846
|
subscribeAction: (type: ActionType, callback: ActionCallback) => void;
|
|
895
847
|
unsubscribeAction: (type: ActionType, callback?: ActionCallback) => void;
|
|
896
|
-
getConvertPictureUrl: (includeOverlay?: boolean, type?:
|
|
848
|
+
getConvertPictureUrl: (includeOverlay?: boolean, type?: "png" | "jpeg" | "bmp", backgroundColor?: string) => string;
|
|
897
849
|
resize: () => void;
|
|
898
850
|
}
|
|
899
851
|
export interface AxisTick {
|
|
@@ -904,49 +856,89 @@ export interface AxisTick {
|
|
|
904
856
|
export interface AxisRange extends VisibleRange {
|
|
905
857
|
readonly range: number;
|
|
906
858
|
readonly realRange: number;
|
|
859
|
+
readonly displayFrom: number;
|
|
860
|
+
readonly displayTo: number;
|
|
861
|
+
readonly displayRange: number;
|
|
907
862
|
}
|
|
908
|
-
export interface
|
|
909
|
-
|
|
910
|
-
|
|
863
|
+
export interface AxisGap {
|
|
864
|
+
top?: number;
|
|
865
|
+
bottom?: number;
|
|
866
|
+
}
|
|
867
|
+
declare enum AxisPosition {
|
|
868
|
+
Left = "left",
|
|
869
|
+
Right = "right"
|
|
870
|
+
}
|
|
871
|
+
export interface AxisValueToValueParams {
|
|
872
|
+
range: AxisRange;
|
|
873
|
+
}
|
|
874
|
+
export type AxisValueToValueCallback = (value: number, params: AxisValueToValueParams) => number;
|
|
875
|
+
export interface AxisCreateRangeParams {
|
|
876
|
+
chart: Chart;
|
|
877
|
+
paneId: string;
|
|
878
|
+
defaultRange: AxisRange;
|
|
911
879
|
}
|
|
880
|
+
export type AxisCreateRangeCallback = (params: AxisCreateRangeParams) => AxisRange;
|
|
912
881
|
export interface AxisCreateTicksParams {
|
|
913
882
|
range: AxisRange;
|
|
914
883
|
bounding: Bounding;
|
|
915
884
|
defaultTicks: AxisTick[];
|
|
916
885
|
}
|
|
917
886
|
export type AxisCreateTicksCallback = (params: AxisCreateTicksParams) => AxisTick[];
|
|
887
|
+
export type AxisMinSpanCallback = (value: number) => number;
|
|
918
888
|
export interface AxisTemplate {
|
|
919
889
|
name: string;
|
|
920
|
-
|
|
890
|
+
reverse?: boolean;
|
|
891
|
+
inside?: boolean;
|
|
892
|
+
position?: AxisPosition;
|
|
893
|
+
scrollZoomEnabled?: boolean;
|
|
894
|
+
gap?: AxisGap;
|
|
895
|
+
valueToRealValue?: AxisValueToValueCallback;
|
|
896
|
+
realValueToDisplayValue?: AxisValueToValueCallback;
|
|
897
|
+
displayValueToRealValue?: AxisValueToValueCallback;
|
|
898
|
+
realValueToValue?: AxisValueToValueCallback;
|
|
899
|
+
displayValueToText?: (value: number, precision: number) => string;
|
|
900
|
+
minSpan?: AxisMinSpanCallback;
|
|
901
|
+
createRange?: AxisCreateRangeCallback;
|
|
902
|
+
createTicks?: AxisCreateTicksCallback;
|
|
903
|
+
}
|
|
904
|
+
export interface Axis {
|
|
905
|
+
override: (axis: AxisTemplate) => void;
|
|
906
|
+
getTicks: () => AxisTick[];
|
|
907
|
+
getRange: () => AxisRange;
|
|
908
|
+
getAutoSize: () => number;
|
|
909
|
+
convertToPixel: (value: number) => number;
|
|
910
|
+
convertFromPixel: (px: number) => number;
|
|
921
911
|
}
|
|
922
|
-
export type
|
|
923
|
-
export
|
|
912
|
+
export type AxisCreate = Omit<AxisTemplate, "displayValueToText" | "valueToRealValue" | "realValueToDisplayValue" | "displayValueToRealValue" | "realValueToValue">;
|
|
913
|
+
export type XAxisTemplate = Pick<AxisTemplate, "name" | "scrollZoomEnabled" | "createTicks">;
|
|
914
|
+
export interface XAxis extends Axis, Required<XAxisTemplate> {
|
|
915
|
+
convertTimestampFromPixel: (pixel: number) => Nullable<number>;
|
|
916
|
+
convertTimestampToPixel: (timestamp: number) => number;
|
|
917
|
+
}
|
|
918
|
+
export interface Figure<A = unknown, S = unknown> {
|
|
924
919
|
name: string;
|
|
925
920
|
attrs: A;
|
|
926
921
|
styles: S;
|
|
927
922
|
draw: (ctx: CanvasRenderingContext2D, attrs: A, styles: S) => void;
|
|
928
923
|
checkEventOn: (coordinate: Coordinate, attrs: A, styles: S) => boolean;
|
|
929
924
|
}
|
|
930
|
-
export type FigureTemplate<A =
|
|
931
|
-
export type FigureCreate<A =
|
|
932
|
-
export type FigureConstructor<A =
|
|
925
|
+
export type FigureTemplate<A = unknown, S = unknown> = Pick<Figure<A, S>, "name" | "draw" | "checkEventOn">;
|
|
926
|
+
export type FigureCreate<A = unknown, S = unknown> = Pick<Figure<A, S>, "name" | "attrs" | "styles">;
|
|
927
|
+
export type FigureConstructor<A = unknown, S = unknown> = new (figure: FigureCreate<A, S>) => ({
|
|
933
928
|
draw: (ctx: CanvasRenderingContext2D) => void;
|
|
934
929
|
});
|
|
935
930
|
declare function checkCoordinateOnCircle(coordinate: Coordinate, attrs: CircleAttrs | CircleAttrs[]): boolean;
|
|
936
|
-
declare function drawCircle(ctx: CanvasRenderingContext2D, attrs: CircleAttrs | CircleAttrs[], styles: Partial<PolygonStyle>): void;
|
|
937
931
|
export interface CircleAttrs {
|
|
938
932
|
x: number;
|
|
939
933
|
y: number;
|
|
940
934
|
r: number;
|
|
941
935
|
}
|
|
942
936
|
declare function checkCoordinateOnArc(coordinate: Coordinate, attrs: ArcAttrs | ArcAttrs[]): boolean;
|
|
943
|
-
declare function drawArc(ctx: CanvasRenderingContext2D, attrs: ArcAttrs | ArcAttrs[], styles: Partial<LineStyle>): void;
|
|
944
937
|
export interface ArcAttrs extends CircleAttrs {
|
|
945
938
|
startAngle: number;
|
|
946
939
|
endAngle: number;
|
|
947
940
|
}
|
|
948
941
|
declare function checkCoordinateOnRect(coordinate: Coordinate, attrs: RectAttrs | RectAttrs[]): boolean;
|
|
949
|
-
declare function drawRect(ctx: CanvasRenderingContext2D, attrs: RectAttrs | RectAttrs[], styles: Partial<RectStyle>): void;
|
|
950
942
|
export interface RectAttrs {
|
|
951
943
|
x: number;
|
|
952
944
|
y: number;
|
|
@@ -954,7 +946,6 @@ export interface RectAttrs {
|
|
|
954
946
|
height: number;
|
|
955
947
|
}
|
|
956
948
|
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
949
|
export interface TextAttrs {
|
|
959
950
|
x: number;
|
|
960
951
|
y: number;
|
|
@@ -969,81 +960,82 @@ export declare enum IndicatorSeries {
|
|
|
969
960
|
Price = "price",
|
|
970
961
|
Volume = "volume"
|
|
971
962
|
}
|
|
972
|
-
export type
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
export type IndicatorFigureAttrs = Partial<ArcAttrs> & Partial<LineStyle> & Partial<RectAttrs> & Partial<TextAttrs> & Record<string, any>;
|
|
963
|
+
export type IndicatorFigureStyle = Partial<Omit<SmoothLineStyle, "style">> & Partial<Omit<RectStyle, "style">> & Partial<TextStyle> & Partial<{
|
|
964
|
+
style: LineType[keyof LineType];
|
|
965
|
+
}> & Record<string, unknown>;
|
|
966
|
+
export type IndicatorFigureAttrs = Partial<ArcAttrs> & Partial<LineStyle> & Partial<RectAttrs> & Partial<TextAttrs> & Record<string, unknown>;
|
|
977
967
|
export interface IndicatorFigureCallbackBrother<PCN> {
|
|
978
968
|
prev: PCN;
|
|
979
969
|
current: PCN;
|
|
980
970
|
next: PCN;
|
|
981
971
|
}
|
|
982
|
-
export type IndicatorFigureAttrsCallbackCoordinate<D> = IndicatorFigureCallbackBrother<Record<keyof D, number> & {
|
|
983
|
-
x: number;
|
|
984
|
-
}>;
|
|
985
972
|
export interface IndicatorFigureAttrsCallbackParams<D> {
|
|
986
|
-
|
|
973
|
+
data: IndicatorFigureCallbackBrother<Nullable<D>>;
|
|
974
|
+
coordinate: IndicatorFigureCallbackBrother<Record<keyof D, number> & {
|
|
975
|
+
x: number;
|
|
976
|
+
}>;
|
|
987
977
|
bounding: Bounding;
|
|
988
978
|
barSpace: BarSpace;
|
|
989
979
|
xAxis: XAxis;
|
|
990
980
|
yAxis: YAxis;
|
|
991
981
|
}
|
|
992
|
-
export interface
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
export interface PatternFigureDataCallbackInterface<D> {
|
|
997
|
-
kLineData?: CandleStickData;
|
|
998
|
-
indicatorData?: D;
|
|
982
|
+
export interface IndicatorFigureStylesCallbackParams<D> {
|
|
983
|
+
data: IndicatorFigureCallbackBrother<Nullable<D>>;
|
|
984
|
+
indicator: Indicator<D>;
|
|
985
|
+
defaultStyles?: IndicatorStyle;
|
|
999
986
|
}
|
|
1000
|
-
export type IndicatorFigureStylesCallbackData<D> = IndicatorFigureCallbackBrother<IndicatorFigureStylesCallbackDataChild<D>>;
|
|
1001
|
-
export type PatternFigureDataCallbackData<D> = PatternFigureDataCallbackInterface<D>;
|
|
1002
987
|
export type IndicatorFigureAttrsCallback<D> = (params: IndicatorFigureAttrsCallbackParams<D>) => IndicatorFigureAttrs;
|
|
1003
|
-
export type IndicatorFigureStylesCallback<D> = (
|
|
1004
|
-
export
|
|
1005
|
-
export interface IndicatorFigure<D = any> {
|
|
988
|
+
export type IndicatorFigureStylesCallback<D> = (params: IndicatorFigureStylesCallbackParams<D>) => IndicatorFigureStyle;
|
|
989
|
+
export interface IndicatorFigure<D = unknown> {
|
|
1006
990
|
key: string;
|
|
1007
991
|
title?: string;
|
|
1008
992
|
type?: string;
|
|
1009
993
|
baseValue?: number;
|
|
1010
994
|
attrs?: IndicatorFigureAttrsCallback<D>;
|
|
1011
995
|
styles?: IndicatorFigureStylesCallback<D>;
|
|
1012
|
-
patternData?: PatternFigureCallback<D>;
|
|
1013
|
-
textMessage?: string;
|
|
1014
996
|
}
|
|
1015
|
-
export type IndicatorRegenerateFiguresCallback<D
|
|
997
|
+
export type IndicatorRegenerateFiguresCallback<D> = (calcParams: unknown[]) => Array<IndicatorFigure<D>>;
|
|
1016
998
|
export interface IndicatorTooltipData {
|
|
1017
999
|
name: string;
|
|
1018
1000
|
calcParamsText: string;
|
|
1019
1001
|
icons: TooltipIconStyle[];
|
|
1020
|
-
|
|
1002
|
+
legends: TooltipLegend[];
|
|
1021
1003
|
}
|
|
1022
|
-
export interface IndicatorCreateTooltipDataSourceParams<D
|
|
1023
|
-
|
|
1004
|
+
export interface IndicatorCreateTooltipDataSourceParams<D> {
|
|
1005
|
+
chart: Chart;
|
|
1024
1006
|
indicator: Indicator<D>;
|
|
1025
|
-
visibleRange: VisibleRange;
|
|
1026
1007
|
bounding: Bounding;
|
|
1027
1008
|
crosshair: Crosshair;
|
|
1028
|
-
defaultStyles: IndicatorStyle;
|
|
1029
1009
|
xAxis: XAxis;
|
|
1030
1010
|
yAxis: YAxis;
|
|
1031
1011
|
}
|
|
1032
|
-
export type IndicatorCreateTooltipDataSourceCallback<D
|
|
1033
|
-
export interface IndicatorDrawParams<D
|
|
1012
|
+
export type IndicatorCreateTooltipDataSourceCallback<D> = (params: IndicatorCreateTooltipDataSourceParams<D>) => IndicatorTooltipData;
|
|
1013
|
+
export interface IndicatorDrawParams<D> {
|
|
1034
1014
|
ctx: CanvasRenderingContext2D;
|
|
1035
|
-
|
|
1015
|
+
chart: Chart;
|
|
1036
1016
|
indicator: Indicator<D>;
|
|
1037
|
-
visibleRange: VisibleRange;
|
|
1038
1017
|
bounding: Bounding;
|
|
1039
|
-
barSpace: BarSpace;
|
|
1040
|
-
defaultStyles: IndicatorStyle;
|
|
1041
1018
|
xAxis: XAxis;
|
|
1042
1019
|
yAxis: YAxis;
|
|
1043
1020
|
}
|
|
1044
|
-
export type IndicatorDrawCallback<D
|
|
1045
|
-
export type IndicatorCalcCallback<D> = (dataList:
|
|
1046
|
-
export
|
|
1021
|
+
export type IndicatorDrawCallback<D> = (params: IndicatorDrawParams<D>) => boolean;
|
|
1022
|
+
export type IndicatorCalcCallback<D> = (dataList: KLineData[], indicator: Indicator<D>) => Promise<D[]> | D[];
|
|
1023
|
+
export type IndicatorShouldUpdateCallback<D> = (prev: Indicator<D>, current: Indicator<D>) => (boolean | {
|
|
1024
|
+
calc: boolean;
|
|
1025
|
+
draw: boolean;
|
|
1026
|
+
});
|
|
1027
|
+
declare enum IndicatorDataState {
|
|
1028
|
+
Loading = "loading",
|
|
1029
|
+
Error = "error",
|
|
1030
|
+
Ready = "ready"
|
|
1031
|
+
}
|
|
1032
|
+
export interface IndicatorOnDataStateChangeParams<D> {
|
|
1033
|
+
state: IndicatorDataState;
|
|
1034
|
+
type: LoadDataType;
|
|
1035
|
+
indicator: Indicator<D>;
|
|
1036
|
+
}
|
|
1037
|
+
export type IndicatorOnDataStateChangeCallback<D> = (params: IndicatorOnDataStateChangeParams<D>) => void;
|
|
1038
|
+
export interface Indicator<D = unknown> {
|
|
1047
1039
|
/**
|
|
1048
1040
|
* Indicator name
|
|
1049
1041
|
*/
|
|
@@ -1059,7 +1051,7 @@ export interface Indicator<D = any> {
|
|
|
1059
1051
|
/**
|
|
1060
1052
|
* Calculation parameters
|
|
1061
1053
|
*/
|
|
1062
|
-
calcParams:
|
|
1054
|
+
calcParams: unknown[];
|
|
1063
1055
|
/**
|
|
1064
1056
|
* Whether ohlc column is required
|
|
1065
1057
|
*/
|
|
@@ -1079,7 +1071,7 @@ export interface Indicator<D = any> {
|
|
|
1079
1071
|
/**
|
|
1080
1072
|
* Extend data
|
|
1081
1073
|
*/
|
|
1082
|
-
extendData:
|
|
1074
|
+
extendData: unknown;
|
|
1083
1075
|
/**
|
|
1084
1076
|
* Indicator series
|
|
1085
1077
|
*/
|
|
@@ -1099,11 +1091,11 @@ export interface Indicator<D = any> {
|
|
|
1099
1091
|
/**
|
|
1100
1092
|
* Style configuration
|
|
1101
1093
|
*/
|
|
1102
|
-
styles: Nullable<
|
|
1094
|
+
styles: Nullable<DeepPartial<IndicatorStyle>>;
|
|
1103
1095
|
/**
|
|
1104
|
-
*
|
|
1096
|
+
* Should update, should calc or draw
|
|
1105
1097
|
*/
|
|
1106
|
-
|
|
1098
|
+
shouldUpdate: Nullable<IndicatorShouldUpdateCallback<D>>;
|
|
1107
1099
|
/**
|
|
1108
1100
|
* Indicator calculation
|
|
1109
1101
|
*/
|
|
@@ -1115,35 +1107,40 @@ export interface Indicator<D = any> {
|
|
|
1115
1107
|
/**
|
|
1116
1108
|
* Create custom tooltip text
|
|
1117
1109
|
*/
|
|
1118
|
-
createTooltipDataSource: Nullable<IndicatorCreateTooltipDataSourceCallback
|
|
1110
|
+
createTooltipDataSource: Nullable<IndicatorCreateTooltipDataSourceCallback<D>>;
|
|
1119
1111
|
/**
|
|
1120
1112
|
* Custom draw
|
|
1121
1113
|
*/
|
|
1122
1114
|
draw: Nullable<IndicatorDrawCallback<D>>;
|
|
1115
|
+
/**
|
|
1116
|
+
* Data state change
|
|
1117
|
+
*/
|
|
1118
|
+
onDataStateChange: Nullable<IndicatorOnDataStateChangeCallback<D>>;
|
|
1123
1119
|
/**
|
|
1124
1120
|
* Calculation result
|
|
1125
1121
|
*/
|
|
1126
1122
|
result: D[];
|
|
1127
1123
|
}
|
|
1128
|
-
export type IndicatorTemplate<D =
|
|
1129
|
-
export type IndicatorCreate<D =
|
|
1124
|
+
export type IndicatorTemplate<D = unknown> = ExcludePickPartial<Omit<Indicator<D>, "result">, "name" | "calc">;
|
|
1125
|
+
export type IndicatorCreate<D = unknown> = ExcludePickPartial<Omit<Indicator<D>, "result">, "name">;
|
|
1126
|
+
export interface IndicatorFilter {
|
|
1127
|
+
name?: string;
|
|
1128
|
+
paneId?: string;
|
|
1129
|
+
}
|
|
1130
1130
|
declare function checkCoordinateOnLine(coordinate: Coordinate, attrs: LineAttrs | LineAttrs[]): boolean;
|
|
1131
1131
|
declare function getLinearYFromSlopeIntercept(kb: Nullable<number[]>, coordinate: Coordinate): number;
|
|
1132
1132
|
declare function getLinearYFromCoordinates(coordinate1: Coordinate, coordinate2: Coordinate, targetCoordinate: Coordinate): number;
|
|
1133
1133
|
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
1134
|
export interface LineAttrs {
|
|
1137
1135
|
coordinates: Coordinate[];
|
|
1138
1136
|
}
|
|
1139
1137
|
declare function checkCoordinateOnPolygon(coordinate: Coordinate, attrs: PolygonAttrs | PolygonAttrs[]): boolean;
|
|
1140
|
-
declare function drawPolygon(ctx: CanvasRenderingContext2D, attrs: PolygonAttrs | PolygonAttrs[], styles: Partial<PolygonStyle>): void;
|
|
1141
1138
|
export interface PolygonAttrs {
|
|
1142
1139
|
coordinates: Coordinate[];
|
|
1143
1140
|
}
|
|
1144
1141
|
export declare function getSupportedFigures(): string[];
|
|
1145
|
-
export declare function registerFigure<A =
|
|
1146
|
-
export declare function getFigureClass<A =
|
|
1142
|
+
export declare function registerFigure<A = unknown, S = unknown>(figure: FigureTemplate<A, S>): void;
|
|
1143
|
+
export declare function getFigureClass<A = unknown, S = unknown>(name: string): Nullable<FigureConstructor<A, S>>;
|
|
1147
1144
|
export declare function registerIndicator<D>(indicator: IndicatorTemplate<D>): void;
|
|
1148
1145
|
export declare function getSupportedIndicators(): string[];
|
|
1149
1146
|
export declare function registerLocale(locale: string, ls: Locales): void;
|
|
@@ -1152,8 +1149,8 @@ export declare function registerOverlay(template: OverlayTemplate): void;
|
|
|
1152
1149
|
export declare function getOverlayClass(name: string): Nullable<OverlayConstructor>;
|
|
1153
1150
|
export declare function getSupportedOverlays(): string[];
|
|
1154
1151
|
export declare function registerStyles(name: string, ss: DeepPartial<Styles>): void;
|
|
1155
|
-
export declare function registerXAxis(axis:
|
|
1156
|
-
export declare function registerYAxis(axis:
|
|
1152
|
+
export declare function registerXAxis(axis: XAxisTemplate): void;
|
|
1153
|
+
export declare function registerYAxis(axis: YAxisTemplate): void;
|
|
1157
1154
|
/**
|
|
1158
1155
|
* Chart version
|
|
1159
1156
|
* @return {string}
|
|
@@ -1184,7 +1181,7 @@ export declare const utils: {
|
|
|
1184
1181
|
formatValue: typeof formatValue;
|
|
1185
1182
|
formatPrecision: typeof formatPrecision;
|
|
1186
1183
|
formatBigNumber: typeof formatBigNumber;
|
|
1187
|
-
formatDate: typeof
|
|
1184
|
+
formatDate: typeof formatTimestampToString;
|
|
1188
1185
|
formatThousands: typeof formatThousands;
|
|
1189
1186
|
formatFoldDecimal: typeof formatFoldDecimal;
|
|
1190
1187
|
calcTextWidth: typeof calcTextWidth;
|
|
@@ -1197,14 +1194,6 @@ export declare const utils: {
|
|
|
1197
1194
|
checkCoordinateOnPolygon: typeof checkCoordinateOnPolygon;
|
|
1198
1195
|
checkCoordinateOnRect: typeof checkCoordinateOnRect;
|
|
1199
1196
|
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
1197
|
};
|
|
1209
1198
|
|
|
1210
1199
|
export as namespace klinecharts;
|