@chartspire/chartspire-chart 10.0.0-alpha4 → 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 +245 -266
- package/dist/index.esm.js +3317 -2738
- package/dist/umd/klinecharts.js +3316 -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 {
|
|
@@ -321,7 +332,7 @@ declare function isValid<T>(value: T | null | undefined): value is T;
|
|
|
321
332
|
declare function isBoolean(value: unknown): value is boolean;
|
|
322
333
|
declare function isString(value: unknown): value is string;
|
|
323
334
|
declare function formatValue(data: unknown, key: string, defaultValue?: unknown): unknown;
|
|
324
|
-
declare function
|
|
335
|
+
declare function formatTimestampByTemplate(dateTimeFormat: Intl.DateTimeFormat, timestamp: number, template: string): string;
|
|
325
336
|
declare function formatPrecision(value: string | number, precision?: number): string;
|
|
326
337
|
declare function formatBigNumber(value: string | number): string;
|
|
327
338
|
declare function formatThousands(value: string | number, sign: string): string;
|
|
@@ -341,15 +352,7 @@ declare function calcTextWidth(text: string, size?: number, weight?: string | nu
|
|
|
341
352
|
* limitations under the License.
|
|
342
353
|
*/
|
|
343
354
|
export type ActionCallback = (data?: unknown) => void;
|
|
344
|
-
export
|
|
345
|
-
OnZoom = "onZoom",
|
|
346
|
-
OnScroll = "onScroll",
|
|
347
|
-
OnVisibleRangeChange = "onVisibleRangeChange",
|
|
348
|
-
OnTooltipIconClick = "onTooltipIconClick",
|
|
349
|
-
OnCrosshairChange = "onCrosshairChange",
|
|
350
|
-
OnCandleBarClick = "onCandleBarClick",
|
|
351
|
-
OnPaneDrag = "onPaneDrag"
|
|
352
|
-
}
|
|
355
|
+
export type ActionType = "onZoom" | "onScroll" | "onVisibleRangeChange" | "onCandleTooltipFeatureClick" | "onIndicatorTooltipFeatureClick" | "onCrosshairFeatureClick" | "onCrosshairChange" | "onCandleBarClick" | "onPaneDrag";
|
|
353
356
|
/**
|
|
354
357
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
355
358
|
* you may not use this file except in compliance with the License.
|
|
@@ -459,17 +462,11 @@ export interface Crosshair extends Partial<Coordinate> {
|
|
|
459
462
|
* See the License for the specific language governing permissions and
|
|
460
463
|
* limitations under the License.
|
|
461
464
|
*/
|
|
462
|
-
export interface
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
}
|
|
468
|
-
export interface MouseTouchEvent extends Coordinate {
|
|
469
|
-
pageX: number;
|
|
470
|
-
pageY: number;
|
|
471
|
-
isTouch?: boolean;
|
|
472
|
-
preventDefault?: () => void;
|
|
465
|
+
export interface SymbolInfo {
|
|
466
|
+
ticker: string;
|
|
467
|
+
pricePrecision: number;
|
|
468
|
+
volumePrecision: number;
|
|
469
|
+
[key: string]: unknown;
|
|
473
470
|
}
|
|
474
471
|
/**
|
|
475
472
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -484,27 +481,59 @@ export interface MouseTouchEvent extends Coordinate {
|
|
|
484
481
|
* See the License for the specific language governing permissions and
|
|
485
482
|
* limitations under the License.
|
|
486
483
|
*/
|
|
487
|
-
export
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
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;
|
|
497
511
|
}
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
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;
|
|
502
530
|
}
|
|
503
|
-
export interface
|
|
504
|
-
|
|
505
|
-
|
|
531
|
+
export interface MouseTouchEvent extends Coordinate {
|
|
532
|
+
pageX: number;
|
|
533
|
+
pageY: number;
|
|
534
|
+
isTouch?: boolean;
|
|
535
|
+
preventDefault?: () => void;
|
|
506
536
|
}
|
|
507
|
-
export type LoadDataCallback = (params: LoadDataParams) => void;
|
|
508
537
|
/**
|
|
509
538
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
510
539
|
* you may not use this file except in compliance with the License.
|
|
@@ -518,15 +547,12 @@ export type LoadDataCallback = (params: LoadDataParams) => void;
|
|
|
518
547
|
* See the License for the specific language governing permissions and
|
|
519
548
|
* limitations under the License.
|
|
520
549
|
*/
|
|
521
|
-
export interface
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
export declare const enum PaneState {
|
|
526
|
-
Normal = "normal",
|
|
527
|
-
Maximize = "maximize",
|
|
528
|
-
Minimize = "minimize"
|
|
550
|
+
export interface Point {
|
|
551
|
+
dataIndex: number;
|
|
552
|
+
timestamp: number;
|
|
553
|
+
value: number;
|
|
529
554
|
}
|
|
555
|
+
export type PaneState = "normal" | "maximize" | "minimize";
|
|
530
556
|
export interface PaneOptions {
|
|
531
557
|
id?: string;
|
|
532
558
|
height?: number;
|
|
@@ -536,16 +562,26 @@ export interface PaneOptions {
|
|
|
536
562
|
state?: PaneState;
|
|
537
563
|
axis?: Partial<AxisCreate>;
|
|
538
564
|
}
|
|
539
|
-
export
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
565
|
+
export type FormatDateType = "tooltip" | "crosshair" | "xAxis";
|
|
566
|
+
export interface FormatDateParams {
|
|
567
|
+
dateTimeFormat: Intl.DateTimeFormat;
|
|
568
|
+
timestamp: number;
|
|
569
|
+
template: string;
|
|
570
|
+
type: FormatDateType;
|
|
543
571
|
}
|
|
544
|
-
export type FormatDate = (
|
|
572
|
+
export type FormatDate = (params: FormatDateParams) => string;
|
|
545
573
|
export type FormatBigNumber = (value: string | number) => string;
|
|
546
|
-
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 {
|
|
547
582
|
formatDate: FormatDate;
|
|
548
583
|
formatBigNumber: FormatBigNumber;
|
|
584
|
+
formatExtendText: FormatExtendText;
|
|
549
585
|
}
|
|
550
586
|
export interface Locales {
|
|
551
587
|
time: string;
|
|
@@ -556,13 +592,16 @@ export interface Locales {
|
|
|
556
592
|
volume: string;
|
|
557
593
|
change: string;
|
|
558
594
|
turnover: string;
|
|
595
|
+
second: string;
|
|
596
|
+
minute: string;
|
|
597
|
+
hour: string;
|
|
598
|
+
day: string;
|
|
599
|
+
week: string;
|
|
600
|
+
month: string;
|
|
601
|
+
year: string;
|
|
559
602
|
[key: string]: string;
|
|
560
603
|
}
|
|
561
|
-
export
|
|
562
|
-
Candle = "candle",
|
|
563
|
-
Indicator = "indicator",
|
|
564
|
-
XAxis = "xAxis"
|
|
565
|
-
}
|
|
604
|
+
export type LayoutChildType = "candle" | "indicator" | "xAxis";
|
|
566
605
|
export interface LayoutChild {
|
|
567
606
|
type: LayoutChildType;
|
|
568
607
|
content?: Array<string | IndicatorCreate>;
|
|
@@ -580,7 +619,7 @@ export interface Options {
|
|
|
580
619
|
locale?: string;
|
|
581
620
|
timezone?: string;
|
|
582
621
|
styles?: string | DeepPartial<Styles>;
|
|
583
|
-
|
|
622
|
+
formatter?: Partial<Formatter>;
|
|
584
623
|
thousandsSeparator?: Partial<ThousandsSeparator>;
|
|
585
624
|
decimalFold?: Partial<DecimalFold>;
|
|
586
625
|
layout?: LayoutChild[];
|
|
@@ -591,11 +630,7 @@ export interface YAxis extends Axis, Required<YAxisTemplate> {
|
|
|
591
630
|
isInCandle: () => boolean;
|
|
592
631
|
convertToNicePixel: (value: number) => number;
|
|
593
632
|
}
|
|
594
|
-
export
|
|
595
|
-
Normal = "normal",
|
|
596
|
-
WeakMagnet = "weak_magnet",
|
|
597
|
-
StrongMagnet = "strong_magnet"
|
|
598
|
-
}
|
|
633
|
+
export type OverlayMode = "normal" | "weak_magnet" | "strong_magnet";
|
|
599
634
|
export interface OverlayPerformEventParams {
|
|
600
635
|
currentStep: number;
|
|
601
636
|
mode: OverlayMode;
|
|
@@ -603,31 +638,46 @@ export interface OverlayPerformEventParams {
|
|
|
603
638
|
performPointIndex: number;
|
|
604
639
|
performPoint: Partial<Point>;
|
|
605
640
|
}
|
|
606
|
-
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
|
+
}
|
|
607
658
|
export interface OverlayFigure {
|
|
608
659
|
key?: string;
|
|
609
660
|
type: string;
|
|
610
661
|
attrs: unknown;
|
|
611
662
|
styles?: unknown;
|
|
612
|
-
ignoreEvent?: boolean |
|
|
663
|
+
ignoreEvent?: boolean | Array<keyof Omit<OverlayEventCollection<unknown>, "onDrawStart" | "onDrawing" | "onDrawEnd" | "onRemoved">>;
|
|
613
664
|
}
|
|
614
|
-
export interface OverlayCreateFiguresCallbackParams {
|
|
665
|
+
export interface OverlayCreateFiguresCallbackParams<E> {
|
|
615
666
|
chart: Chart;
|
|
616
|
-
overlay: Overlay
|
|
667
|
+
overlay: Overlay<E>;
|
|
617
668
|
coordinates: Coordinate[];
|
|
618
669
|
bounding: Bounding;
|
|
619
670
|
xAxis: Nullable<XAxis>;
|
|
620
671
|
yAxis: Nullable<YAxis>;
|
|
621
672
|
}
|
|
622
|
-
export interface OverlayEvent extends Partial<MouseTouchEvent> {
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
overlay: Overlay;
|
|
673
|
+
export interface OverlayEvent<E> extends Partial<MouseTouchEvent> {
|
|
674
|
+
figure?: OverlayFigure;
|
|
675
|
+
overlay: Overlay<E>;
|
|
626
676
|
chart: Chart;
|
|
627
677
|
}
|
|
628
|
-
export type OverlayEventCallback = (event: OverlayEvent) =>
|
|
629
|
-
export type OverlayCreateFiguresCallback = (params: OverlayCreateFiguresCallbackParams) => OverlayFigure | OverlayFigure[];
|
|
630
|
-
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> {
|
|
631
681
|
/**
|
|
632
682
|
* Unique identification
|
|
633
683
|
*/
|
|
@@ -691,7 +741,7 @@ export interface Overlay {
|
|
|
691
741
|
/**
|
|
692
742
|
* Extended Data
|
|
693
743
|
*/
|
|
694
|
-
extendData:
|
|
744
|
+
extendData: E;
|
|
695
745
|
/**
|
|
696
746
|
* The style information and format are consistent with the overlay in the unified configuration
|
|
697
747
|
*/
|
|
@@ -699,15 +749,15 @@ export interface Overlay {
|
|
|
699
749
|
/**
|
|
700
750
|
* Create figures corresponding to points
|
|
701
751
|
*/
|
|
702
|
-
createPointFigures: Nullable<OverlayCreateFiguresCallback
|
|
752
|
+
createPointFigures: Nullable<OverlayCreateFiguresCallback<E>>;
|
|
703
753
|
/**
|
|
704
754
|
* Create figures on the Y axis
|
|
705
755
|
*/
|
|
706
|
-
createXAxisFigures: Nullable<OverlayCreateFiguresCallback
|
|
756
|
+
createXAxisFigures: Nullable<OverlayCreateFiguresCallback<E>>;
|
|
707
757
|
/**
|
|
708
758
|
* Create figures on the X axis
|
|
709
759
|
*/
|
|
710
|
-
createYAxisFigures: Nullable<OverlayCreateFiguresCallback
|
|
760
|
+
createYAxisFigures: Nullable<OverlayCreateFiguresCallback<E>>;
|
|
711
761
|
/**
|
|
712
762
|
* Special handling callbacks when pressing events
|
|
713
763
|
*/
|
|
@@ -716,72 +766,16 @@ export interface Overlay {
|
|
|
716
766
|
* In drawing, special handling callback when moving events
|
|
717
767
|
*/
|
|
718
768
|
performEventMoveForDrawing: Nullable<(params: OverlayPerformEventParams) => void>;
|
|
719
|
-
/**
|
|
720
|
-
* Start drawing event
|
|
721
|
-
*/
|
|
722
|
-
onDrawStart: Nullable<OverlayEventCallback>;
|
|
723
|
-
/**
|
|
724
|
-
* In drawing event
|
|
725
|
-
*/
|
|
726
|
-
onDrawing: Nullable<OverlayEventCallback>;
|
|
727
|
-
/**
|
|
728
|
-
* Draw End Event
|
|
729
|
-
*/
|
|
730
|
-
onDrawEnd: Nullable<OverlayEventCallback>;
|
|
731
|
-
/**
|
|
732
|
-
* Click event
|
|
733
|
-
*/
|
|
734
|
-
onClick: Nullable<OverlayEventCallback>;
|
|
735
|
-
/**
|
|
736
|
-
* Double Click event
|
|
737
|
-
*/
|
|
738
|
-
onDoubleClick: Nullable<OverlayEventCallback>;
|
|
739
|
-
/**
|
|
740
|
-
* Right click event
|
|
741
|
-
*/
|
|
742
|
-
onRightClick: Nullable<OverlayEventCallback>;
|
|
743
|
-
/**
|
|
744
|
-
* Pressed move start event
|
|
745
|
-
*/
|
|
746
|
-
onPressedMoveStart: Nullable<OverlayEventCallback>;
|
|
747
|
-
/**
|
|
748
|
-
* Pressed moving event
|
|
749
|
-
*/
|
|
750
|
-
onPressedMoving: Nullable<OverlayEventCallback>;
|
|
751
|
-
/**
|
|
752
|
-
* Pressed move end event
|
|
753
|
-
*/
|
|
754
|
-
onPressedMoveEnd: Nullable<OverlayEventCallback>;
|
|
755
|
-
/**
|
|
756
|
-
* Mouse enter event
|
|
757
|
-
*/
|
|
758
|
-
onMouseEnter: Nullable<OverlayEventCallback>;
|
|
759
|
-
/**
|
|
760
|
-
* Mouse leave event
|
|
761
|
-
*/
|
|
762
|
-
onMouseLeave: Nullable<OverlayEventCallback>;
|
|
763
|
-
/**
|
|
764
|
-
* Removed event
|
|
765
|
-
*/
|
|
766
|
-
onRemoved: Nullable<OverlayEventCallback>;
|
|
767
|
-
/**
|
|
768
|
-
* Selected event
|
|
769
|
-
*/
|
|
770
|
-
onSelected: Nullable<OverlayEventCallback>;
|
|
771
|
-
/**
|
|
772
|
-
* Deselected event
|
|
773
|
-
*/
|
|
774
|
-
onDeselected: Nullable<OverlayEventCallback>;
|
|
775
769
|
}
|
|
776
|
-
export type OverlayTemplate = ExcludePickPartial<Omit<Overlay
|
|
777
|
-
export type OverlayCreate = ExcludePickPartial<Omit<Overlay
|
|
778
|
-
export type OverlayFilter = Partial<Pick<Overlay
|
|
779
|
-
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>;
|
|
780
774
|
export interface Store {
|
|
781
775
|
setStyles: (value: string | DeepPartial<Styles>) => void;
|
|
782
776
|
getStyles: () => Styles;
|
|
783
|
-
|
|
784
|
-
|
|
777
|
+
setFormatter: (formatter: Partial<Formatter>) => void;
|
|
778
|
+
getFormatter: () => Formatter;
|
|
785
779
|
setLocale: (locale: string) => void;
|
|
786
780
|
getLocale: () => string;
|
|
787
781
|
setTimezone: (timezone: string) => void;
|
|
@@ -790,8 +784,10 @@ export interface Store {
|
|
|
790
784
|
getThousandsSeparator: () => ThousandsSeparator;
|
|
791
785
|
setDecimalFold: (decimalFold: Partial<DecimalFold>) => void;
|
|
792
786
|
getDecimalFold: () => DecimalFold;
|
|
793
|
-
|
|
794
|
-
|
|
787
|
+
setSymbol: (symbol: SymbolInfo) => void;
|
|
788
|
+
getSymbol: () => Nullable<SymbolInfo>;
|
|
789
|
+
setPeriod: (period: Period) => void;
|
|
790
|
+
getPeriod: () => Nullable<Period>;
|
|
795
791
|
getDataList: () => KLineData[];
|
|
796
792
|
setOffsetRightDistance: (distance: number) => void;
|
|
797
793
|
getOffsetRightDistance: () => number;
|
|
@@ -802,8 +798,8 @@ export interface Store {
|
|
|
802
798
|
setBarSpace: (space: number) => void;
|
|
803
799
|
getBarSpace: () => BarSpace;
|
|
804
800
|
getVisibleRange: () => VisibleRange;
|
|
805
|
-
|
|
806
|
-
overrideIndicator: (override: IndicatorCreate
|
|
801
|
+
setDataLoader: (dataLoader: DataLoader) => void;
|
|
802
|
+
overrideIndicator: (override: IndicatorCreate) => boolean;
|
|
807
803
|
removeIndicator: (filter?: IndicatorFilter) => boolean;
|
|
808
804
|
overrideOverlay: (override: Partial<OverlayCreate>) => boolean;
|
|
809
805
|
removeOverlay: (filter?: OverlayFilter) => boolean;
|
|
@@ -811,13 +807,9 @@ export interface Store {
|
|
|
811
807
|
isZoomEnabled: () => boolean;
|
|
812
808
|
setScrollEnabled: (enabled: boolean) => void;
|
|
813
809
|
isScrollEnabled: () => boolean;
|
|
814
|
-
|
|
815
|
-
}
|
|
816
|
-
export declare enum DomPosition {
|
|
817
|
-
Root = "root",
|
|
818
|
-
Main = "main",
|
|
819
|
-
YAxis = "yAxis"
|
|
810
|
+
resetData: () => void;
|
|
820
811
|
}
|
|
812
|
+
export type DomPosition = "root" | "main" | "yAxis";
|
|
821
813
|
export interface ConvertFilter {
|
|
822
814
|
paneId?: string;
|
|
823
815
|
absolute?: boolean;
|
|
@@ -826,12 +818,10 @@ export interface Chart extends Store {
|
|
|
826
818
|
id: string;
|
|
827
819
|
getDom: (paneId?: string, position?: DomPosition) => Nullable<HTMLElement>;
|
|
828
820
|
getSize: (paneId?: string, position?: DomPosition) => Nullable<Bounding>;
|
|
829
|
-
applyNewData: (dataList: KLineData[], more?: boolean | Partial<LoadDataMore>) => void;
|
|
830
|
-
updateData: (data: KLineData) => void;
|
|
831
821
|
createIndicator: (value: string | IndicatorCreate, isStack?: boolean, paneOptions?: PaneOptions) => Nullable<string>;
|
|
832
|
-
getIndicators: (filter?: IndicatorFilter) =>
|
|
822
|
+
getIndicators: (filter?: IndicatorFilter) => Indicator[];
|
|
833
823
|
createOverlay: (value: string | OverlayCreate | Array<string | OverlayCreate>) => Nullable<string> | Array<Nullable<string>>;
|
|
834
|
-
getOverlays: (filter?: OverlayFilter) =>
|
|
824
|
+
getOverlays: (filter?: OverlayFilter) => Overlay[];
|
|
835
825
|
setPaneOptions: (options: PaneOptions) => void;
|
|
836
826
|
getPaneOptions: (id?: string) => Nullable<PaneOptions> | PaneOptions[];
|
|
837
827
|
scrollByDistance: (distance: number, animationDuration?: number) => void;
|
|
@@ -865,10 +855,7 @@ export interface AxisGap {
|
|
|
865
855
|
top?: number;
|
|
866
856
|
bottom?: number;
|
|
867
857
|
}
|
|
868
|
-
|
|
869
|
-
Left = "left",
|
|
870
|
-
Right = "right"
|
|
871
|
-
}
|
|
858
|
+
export type AxisPosition = "left" | "right";
|
|
872
859
|
export interface AxisValueToValueParams {
|
|
873
860
|
range: AxisRange;
|
|
874
861
|
}
|
|
@@ -956,23 +943,14 @@ export interface TextAttrs {
|
|
|
956
943
|
align?: CanvasTextAlign;
|
|
957
944
|
baseline?: CanvasTextBaseline;
|
|
958
945
|
}
|
|
959
|
-
export
|
|
960
|
-
Normal = "normal",
|
|
961
|
-
Price = "price",
|
|
962
|
-
Volume = "volume"
|
|
963
|
-
}
|
|
946
|
+
export type IndicatorSeries = "normal" | "price" | "volume";
|
|
964
947
|
export type IndicatorFigureStyle = Partial<Omit<SmoothLineStyle, "style">> & Partial<Omit<RectStyle, "style">> & Partial<TextStyle> & Partial<{
|
|
965
948
|
style: LineType[keyof LineType];
|
|
966
949
|
}> & Record<string, unknown>;
|
|
967
950
|
export type IndicatorFigureAttrs = Partial<ArcAttrs> & Partial<LineStyle> & Partial<RectAttrs> & Partial<TextAttrs> & Record<string, unknown>;
|
|
968
|
-
export interface IndicatorFigureCallbackBrother<PCN> {
|
|
969
|
-
prev: PCN;
|
|
970
|
-
current: PCN;
|
|
971
|
-
next: PCN;
|
|
972
|
-
}
|
|
973
951
|
export interface IndicatorFigureAttrsCallbackParams<D> {
|
|
974
|
-
data:
|
|
975
|
-
coordinate:
|
|
952
|
+
data: NeighborData<Nullable<D>>;
|
|
953
|
+
coordinate: NeighborData<Record<keyof D, number> & {
|
|
976
954
|
x: number;
|
|
977
955
|
}>;
|
|
978
956
|
bounding: Bounding;
|
|
@@ -981,7 +959,7 @@ export interface IndicatorFigureAttrsCallbackParams<D> {
|
|
|
981
959
|
yAxis: YAxis;
|
|
982
960
|
}
|
|
983
961
|
export interface IndicatorFigureStylesCallbackParams<D> {
|
|
984
|
-
data:
|
|
962
|
+
data: NeighborData<Nullable<D>>;
|
|
985
963
|
indicator: Indicator<D>;
|
|
986
964
|
defaultStyles?: IndicatorStyle;
|
|
987
965
|
}
|
|
@@ -995,11 +973,11 @@ export interface IndicatorFigure<D = unknown> {
|
|
|
995
973
|
attrs?: IndicatorFigureAttrsCallback<D>;
|
|
996
974
|
styles?: IndicatorFigureStylesCallback<D>;
|
|
997
975
|
}
|
|
998
|
-
export type IndicatorRegenerateFiguresCallback<D> = (calcParams:
|
|
976
|
+
export type IndicatorRegenerateFiguresCallback<D, C> = (calcParams: C[]) => Array<IndicatorFigure<D>>;
|
|
999
977
|
export interface IndicatorTooltipData {
|
|
1000
978
|
name: string;
|
|
1001
979
|
calcParamsText: string;
|
|
1002
|
-
|
|
980
|
+
features: TooltipFeatureStyle[];
|
|
1003
981
|
legends: TooltipLegend[];
|
|
1004
982
|
}
|
|
1005
983
|
export interface IndicatorCreateTooltipDataSourceParams<D> {
|
|
@@ -1011,32 +989,36 @@ export interface IndicatorCreateTooltipDataSourceParams<D> {
|
|
|
1011
989
|
yAxis: YAxis;
|
|
1012
990
|
}
|
|
1013
991
|
export type IndicatorCreateTooltipDataSourceCallback<D> = (params: IndicatorCreateTooltipDataSourceParams<D>) => IndicatorTooltipData;
|
|
1014
|
-
export interface IndicatorDrawParams<D> {
|
|
992
|
+
export interface IndicatorDrawParams<D, C, E> {
|
|
1015
993
|
ctx: CanvasRenderingContext2D;
|
|
1016
994
|
chart: Chart;
|
|
1017
|
-
indicator: Indicator<D>;
|
|
995
|
+
indicator: Indicator<D, C, E>;
|
|
1018
996
|
bounding: Bounding;
|
|
1019
997
|
xAxis: XAxis;
|
|
1020
998
|
yAxis: YAxis;
|
|
1021
999
|
}
|
|
1022
|
-
export type IndicatorDrawCallback<D> = (params: IndicatorDrawParams<D>) => boolean;
|
|
1023
|
-
export type IndicatorCalcCallback<D> = (dataList: KLineData[], indicator: Indicator<D>) => Promise<D
|
|
1024
|
-
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 | {
|
|
1025
1003
|
calc: boolean;
|
|
1026
1004
|
draw: boolean;
|
|
1027
1005
|
});
|
|
1028
|
-
|
|
1029
|
-
Loading = "loading",
|
|
1030
|
-
Error = "error",
|
|
1031
|
-
Ready = "ready"
|
|
1032
|
-
}
|
|
1006
|
+
export type IndicatorDataState = "loading" | "error" | "ready";
|
|
1033
1007
|
export interface IndicatorOnDataStateChangeParams<D> {
|
|
1034
1008
|
state: IndicatorDataState;
|
|
1035
|
-
type:
|
|
1009
|
+
type: DataLoadType;
|
|
1036
1010
|
indicator: Indicator<D>;
|
|
1037
1011
|
}
|
|
1038
1012
|
export type IndicatorOnDataStateChangeCallback<D> = (params: IndicatorOnDataStateChangeParams<D>) => void;
|
|
1039
|
-
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;
|
|
1040
1022
|
/**
|
|
1041
1023
|
* Indicator name
|
|
1042
1024
|
*/
|
|
@@ -1052,7 +1034,7 @@ export interface Indicator<D = unknown> {
|
|
|
1052
1034
|
/**
|
|
1053
1035
|
* Calculation parameters
|
|
1054
1036
|
*/
|
|
1055
|
-
calcParams:
|
|
1037
|
+
calcParams: C[];
|
|
1056
1038
|
/**
|
|
1057
1039
|
* Whether ohlc column is required
|
|
1058
1040
|
*/
|
|
@@ -1072,7 +1054,7 @@ export interface Indicator<D = unknown> {
|
|
|
1072
1054
|
/**
|
|
1073
1055
|
* Extend data
|
|
1074
1056
|
*/
|
|
1075
|
-
extendData:
|
|
1057
|
+
extendData: E;
|
|
1076
1058
|
/**
|
|
1077
1059
|
* Indicator series
|
|
1078
1060
|
*/
|
|
@@ -1096,15 +1078,15 @@ export interface Indicator<D = unknown> {
|
|
|
1096
1078
|
/**
|
|
1097
1079
|
* Should update, should calc or draw
|
|
1098
1080
|
*/
|
|
1099
|
-
shouldUpdate: Nullable<IndicatorShouldUpdateCallback<D>>;
|
|
1081
|
+
shouldUpdate: Nullable<IndicatorShouldUpdateCallback<D, C, E>>;
|
|
1100
1082
|
/**
|
|
1101
1083
|
* Indicator calculation
|
|
1102
1084
|
*/
|
|
1103
|
-
calc: IndicatorCalcCallback<D>;
|
|
1085
|
+
calc: IndicatorCalcCallback<D, C, E>;
|
|
1104
1086
|
/**
|
|
1105
1087
|
* Regenerate figure configuration
|
|
1106
1088
|
*/
|
|
1107
|
-
regenerateFigures: Nullable<IndicatorRegenerateFiguresCallback<D>>;
|
|
1089
|
+
regenerateFigures: Nullable<IndicatorRegenerateFiguresCallback<D, C>>;
|
|
1108
1090
|
/**
|
|
1109
1091
|
* Create custom tooltip text
|
|
1110
1092
|
*/
|
|
@@ -1112,7 +1094,7 @@ export interface Indicator<D = unknown> {
|
|
|
1112
1094
|
/**
|
|
1113
1095
|
* Custom draw
|
|
1114
1096
|
*/
|
|
1115
|
-
draw: Nullable<IndicatorDrawCallback<D>>;
|
|
1097
|
+
draw: Nullable<IndicatorDrawCallback<D, C, E>>;
|
|
1116
1098
|
/**
|
|
1117
1099
|
* Data state change
|
|
1118
1100
|
*/
|
|
@@ -1120,14 +1102,11 @@ export interface Indicator<D = unknown> {
|
|
|
1120
1102
|
/**
|
|
1121
1103
|
* Calculation result
|
|
1122
1104
|
*/
|
|
1123
|
-
result: D
|
|
1124
|
-
}
|
|
1125
|
-
export type IndicatorTemplate<D = unknown> = ExcludePickPartial<Omit<Indicator<D>, "result">, "name" | "calc">;
|
|
1126
|
-
export type IndicatorCreate<D = unknown> = ExcludePickPartial<Omit<Indicator<D>, "result">, "name">;
|
|
1127
|
-
export interface IndicatorFilter {
|
|
1128
|
-
name?: string;
|
|
1129
|
-
paneId?: string;
|
|
1105
|
+
result: Record<number, D>;
|
|
1130
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">>;
|
|
1131
1110
|
declare function checkCoordinateOnLine(coordinate: Coordinate, attrs: LineAttrs | LineAttrs[]): boolean;
|
|
1132
1111
|
declare function getLinearYFromSlopeIntercept(kb: Nullable<number[]>, coordinate: Coordinate): number;
|
|
1133
1112
|
declare function getLinearYFromCoordinates(coordinate1: Coordinate, coordinate2: Coordinate, targetCoordinate: Coordinate): number;
|
|
@@ -1142,11 +1121,11 @@ export interface PolygonAttrs {
|
|
|
1142
1121
|
export declare function getSupportedFigures(): string[];
|
|
1143
1122
|
export declare function registerFigure<A = unknown, S = unknown>(figure: FigureTemplate<A, S>): void;
|
|
1144
1123
|
export declare function getFigureClass<A = unknown, S = unknown>(name: string): Nullable<FigureConstructor<A, S>>;
|
|
1145
|
-
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;
|
|
1146
1125
|
export declare function getSupportedIndicators(): string[];
|
|
1147
1126
|
export declare function registerLocale(locale: string, ls: Locales): void;
|
|
1148
1127
|
export declare function getSupportedLocales(): string[];
|
|
1149
|
-
export declare function registerOverlay(template: OverlayTemplate): void;
|
|
1128
|
+
export declare function registerOverlay<E = unknown>(template: OverlayTemplate<E>): void;
|
|
1150
1129
|
export declare function getOverlayClass(name: string): Nullable<OverlayConstructor>;
|
|
1151
1130
|
export declare function getSupportedOverlays(): string[];
|
|
1152
1131
|
export declare function registerStyles(name: string, ss: DeepPartial<Styles>): void;
|
|
@@ -1182,7 +1161,7 @@ export declare const utils: {
|
|
|
1182
1161
|
formatValue: typeof formatValue;
|
|
1183
1162
|
formatPrecision: typeof formatPrecision;
|
|
1184
1163
|
formatBigNumber: typeof formatBigNumber;
|
|
1185
|
-
formatDate: typeof
|
|
1164
|
+
formatDate: typeof formatTimestampByTemplate;
|
|
1186
1165
|
formatThousands: typeof formatThousands;
|
|
1187
1166
|
formatFoldDecimal: typeof formatFoldDecimal;
|
|
1188
1167
|
calcTextWidth: typeof calcTextWidth;
|