@chartspire/chartspire-chart 10.0.0-alpha3 → 10.0.0-alpha8-chartspire.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.zh-CN.md +3 -15
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +246 -266
- package/dist/index.esm.js +3317 -2738
- package/dist/umd/klinecharts.js +3317 -2737
- package/dist/umd/klinecharts.js.map +1 -1
- package/dist/umd/klinecharts.min.js +2 -2
- package/package.json +40 -21
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,11 @@
|
|
|
12
12
|
* limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
export type Nullable<T> = T | null;
|
|
15
|
+
export interface NeighborData<D> {
|
|
16
|
+
prev: D;
|
|
17
|
+
current: D;
|
|
18
|
+
next: D;
|
|
19
|
+
}
|
|
15
20
|
export interface KLineData {
|
|
16
21
|
timestamp: number;
|
|
17
22
|
open: number;
|
|
@@ -43,10 +48,7 @@ export interface Offset {
|
|
|
43
48
|
/**
|
|
44
49
|
* line type
|
|
45
50
|
*/
|
|
46
|
-
export
|
|
47
|
-
Dashed = "dashed",
|
|
48
|
-
Solid = "solid"
|
|
49
|
-
}
|
|
51
|
+
export type LineType = "dashed" | "solid";
|
|
50
52
|
export interface LineStyle {
|
|
51
53
|
style: LineType;
|
|
52
54
|
size: number;
|
|
@@ -59,11 +61,13 @@ export interface SmoothLineStyle extends LineStyle {
|
|
|
59
61
|
export interface StateLineStyle extends LineStyle {
|
|
60
62
|
show: boolean;
|
|
61
63
|
}
|
|
62
|
-
export
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
export type PathType = "stroke" | "fill";
|
|
65
|
+
export interface PathStyle {
|
|
66
|
+
style: PathType;
|
|
67
|
+
color: string;
|
|
68
|
+
lineWidth: number;
|
|
66
69
|
}
|
|
70
|
+
export type PolygonType = PathType | "stroke_fill";
|
|
67
71
|
export interface PolygonStyle {
|
|
68
72
|
style: PolygonType;
|
|
69
73
|
color: string | CanvasGradient;
|
|
@@ -73,7 +77,7 @@ export interface PolygonStyle {
|
|
|
73
77
|
borderDashedValue: number[];
|
|
74
78
|
}
|
|
75
79
|
export interface RectStyle extends PolygonStyle {
|
|
76
|
-
borderRadius: number;
|
|
80
|
+
borderRadius: number | number[];
|
|
77
81
|
}
|
|
78
82
|
export interface TextStyle extends Padding {
|
|
79
83
|
style: PolygonType;
|
|
@@ -85,22 +89,15 @@ export interface TextStyle extends Padding {
|
|
|
85
89
|
borderDashedValue: number[];
|
|
86
90
|
borderSize: number;
|
|
87
91
|
borderColor: string;
|
|
88
|
-
borderRadius: number;
|
|
92
|
+
borderRadius: number | number[];
|
|
89
93
|
backgroundColor: string | CanvasGradient;
|
|
90
94
|
}
|
|
91
95
|
export interface StateTextStyle extends TextStyle {
|
|
92
96
|
show: boolean;
|
|
93
97
|
}
|
|
94
98
|
export type LastValueMarkTextStyle = Omit<StateTextStyle, "backgroundColor">;
|
|
95
|
-
export
|
|
96
|
-
|
|
97
|
-
FollowCross = "follow_cross",
|
|
98
|
-
None = "none"
|
|
99
|
-
}
|
|
100
|
-
export declare enum TooltipShowType {
|
|
101
|
-
Standard = "standard",
|
|
102
|
-
Rect = "rect"
|
|
103
|
-
}
|
|
99
|
+
export type TooltipShowRule = "always" | "follow_cross" | "none";
|
|
100
|
+
export type TooltipShowType = "standard" | "rect";
|
|
104
101
|
export interface ChangeColor {
|
|
105
102
|
upColor: string;
|
|
106
103
|
downColor: string;
|
|
@@ -110,12 +107,37 @@ export interface GradientColor {
|
|
|
110
107
|
offset: number;
|
|
111
108
|
color: string;
|
|
112
109
|
}
|
|
110
|
+
export type FeatureType = "path" | "icon_font";
|
|
111
|
+
export interface FeaturePathStyle extends Omit<PathStyle, "color"> {
|
|
112
|
+
path: string;
|
|
113
|
+
}
|
|
114
|
+
export interface FeatureIconFontStyle {
|
|
115
|
+
family: string;
|
|
116
|
+
code: string;
|
|
117
|
+
}
|
|
118
|
+
export interface FeatureStyle extends Padding, Margin {
|
|
119
|
+
id: string;
|
|
120
|
+
backgroundColor: string;
|
|
121
|
+
activeBackgroundColor: string;
|
|
122
|
+
size: number;
|
|
123
|
+
color: string;
|
|
124
|
+
activeColor: string;
|
|
125
|
+
borderRadius: number | number[];
|
|
126
|
+
type: FeatureType;
|
|
127
|
+
content: FeaturePathStyle | FeatureIconFontStyle;
|
|
128
|
+
}
|
|
113
129
|
export interface GridStyle {
|
|
114
130
|
show: boolean;
|
|
115
131
|
horizontal: StateLineStyle;
|
|
116
132
|
vertical: StateLineStyle;
|
|
117
133
|
}
|
|
118
134
|
export type TooltipTextStyle = Pick<TextStyle, "color" | "size" | "family" | "weight"> & Margin;
|
|
135
|
+
export type TooltipTitleStyle = TooltipTextStyle & {
|
|
136
|
+
show: boolean;
|
|
137
|
+
};
|
|
138
|
+
export type TooltipLegendStyle = TooltipTextStyle & {
|
|
139
|
+
defaultValue: string;
|
|
140
|
+
};
|
|
119
141
|
export interface TooltipLegendChild {
|
|
120
142
|
text: string;
|
|
121
143
|
color: string;
|
|
@@ -124,28 +146,14 @@ export interface TooltipLegend {
|
|
|
124
146
|
title: string | TooltipLegendChild;
|
|
125
147
|
value: string | TooltipLegendChild;
|
|
126
148
|
}
|
|
127
|
-
export
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
Right = "right"
|
|
131
|
-
}
|
|
132
|
-
export interface TooltipIconStyle extends Padding, Margin {
|
|
133
|
-
id: string;
|
|
134
|
-
position: TooltipIconPosition;
|
|
135
|
-
color: string;
|
|
136
|
-
activeColor: string;
|
|
137
|
-
size: number;
|
|
138
|
-
fontFamily: string;
|
|
139
|
-
icon: string;
|
|
140
|
-
backgroundColor: string;
|
|
141
|
-
activeBackgroundColor: string;
|
|
149
|
+
export type TooltipFeaturePosition = "left" | "middle" | "right";
|
|
150
|
+
export interface TooltipFeatureStyle extends FeatureStyle {
|
|
151
|
+
position: TooltipFeaturePosition;
|
|
142
152
|
}
|
|
143
|
-
export interface TooltipStyle {
|
|
153
|
+
export interface TooltipStyle extends Offset {
|
|
144
154
|
showRule: TooltipShowRule;
|
|
145
155
|
showType: TooltipShowType;
|
|
146
|
-
|
|
147
|
-
text: TooltipTextStyle;
|
|
148
|
-
icons: TooltipIconStyle[];
|
|
156
|
+
features: TooltipFeatureStyle[];
|
|
149
157
|
}
|
|
150
158
|
export interface CandleAreaPointStyle {
|
|
151
159
|
show: boolean;
|
|
@@ -173,10 +181,17 @@ export interface CandleHighLowPriceMarkStyle {
|
|
|
173
181
|
textWeight: string;
|
|
174
182
|
}
|
|
175
183
|
export type CandleLastPriceMarkLineStyle = Omit<StateLineStyle, "color">;
|
|
184
|
+
export type CandleLastPriceMarkExtendTextPosition = "above_price" | "below_price";
|
|
185
|
+
export type CandleLastPriceMarkExtendTextStyle = LastValueMarkTextStyle & {
|
|
186
|
+
position: CandleLastPriceMarkExtendTextPosition;
|
|
187
|
+
updateInterval: number;
|
|
188
|
+
};
|
|
176
189
|
export interface CandleLastPriceMarkStyle extends ChangeColor {
|
|
177
190
|
show: boolean;
|
|
191
|
+
compareRule: CandleColorCompareRule;
|
|
178
192
|
line: CandleLastPriceMarkLineStyle;
|
|
179
193
|
text: LastValueMarkTextStyle;
|
|
194
|
+
extendTexts: CandleLastPriceMarkExtendTextStyle[];
|
|
180
195
|
}
|
|
181
196
|
export interface CandlePriceMarkStyle {
|
|
182
197
|
show: boolean;
|
|
@@ -184,21 +199,18 @@ export interface CandlePriceMarkStyle {
|
|
|
184
199
|
low: CandleHighLowPriceMarkStyle;
|
|
185
200
|
last: CandleLastPriceMarkStyle;
|
|
186
201
|
}
|
|
187
|
-
export
|
|
188
|
-
Fixed = "fixed",
|
|
189
|
-
Pointer = "pointer"
|
|
190
|
-
}
|
|
202
|
+
export type CandleTooltipRectPosition = "fixed" | "pointer";
|
|
191
203
|
export interface CandleTooltipRectStyle extends Omit<RectStyle, "style" | "borderDashedValue" | "borderStyle">, Padding, Offset {
|
|
192
204
|
position: CandleTooltipRectPosition;
|
|
193
205
|
}
|
|
194
|
-
export
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
206
|
+
export type CandleTooltipLegendsCustomCallback = (data: NeighborData<Nullable<KLineData>>, styles: CandleStyle) => TooltipLegend[];
|
|
207
|
+
export interface CandleTooltipStyle extends TooltipStyle {
|
|
208
|
+
title: TooltipTitleStyle & {
|
|
209
|
+
template: string;
|
|
210
|
+
};
|
|
211
|
+
legend: TooltipLegendStyle & {
|
|
212
|
+
template: CandleTooltipLegendsCustomCallback | TooltipLegend[];
|
|
213
|
+
};
|
|
202
214
|
rect: CandleTooltipRectStyle;
|
|
203
215
|
}
|
|
204
216
|
export interface RenkoStyle {
|
|
@@ -206,16 +218,10 @@ export interface RenkoStyle {
|
|
|
206
218
|
size: number;
|
|
207
219
|
};
|
|
208
220
|
}
|
|
209
|
-
export
|
|
210
|
-
|
|
211
|
-
CandleSolid = "candle_solid",
|
|
212
|
-
CandleStroke = "candle_stroke",
|
|
213
|
-
CandleUpStroke = "candle_up_stroke",
|
|
214
|
-
CandleDownStroke = "candle_down_stroke",
|
|
215
|
-
Ohlc = "ohlc",
|
|
216
|
-
Area = "area"
|
|
217
|
-
}
|
|
221
|
+
export type CandleType = "candle_solid" | "candle_stroke" | "candle_up_stroke" | "candle_down_stroke" | "ohlc" | "area" | "heikin_ashi";
|
|
222
|
+
export type CandleColorCompareRule = "current_open" | "previous_close";
|
|
218
223
|
export interface CandleBarColor extends ChangeColor {
|
|
224
|
+
compareRule: CandleColorCompareRule;
|
|
219
225
|
upBorderColor: string;
|
|
220
226
|
downBorderColor: string;
|
|
221
227
|
noChangeBorderColor: string;
|
|
@@ -236,12 +242,15 @@ export interface IndicatorLastValueMarkStyle {
|
|
|
236
242
|
show: boolean;
|
|
237
243
|
text: LastValueMarkTextStyle;
|
|
238
244
|
}
|
|
239
|
-
export interface IndicatorTooltipStyle extends TooltipStyle
|
|
240
|
-
|
|
241
|
-
|
|
245
|
+
export interface IndicatorTooltipStyle extends TooltipStyle {
|
|
246
|
+
title: TooltipTitleStyle & {
|
|
247
|
+
showName: boolean;
|
|
248
|
+
showParams: boolean;
|
|
249
|
+
};
|
|
250
|
+
legend: TooltipLegendStyle;
|
|
242
251
|
}
|
|
243
252
|
export interface IndicatorStyle {
|
|
244
|
-
ohlc:
|
|
253
|
+
ohlc: Pick<CandleBarColor, "compareRule" | "upColor" | "downColor" | "noChangeColor">;
|
|
245
254
|
bars: IndicatorPolygonStyle[];
|
|
246
255
|
lines: SmoothLineStyle[];
|
|
247
256
|
circles: IndicatorPolygonStyle[];
|
|
@@ -271,7 +280,9 @@ export interface CrosshairDirectionStyle {
|
|
|
271
280
|
}
|
|
272
281
|
export interface CrosshairStyle {
|
|
273
282
|
show: boolean;
|
|
274
|
-
horizontal: CrosshairDirectionStyle
|
|
283
|
+
horizontal: CrosshairDirectionStyle & {
|
|
284
|
+
features: TooltipFeatureStyle[];
|
|
285
|
+
};
|
|
275
286
|
vertical: CrosshairDirectionStyle;
|
|
276
287
|
}
|
|
277
288
|
export interface OverlayPointStyle {
|
|
@@ -310,6 +321,7 @@ export interface Styles {
|
|
|
310
321
|
crosshair: CrosshairStyle;
|
|
311
322
|
overlay: OverlayStyle;
|
|
312
323
|
}
|
|
324
|
+
export declare function getDefaultStyles(): Styles;
|
|
313
325
|
declare function merge(target: any, source: any): void;
|
|
314
326
|
declare function clone<T>(target: T): T;
|
|
315
327
|
declare function isArray<T = unknown>(value: unknown): value is T[];
|
|
@@ -320,7 +332,7 @@ declare function isValid<T>(value: T | null | undefined): value is T;
|
|
|
320
332
|
declare function isBoolean(value: unknown): value is boolean;
|
|
321
333
|
declare function isString(value: unknown): value is string;
|
|
322
334
|
declare function formatValue(data: unknown, key: string, defaultValue?: unknown): unknown;
|
|
323
|
-
declare function
|
|
335
|
+
declare function formatTimestampByTemplate(dateTimeFormat: Intl.DateTimeFormat, timestamp: number, template: string): string;
|
|
324
336
|
declare function formatPrecision(value: string | number, precision?: number): string;
|
|
325
337
|
declare function formatBigNumber(value: string | number): string;
|
|
326
338
|
declare function formatThousands(value: string | number, sign: string): string;
|
|
@@ -340,15 +352,7 @@ declare function calcTextWidth(text: string, size?: number, weight?: string | nu
|
|
|
340
352
|
* limitations under the License.
|
|
341
353
|
*/
|
|
342
354
|
export type ActionCallback = (data?: unknown) => void;
|
|
343
|
-
export
|
|
344
|
-
OnZoom = "onZoom",
|
|
345
|
-
OnScroll = "onScroll",
|
|
346
|
-
OnVisibleRangeChange = "onVisibleRangeChange",
|
|
347
|
-
OnTooltipIconClick = "onTooltipIconClick",
|
|
348
|
-
OnCrosshairChange = "onCrosshairChange",
|
|
349
|
-
OnCandleBarClick = "onCandleBarClick",
|
|
350
|
-
OnPaneDrag = "onPaneDrag"
|
|
351
|
-
}
|
|
355
|
+
export type ActionType = "onZoom" | "onScroll" | "onVisibleRangeChange" | "onCandleTooltipFeatureClick" | "onIndicatorTooltipFeatureClick" | "onCrosshairFeatureClick" | "onCrosshairChange" | "onCandleBarClick" | "onPaneDrag";
|
|
352
356
|
/**
|
|
353
357
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
354
358
|
* you may not use this file except in compliance with the License.
|
|
@@ -458,17 +462,11 @@ export interface Crosshair extends Partial<Coordinate> {
|
|
|
458
462
|
* See the License for the specific language governing permissions and
|
|
459
463
|
* limitations under the License.
|
|
460
464
|
*/
|
|
461
|
-
export interface
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
}
|
|
467
|
-
export interface MouseTouchEvent extends Coordinate {
|
|
468
|
-
pageX: number;
|
|
469
|
-
pageY: number;
|
|
470
|
-
isTouch?: boolean;
|
|
471
|
-
preventDefault?: () => void;
|
|
465
|
+
export interface SymbolInfo {
|
|
466
|
+
ticker: string;
|
|
467
|
+
pricePrecision: number;
|
|
468
|
+
volumePrecision: number;
|
|
469
|
+
[key: string]: unknown;
|
|
472
470
|
}
|
|
473
471
|
/**
|
|
474
472
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -483,27 +481,59 @@ export interface MouseTouchEvent extends Coordinate {
|
|
|
483
481
|
* See the License for the specific language governing permissions and
|
|
484
482
|
* limitations under the License.
|
|
485
483
|
*/
|
|
486
|
-
export
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
484
|
+
export type PeriodType = "second" | "minute" | "hour" | "day" | "week" | "month" | "year";
|
|
485
|
+
export interface Period {
|
|
486
|
+
type: PeriodType;
|
|
487
|
+
span: number;
|
|
488
|
+
}
|
|
489
|
+
export type DataLoadType = "init" | "forward" | "backward" | "update";
|
|
490
|
+
export type DataLoadMore = boolean | {
|
|
491
|
+
backward: boolean;
|
|
492
|
+
forward: boolean;
|
|
493
|
+
};
|
|
494
|
+
export interface DataLoaderGetBarsParams {
|
|
495
|
+
type: DataLoadType;
|
|
496
|
+
timestamp: Nullable<number>;
|
|
497
|
+
symbol: SymbolInfo;
|
|
498
|
+
period: Period;
|
|
499
|
+
callback: (data: KLineData[], more?: DataLoadMore) => void;
|
|
500
|
+
}
|
|
501
|
+
export interface DataLoaderSubscribeBarParams {
|
|
502
|
+
symbol: SymbolInfo;
|
|
503
|
+
period: Period;
|
|
504
|
+
callback: (data: KLineData) => void;
|
|
505
|
+
}
|
|
506
|
+
export type DataLoaderUnsubscribeBarParams = Omit<DataLoaderSubscribeBarParams, "callback">;
|
|
507
|
+
export interface DataLoader {
|
|
508
|
+
getBars: (params: DataLoaderGetBarsParams) => void | Promise<void>;
|
|
509
|
+
subscribeBar?: (params: DataLoaderSubscribeBarParams) => void;
|
|
510
|
+
unsubscribeBar?: (params: DataLoaderUnsubscribeBarParams) => void;
|
|
496
511
|
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
512
|
+
/**
|
|
513
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
514
|
+
* you may not use this file except in compliance with the License.
|
|
515
|
+
* You may obtain a copy of the License at
|
|
516
|
+
|
|
517
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
518
|
+
|
|
519
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
520
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
521
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
522
|
+
* See the License for the specific language governing permissions and
|
|
523
|
+
* limitations under the License.
|
|
524
|
+
*/
|
|
525
|
+
export interface VisibleRange {
|
|
526
|
+
readonly from: number;
|
|
527
|
+
readonly to: number;
|
|
528
|
+
readonly realFrom: number;
|
|
529
|
+
readonly realTo: number;
|
|
501
530
|
}
|
|
502
|
-
export interface
|
|
503
|
-
|
|
504
|
-
|
|
531
|
+
export interface MouseTouchEvent extends Coordinate {
|
|
532
|
+
pageX: number;
|
|
533
|
+
pageY: number;
|
|
534
|
+
isTouch?: boolean;
|
|
535
|
+
preventDefault?: () => void;
|
|
505
536
|
}
|
|
506
|
-
export type LoadDataCallback = (params: LoadDataParams) => void;
|
|
507
537
|
/**
|
|
508
538
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
509
539
|
* you may not use this file except in compliance with the License.
|
|
@@ -517,15 +547,12 @@ export type LoadDataCallback = (params: LoadDataParams) => void;
|
|
|
517
547
|
* See the License for the specific language governing permissions and
|
|
518
548
|
* limitations under the License.
|
|
519
549
|
*/
|
|
520
|
-
export interface
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
export declare const enum PaneState {
|
|
525
|
-
Normal = "normal",
|
|
526
|
-
Maximize = "maximize",
|
|
527
|
-
Minimize = "minimize"
|
|
550
|
+
export interface Point {
|
|
551
|
+
dataIndex: number;
|
|
552
|
+
timestamp: number;
|
|
553
|
+
value: number;
|
|
528
554
|
}
|
|
555
|
+
export type PaneState = "normal" | "maximize" | "minimize";
|
|
529
556
|
export interface PaneOptions {
|
|
530
557
|
id?: string;
|
|
531
558
|
height?: number;
|
|
@@ -535,16 +562,26 @@ export interface PaneOptions {
|
|
|
535
562
|
state?: PaneState;
|
|
536
563
|
axis?: Partial<AxisCreate>;
|
|
537
564
|
}
|
|
538
|
-
export
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
565
|
+
export type FormatDateType = "tooltip" | "crosshair" | "xAxis";
|
|
566
|
+
export interface FormatDateParams {
|
|
567
|
+
dateTimeFormat: Intl.DateTimeFormat;
|
|
568
|
+
timestamp: number;
|
|
569
|
+
template: string;
|
|
570
|
+
type: FormatDateType;
|
|
542
571
|
}
|
|
543
|
-
export type FormatDate = (
|
|
572
|
+
export type FormatDate = (params: FormatDateParams) => string;
|
|
544
573
|
export type FormatBigNumber = (value: string | number) => string;
|
|
545
|
-
export
|
|
574
|
+
export type ExtendTextType = "last_price";
|
|
575
|
+
export interface FormatExtendTextParams {
|
|
576
|
+
type: ExtendTextType;
|
|
577
|
+
data: KLineData;
|
|
578
|
+
index: number;
|
|
579
|
+
}
|
|
580
|
+
export type FormatExtendText = (params: FormatExtendTextParams) => string;
|
|
581
|
+
export interface Formatter {
|
|
546
582
|
formatDate: FormatDate;
|
|
547
583
|
formatBigNumber: FormatBigNumber;
|
|
584
|
+
formatExtendText: FormatExtendText;
|
|
548
585
|
}
|
|
549
586
|
export interface Locales {
|
|
550
587
|
time: string;
|
|
@@ -555,13 +592,16 @@ export interface Locales {
|
|
|
555
592
|
volume: string;
|
|
556
593
|
change: string;
|
|
557
594
|
turnover: string;
|
|
595
|
+
second: string;
|
|
596
|
+
minute: string;
|
|
597
|
+
hour: string;
|
|
598
|
+
day: string;
|
|
599
|
+
week: string;
|
|
600
|
+
month: string;
|
|
601
|
+
year: string;
|
|
558
602
|
[key: string]: string;
|
|
559
603
|
}
|
|
560
|
-
export
|
|
561
|
-
Candle = "candle",
|
|
562
|
-
Indicator = "indicator",
|
|
563
|
-
XAxis = "xAxis"
|
|
564
|
-
}
|
|
604
|
+
export type LayoutChildType = "candle" | "indicator" | "xAxis";
|
|
565
605
|
export interface LayoutChild {
|
|
566
606
|
type: LayoutChildType;
|
|
567
607
|
content?: Array<string | IndicatorCreate>;
|
|
@@ -579,7 +619,7 @@ export interface Options {
|
|
|
579
619
|
locale?: string;
|
|
580
620
|
timezone?: string;
|
|
581
621
|
styles?: string | DeepPartial<Styles>;
|
|
582
|
-
|
|
622
|
+
formatter?: Partial<Formatter>;
|
|
583
623
|
thousandsSeparator?: Partial<ThousandsSeparator>;
|
|
584
624
|
decimalFold?: Partial<DecimalFold>;
|
|
585
625
|
layout?: LayoutChild[];
|
|
@@ -590,11 +630,7 @@ export interface YAxis extends Axis, Required<YAxisTemplate> {
|
|
|
590
630
|
isInCandle: () => boolean;
|
|
591
631
|
convertToNicePixel: (value: number) => number;
|
|
592
632
|
}
|
|
593
|
-
export
|
|
594
|
-
Normal = "normal",
|
|
595
|
-
WeakMagnet = "weak_magnet",
|
|
596
|
-
StrongMagnet = "strong_magnet"
|
|
597
|
-
}
|
|
633
|
+
export type OverlayMode = "normal" | "weak_magnet" | "strong_magnet";
|
|
598
634
|
export interface OverlayPerformEventParams {
|
|
599
635
|
currentStep: number;
|
|
600
636
|
mode: OverlayMode;
|
|
@@ -602,31 +638,46 @@ export interface OverlayPerformEventParams {
|
|
|
602
638
|
performPointIndex: number;
|
|
603
639
|
performPoint: Partial<Point>;
|
|
604
640
|
}
|
|
605
|
-
export
|
|
641
|
+
export interface OverlayEventCollection<E> {
|
|
642
|
+
onDrawStart: Nullable<OverlayEventCallback<E>>;
|
|
643
|
+
onDrawing: Nullable<OverlayEventCallback<E>>;
|
|
644
|
+
onDrawEnd: Nullable<OverlayEventCallback<E>>;
|
|
645
|
+
onRemoved: Nullable<OverlayEventCallback<E>>;
|
|
646
|
+
onClick: Nullable<OverlayEventCallback<E>>;
|
|
647
|
+
onDoubleClick: Nullable<OverlayEventCallback<E>>;
|
|
648
|
+
onRightClick: Nullable<OverlayEventCallback<E>>;
|
|
649
|
+
onPressedMoveStart: Nullable<OverlayEventCallback<E>>;
|
|
650
|
+
onPressedMoving: Nullable<OverlayEventCallback<E>>;
|
|
651
|
+
onPressedMoveEnd: Nullable<OverlayEventCallback<E>>;
|
|
652
|
+
onMouseMove: Nullable<OverlayEventCallback<E>>;
|
|
653
|
+
onMouseEnter: Nullable<OverlayEventCallback<E>>;
|
|
654
|
+
onMouseLeave: Nullable<OverlayEventCallback<E>>;
|
|
655
|
+
onSelected: Nullable<OverlayEventCallback<E>>;
|
|
656
|
+
onDeselected: Nullable<OverlayEventCallback<E>>;
|
|
657
|
+
}
|
|
606
658
|
export interface OverlayFigure {
|
|
607
659
|
key?: string;
|
|
608
660
|
type: string;
|
|
609
661
|
attrs: unknown;
|
|
610
662
|
styles?: unknown;
|
|
611
|
-
ignoreEvent?: boolean |
|
|
663
|
+
ignoreEvent?: boolean | Array<keyof Omit<OverlayEventCollection<unknown>, "onDrawStart" | "onDrawing" | "onDrawEnd" | "onRemoved">>;
|
|
612
664
|
}
|
|
613
|
-
export interface OverlayCreateFiguresCallbackParams {
|
|
665
|
+
export interface OverlayCreateFiguresCallbackParams<E> {
|
|
614
666
|
chart: Chart;
|
|
615
|
-
overlay: Overlay
|
|
667
|
+
overlay: Overlay<E>;
|
|
616
668
|
coordinates: Coordinate[];
|
|
617
669
|
bounding: Bounding;
|
|
618
670
|
xAxis: Nullable<XAxis>;
|
|
619
671
|
yAxis: Nullable<YAxis>;
|
|
620
672
|
}
|
|
621
|
-
export interface OverlayEvent extends Partial<MouseTouchEvent> {
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
overlay: Overlay;
|
|
673
|
+
export interface OverlayEvent<E> extends Partial<MouseTouchEvent> {
|
|
674
|
+
figure?: OverlayFigure;
|
|
675
|
+
overlay: Overlay<E>;
|
|
625
676
|
chart: Chart;
|
|
626
677
|
}
|
|
627
|
-
export type OverlayEventCallback = (event: OverlayEvent) =>
|
|
628
|
-
export type OverlayCreateFiguresCallback = (params: OverlayCreateFiguresCallbackParams) => OverlayFigure | OverlayFigure[];
|
|
629
|
-
export interface Overlay {
|
|
678
|
+
export type OverlayEventCallback<E> = (event: OverlayEvent<E>) => void;
|
|
679
|
+
export type OverlayCreateFiguresCallback<E> = (params: OverlayCreateFiguresCallbackParams<E>) => OverlayFigure | OverlayFigure[];
|
|
680
|
+
export interface Overlay<E = unknown> extends OverlayEventCollection<E> {
|
|
630
681
|
/**
|
|
631
682
|
* Unique identification
|
|
632
683
|
*/
|
|
@@ -690,7 +741,7 @@ export interface Overlay {
|
|
|
690
741
|
/**
|
|
691
742
|
* Extended Data
|
|
692
743
|
*/
|
|
693
|
-
extendData:
|
|
744
|
+
extendData: E;
|
|
694
745
|
/**
|
|
695
746
|
* The style information and format are consistent with the overlay in the unified configuration
|
|
696
747
|
*/
|
|
@@ -698,15 +749,15 @@ export interface Overlay {
|
|
|
698
749
|
/**
|
|
699
750
|
* Create figures corresponding to points
|
|
700
751
|
*/
|
|
701
|
-
createPointFigures: Nullable<OverlayCreateFiguresCallback
|
|
752
|
+
createPointFigures: Nullable<OverlayCreateFiguresCallback<E>>;
|
|
702
753
|
/**
|
|
703
754
|
* Create figures on the Y axis
|
|
704
755
|
*/
|
|
705
|
-
createXAxisFigures: Nullable<OverlayCreateFiguresCallback
|
|
756
|
+
createXAxisFigures: Nullable<OverlayCreateFiguresCallback<E>>;
|
|
706
757
|
/**
|
|
707
758
|
* Create figures on the X axis
|
|
708
759
|
*/
|
|
709
|
-
createYAxisFigures: Nullable<OverlayCreateFiguresCallback
|
|
760
|
+
createYAxisFigures: Nullable<OverlayCreateFiguresCallback<E>>;
|
|
710
761
|
/**
|
|
711
762
|
* Special handling callbacks when pressing events
|
|
712
763
|
*/
|
|
@@ -715,72 +766,16 @@ export interface Overlay {
|
|
|
715
766
|
* In drawing, special handling callback when moving events
|
|
716
767
|
*/
|
|
717
768
|
performEventMoveForDrawing: Nullable<(params: OverlayPerformEventParams) => void>;
|
|
718
|
-
/**
|
|
719
|
-
* Start drawing event
|
|
720
|
-
*/
|
|
721
|
-
onDrawStart: Nullable<OverlayEventCallback>;
|
|
722
|
-
/**
|
|
723
|
-
* In drawing event
|
|
724
|
-
*/
|
|
725
|
-
onDrawing: Nullable<OverlayEventCallback>;
|
|
726
|
-
/**
|
|
727
|
-
* Draw End Event
|
|
728
|
-
*/
|
|
729
|
-
onDrawEnd: Nullable<OverlayEventCallback>;
|
|
730
|
-
/**
|
|
731
|
-
* Click event
|
|
732
|
-
*/
|
|
733
|
-
onClick: Nullable<OverlayEventCallback>;
|
|
734
|
-
/**
|
|
735
|
-
* Double Click event
|
|
736
|
-
*/
|
|
737
|
-
onDoubleClick: Nullable<OverlayEventCallback>;
|
|
738
|
-
/**
|
|
739
|
-
* Right click event
|
|
740
|
-
*/
|
|
741
|
-
onRightClick: Nullable<OverlayEventCallback>;
|
|
742
|
-
/**
|
|
743
|
-
* Pressed move start event
|
|
744
|
-
*/
|
|
745
|
-
onPressedMoveStart: Nullable<OverlayEventCallback>;
|
|
746
|
-
/**
|
|
747
|
-
* Pressed moving event
|
|
748
|
-
*/
|
|
749
|
-
onPressedMoving: Nullable<OverlayEventCallback>;
|
|
750
|
-
/**
|
|
751
|
-
* Pressed move end event
|
|
752
|
-
*/
|
|
753
|
-
onPressedMoveEnd: Nullable<OverlayEventCallback>;
|
|
754
|
-
/**
|
|
755
|
-
* Mouse enter event
|
|
756
|
-
*/
|
|
757
|
-
onMouseEnter: Nullable<OverlayEventCallback>;
|
|
758
|
-
/**
|
|
759
|
-
* Mouse leave event
|
|
760
|
-
*/
|
|
761
|
-
onMouseLeave: Nullable<OverlayEventCallback>;
|
|
762
|
-
/**
|
|
763
|
-
* Removed event
|
|
764
|
-
*/
|
|
765
|
-
onRemoved: Nullable<OverlayEventCallback>;
|
|
766
|
-
/**
|
|
767
|
-
* Selected event
|
|
768
|
-
*/
|
|
769
|
-
onSelected: Nullable<OverlayEventCallback>;
|
|
770
|
-
/**
|
|
771
|
-
* Deselected event
|
|
772
|
-
*/
|
|
773
|
-
onDeselected: Nullable<OverlayEventCallback>;
|
|
774
769
|
}
|
|
775
|
-
export type OverlayTemplate = ExcludePickPartial<Omit<Overlay
|
|
776
|
-
export type OverlayCreate = ExcludePickPartial<Omit<Overlay
|
|
777
|
-
export type OverlayFilter = Partial<Pick<Overlay
|
|
778
|
-
export type OverlayConstructor = new () => Overlay
|
|
770
|
+
export type OverlayTemplate<E = unknown> = ExcludePickPartial<Omit<Overlay<E>, "id" | "groupId" | "paneId" | "points" | "currentStep">, "name">;
|
|
771
|
+
export type OverlayCreate<E = unknown> = ExcludePickPartial<Omit<Overlay<E>, "currentStep" | "totalStep" | "createPointFigures" | "createXAxisFigures" | "createYAxisFigures" | "performEventPressedMove" | "performEventMoveForDrawing">, "name">;
|
|
772
|
+
export type OverlayFilter<E = unknown> = Partial<Pick<Overlay<E>, "id" | "groupId" | "name" | "paneId">>;
|
|
773
|
+
export type OverlayConstructor<E = unknown> = new () => Overlay<E>;
|
|
779
774
|
export interface Store {
|
|
780
775
|
setStyles: (value: string | DeepPartial<Styles>) => void;
|
|
781
776
|
getStyles: () => Styles;
|
|
782
|
-
|
|
783
|
-
|
|
777
|
+
setFormatter: (formatter: Partial<Formatter>) => void;
|
|
778
|
+
getFormatter: () => Formatter;
|
|
784
779
|
setLocale: (locale: string) => void;
|
|
785
780
|
getLocale: () => string;
|
|
786
781
|
setTimezone: (timezone: string) => void;
|
|
@@ -789,8 +784,10 @@ export interface Store {
|
|
|
789
784
|
getThousandsSeparator: () => ThousandsSeparator;
|
|
790
785
|
setDecimalFold: (decimalFold: Partial<DecimalFold>) => void;
|
|
791
786
|
getDecimalFold: () => DecimalFold;
|
|
792
|
-
|
|
793
|
-
|
|
787
|
+
setSymbol: (symbol: SymbolInfo) => void;
|
|
788
|
+
getSymbol: () => Nullable<SymbolInfo>;
|
|
789
|
+
setPeriod: (period: Period) => void;
|
|
790
|
+
getPeriod: () => Nullable<Period>;
|
|
794
791
|
getDataList: () => KLineData[];
|
|
795
792
|
setOffsetRightDistance: (distance: number) => void;
|
|
796
793
|
getOffsetRightDistance: () => number;
|
|
@@ -801,8 +798,8 @@ export interface Store {
|
|
|
801
798
|
setBarSpace: (space: number) => void;
|
|
802
799
|
getBarSpace: () => BarSpace;
|
|
803
800
|
getVisibleRange: () => VisibleRange;
|
|
804
|
-
|
|
805
|
-
overrideIndicator: (override: IndicatorCreate
|
|
801
|
+
setDataLoader: (dataLoader: DataLoader) => void;
|
|
802
|
+
overrideIndicator: (override: IndicatorCreate) => boolean;
|
|
806
803
|
removeIndicator: (filter?: IndicatorFilter) => boolean;
|
|
807
804
|
overrideOverlay: (override: Partial<OverlayCreate>) => boolean;
|
|
808
805
|
removeOverlay: (filter?: OverlayFilter) => boolean;
|
|
@@ -810,13 +807,9 @@ export interface Store {
|
|
|
810
807
|
isZoomEnabled: () => boolean;
|
|
811
808
|
setScrollEnabled: (enabled: boolean) => void;
|
|
812
809
|
isScrollEnabled: () => boolean;
|
|
813
|
-
|
|
814
|
-
}
|
|
815
|
-
export declare enum DomPosition {
|
|
816
|
-
Root = "root",
|
|
817
|
-
Main = "main",
|
|
818
|
-
YAxis = "yAxis"
|
|
810
|
+
resetData: () => void;
|
|
819
811
|
}
|
|
812
|
+
export type DomPosition = "root" | "main" | "yAxis";
|
|
820
813
|
export interface ConvertFilter {
|
|
821
814
|
paneId?: string;
|
|
822
815
|
absolute?: boolean;
|
|
@@ -825,12 +818,10 @@ export interface Chart extends Store {
|
|
|
825
818
|
id: string;
|
|
826
819
|
getDom: (paneId?: string, position?: DomPosition) => Nullable<HTMLElement>;
|
|
827
820
|
getSize: (paneId?: string, position?: DomPosition) => Nullable<Bounding>;
|
|
828
|
-
applyNewData: (dataList: KLineData[], more?: boolean | Partial<LoadDataMore>) => void;
|
|
829
|
-
updateData: (data: KLineData) => void;
|
|
830
821
|
createIndicator: (value: string | IndicatorCreate, isStack?: boolean, paneOptions?: PaneOptions) => Nullable<string>;
|
|
831
|
-
getIndicators: (filter?: IndicatorFilter) =>
|
|
822
|
+
getIndicators: (filter?: IndicatorFilter) => Indicator[];
|
|
832
823
|
createOverlay: (value: string | OverlayCreate | Array<string | OverlayCreate>) => Nullable<string> | Array<Nullable<string>>;
|
|
833
|
-
getOverlays: (filter?: OverlayFilter) =>
|
|
824
|
+
getOverlays: (filter?: OverlayFilter) => Overlay[];
|
|
834
825
|
setPaneOptions: (options: PaneOptions) => void;
|
|
835
826
|
getPaneOptions: (id?: string) => Nullable<PaneOptions> | PaneOptions[];
|
|
836
827
|
scrollByDistance: (distance: number, animationDuration?: number) => void;
|
|
@@ -864,10 +855,7 @@ export interface AxisGap {
|
|
|
864
855
|
top?: number;
|
|
865
856
|
bottom?: number;
|
|
866
857
|
}
|
|
867
|
-
|
|
868
|
-
Left = "left",
|
|
869
|
-
Right = "right"
|
|
870
|
-
}
|
|
858
|
+
export type AxisPosition = "left" | "right";
|
|
871
859
|
export interface AxisValueToValueParams {
|
|
872
860
|
range: AxisRange;
|
|
873
861
|
}
|
|
@@ -955,23 +943,14 @@ export interface TextAttrs {
|
|
|
955
943
|
align?: CanvasTextAlign;
|
|
956
944
|
baseline?: CanvasTextBaseline;
|
|
957
945
|
}
|
|
958
|
-
export
|
|
959
|
-
Normal = "normal",
|
|
960
|
-
Price = "price",
|
|
961
|
-
Volume = "volume"
|
|
962
|
-
}
|
|
946
|
+
export type IndicatorSeries = "normal" | "price" | "volume";
|
|
963
947
|
export type IndicatorFigureStyle = Partial<Omit<SmoothLineStyle, "style">> & Partial<Omit<RectStyle, "style">> & Partial<TextStyle> & Partial<{
|
|
964
948
|
style: LineType[keyof LineType];
|
|
965
949
|
}> & Record<string, unknown>;
|
|
966
950
|
export type IndicatorFigureAttrs = Partial<ArcAttrs> & Partial<LineStyle> & Partial<RectAttrs> & Partial<TextAttrs> & Record<string, unknown>;
|
|
967
|
-
export interface IndicatorFigureCallbackBrother<PCN> {
|
|
968
|
-
prev: PCN;
|
|
969
|
-
current: PCN;
|
|
970
|
-
next: PCN;
|
|
971
|
-
}
|
|
972
951
|
export interface IndicatorFigureAttrsCallbackParams<D> {
|
|
973
|
-
data:
|
|
974
|
-
coordinate:
|
|
952
|
+
data: NeighborData<Nullable<D>>;
|
|
953
|
+
coordinate: NeighborData<Record<keyof D, number> & {
|
|
975
954
|
x: number;
|
|
976
955
|
}>;
|
|
977
956
|
bounding: Bounding;
|
|
@@ -980,7 +959,7 @@ export interface IndicatorFigureAttrsCallbackParams<D> {
|
|
|
980
959
|
yAxis: YAxis;
|
|
981
960
|
}
|
|
982
961
|
export interface IndicatorFigureStylesCallbackParams<D> {
|
|
983
|
-
data:
|
|
962
|
+
data: NeighborData<Nullable<D>>;
|
|
984
963
|
indicator: Indicator<D>;
|
|
985
964
|
defaultStyles?: IndicatorStyle;
|
|
986
965
|
}
|
|
@@ -994,11 +973,11 @@ export interface IndicatorFigure<D = unknown> {
|
|
|
994
973
|
attrs?: IndicatorFigureAttrsCallback<D>;
|
|
995
974
|
styles?: IndicatorFigureStylesCallback<D>;
|
|
996
975
|
}
|
|
997
|
-
export type IndicatorRegenerateFiguresCallback<D> = (calcParams:
|
|
976
|
+
export type IndicatorRegenerateFiguresCallback<D, C> = (calcParams: C[]) => Array<IndicatorFigure<D>>;
|
|
998
977
|
export interface IndicatorTooltipData {
|
|
999
978
|
name: string;
|
|
1000
979
|
calcParamsText: string;
|
|
1001
|
-
|
|
980
|
+
features: TooltipFeatureStyle[];
|
|
1002
981
|
legends: TooltipLegend[];
|
|
1003
982
|
}
|
|
1004
983
|
export interface IndicatorCreateTooltipDataSourceParams<D> {
|
|
@@ -1010,32 +989,36 @@ export interface IndicatorCreateTooltipDataSourceParams<D> {
|
|
|
1010
989
|
yAxis: YAxis;
|
|
1011
990
|
}
|
|
1012
991
|
export type IndicatorCreateTooltipDataSourceCallback<D> = (params: IndicatorCreateTooltipDataSourceParams<D>) => IndicatorTooltipData;
|
|
1013
|
-
export interface IndicatorDrawParams<D> {
|
|
992
|
+
export interface IndicatorDrawParams<D, C, E> {
|
|
1014
993
|
ctx: CanvasRenderingContext2D;
|
|
1015
994
|
chart: Chart;
|
|
1016
|
-
indicator: Indicator<D>;
|
|
995
|
+
indicator: Indicator<D, C, E>;
|
|
1017
996
|
bounding: Bounding;
|
|
1018
997
|
xAxis: XAxis;
|
|
1019
998
|
yAxis: YAxis;
|
|
1020
999
|
}
|
|
1021
|
-
export type IndicatorDrawCallback<D> = (params: IndicatorDrawParams<D>) => boolean;
|
|
1022
|
-
export type IndicatorCalcCallback<D> = (dataList: KLineData[], indicator: Indicator<D>) => Promise<D
|
|
1023
|
-
export type IndicatorShouldUpdateCallback<D> = (prev: Indicator<D>, current: Indicator<D>) => (boolean | {
|
|
1000
|
+
export type IndicatorDrawCallback<D, C, E> = (params: IndicatorDrawParams<D, C, E>) => boolean;
|
|
1001
|
+
export type IndicatorCalcCallback<D, C, E> = (dataList: KLineData[], indicator: Indicator<D, C, E>) => Promise<Record<number, D>> | Record<number, D>;
|
|
1002
|
+
export type IndicatorShouldUpdateCallback<D, C, E> = (prev: Indicator<D, C, E>, current: Indicator<D, C, E>) => (boolean | {
|
|
1024
1003
|
calc: boolean;
|
|
1025
1004
|
draw: boolean;
|
|
1026
1005
|
});
|
|
1027
|
-
|
|
1028
|
-
Loading = "loading",
|
|
1029
|
-
Error = "error",
|
|
1030
|
-
Ready = "ready"
|
|
1031
|
-
}
|
|
1006
|
+
export type IndicatorDataState = "loading" | "error" | "ready";
|
|
1032
1007
|
export interface IndicatorOnDataStateChangeParams<D> {
|
|
1033
1008
|
state: IndicatorDataState;
|
|
1034
|
-
type:
|
|
1009
|
+
type: DataLoadType;
|
|
1035
1010
|
indicator: Indicator<D>;
|
|
1036
1011
|
}
|
|
1037
1012
|
export type IndicatorOnDataStateChangeCallback<D> = (params: IndicatorOnDataStateChangeParams<D>) => void;
|
|
1038
|
-
export interface Indicator<D = unknown> {
|
|
1013
|
+
export interface Indicator<D = unknown, C = unknown, E = unknown> {
|
|
1014
|
+
/**
|
|
1015
|
+
* Unique id
|
|
1016
|
+
*/
|
|
1017
|
+
id: string;
|
|
1018
|
+
/**
|
|
1019
|
+
* Pane id
|
|
1020
|
+
*/
|
|
1021
|
+
paneId: string;
|
|
1039
1022
|
/**
|
|
1040
1023
|
* Indicator name
|
|
1041
1024
|
*/
|
|
@@ -1051,7 +1034,7 @@ export interface Indicator<D = unknown> {
|
|
|
1051
1034
|
/**
|
|
1052
1035
|
* Calculation parameters
|
|
1053
1036
|
*/
|
|
1054
|
-
calcParams:
|
|
1037
|
+
calcParams: C[];
|
|
1055
1038
|
/**
|
|
1056
1039
|
* Whether ohlc column is required
|
|
1057
1040
|
*/
|
|
@@ -1071,7 +1054,7 @@ export interface Indicator<D = unknown> {
|
|
|
1071
1054
|
/**
|
|
1072
1055
|
* Extend data
|
|
1073
1056
|
*/
|
|
1074
|
-
extendData:
|
|
1057
|
+
extendData: E;
|
|
1075
1058
|
/**
|
|
1076
1059
|
* Indicator series
|
|
1077
1060
|
*/
|
|
@@ -1095,15 +1078,15 @@ export interface Indicator<D = unknown> {
|
|
|
1095
1078
|
/**
|
|
1096
1079
|
* Should update, should calc or draw
|
|
1097
1080
|
*/
|
|
1098
|
-
shouldUpdate: Nullable<IndicatorShouldUpdateCallback<D>>;
|
|
1081
|
+
shouldUpdate: Nullable<IndicatorShouldUpdateCallback<D, C, E>>;
|
|
1099
1082
|
/**
|
|
1100
1083
|
* Indicator calculation
|
|
1101
1084
|
*/
|
|
1102
|
-
calc: IndicatorCalcCallback<D>;
|
|
1085
|
+
calc: IndicatorCalcCallback<D, C, E>;
|
|
1103
1086
|
/**
|
|
1104
1087
|
* Regenerate figure configuration
|
|
1105
1088
|
*/
|
|
1106
|
-
regenerateFigures: Nullable<IndicatorRegenerateFiguresCallback<D>>;
|
|
1089
|
+
regenerateFigures: Nullable<IndicatorRegenerateFiguresCallback<D, C>>;
|
|
1107
1090
|
/**
|
|
1108
1091
|
* Create custom tooltip text
|
|
1109
1092
|
*/
|
|
@@ -1111,7 +1094,7 @@ export interface Indicator<D = unknown> {
|
|
|
1111
1094
|
/**
|
|
1112
1095
|
* Custom draw
|
|
1113
1096
|
*/
|
|
1114
|
-
draw: Nullable<IndicatorDrawCallback<D>>;
|
|
1097
|
+
draw: Nullable<IndicatorDrawCallback<D, C, E>>;
|
|
1115
1098
|
/**
|
|
1116
1099
|
* Data state change
|
|
1117
1100
|
*/
|
|
@@ -1119,14 +1102,11 @@ export interface Indicator<D = unknown> {
|
|
|
1119
1102
|
/**
|
|
1120
1103
|
* Calculation result
|
|
1121
1104
|
*/
|
|
1122
|
-
result: D
|
|
1123
|
-
}
|
|
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;
|
|
1105
|
+
result: Record<number, D>;
|
|
1129
1106
|
}
|
|
1107
|
+
export type IndicatorTemplate<D = unknown, C = unknown, E = unknown> = ExcludePickPartial<Omit<Indicator<D, C, E>, "result" | "paneId">, "name" | "calc">;
|
|
1108
|
+
export type IndicatorCreate<D = unknown, C = unknown, E = unknown> = ExcludePickPartial<Omit<Indicator<D, C, E>, "result">, "name">;
|
|
1109
|
+
export type IndicatorFilter = Partial<Pick<Indicator, "id" | "paneId" | "name">>;
|
|
1130
1110
|
declare function checkCoordinateOnLine(coordinate: Coordinate, attrs: LineAttrs | LineAttrs[]): boolean;
|
|
1131
1111
|
declare function getLinearYFromSlopeIntercept(kb: Nullable<number[]>, coordinate: Coordinate): number;
|
|
1132
1112
|
declare function getLinearYFromCoordinates(coordinate1: Coordinate, coordinate2: Coordinate, targetCoordinate: Coordinate): number;
|
|
@@ -1141,11 +1121,11 @@ export interface PolygonAttrs {
|
|
|
1141
1121
|
export declare function getSupportedFigures(): string[];
|
|
1142
1122
|
export declare function registerFigure<A = unknown, S = unknown>(figure: FigureTemplate<A, S>): void;
|
|
1143
1123
|
export declare function getFigureClass<A = unknown, S = unknown>(name: string): Nullable<FigureConstructor<A, S>>;
|
|
1144
|
-
export declare function registerIndicator<D>(indicator: IndicatorTemplate<D>): void;
|
|
1124
|
+
export declare function registerIndicator<D = unknown, C = unknown, E = unknown>(indicator: IndicatorTemplate<D, C, E>): void;
|
|
1145
1125
|
export declare function getSupportedIndicators(): string[];
|
|
1146
1126
|
export declare function registerLocale(locale: string, ls: Locales): void;
|
|
1147
1127
|
export declare function getSupportedLocales(): string[];
|
|
1148
|
-
export declare function registerOverlay(template: OverlayTemplate): void;
|
|
1128
|
+
export declare function registerOverlay<E = unknown>(template: OverlayTemplate<E>): void;
|
|
1149
1129
|
export declare function getOverlayClass(name: string): Nullable<OverlayConstructor>;
|
|
1150
1130
|
export declare function getSupportedOverlays(): string[];
|
|
1151
1131
|
export declare function registerStyles(name: string, ss: DeepPartial<Styles>): void;
|
|
@@ -1181,7 +1161,7 @@ export declare const utils: {
|
|
|
1181
1161
|
formatValue: typeof formatValue;
|
|
1182
1162
|
formatPrecision: typeof formatPrecision;
|
|
1183
1163
|
formatBigNumber: typeof formatBigNumber;
|
|
1184
|
-
formatDate: typeof
|
|
1164
|
+
formatDate: typeof formatTimestampByTemplate;
|
|
1185
1165
|
formatThousands: typeof formatThousands;
|
|
1186
1166
|
formatFoldDecimal: typeof formatFoldDecimal;
|
|
1187
1167
|
calcTextWidth: typeof calcTextWidth;
|