-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.d.ts
490 lines (368 loc) · 10.7 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
declare namespace sentio {
interface Margin {
top: number,
right: number,
bottom: number,
left: number
}
interface Series {
key: string | number;
getValue: internal.UnionFn<any>;
label? : string;
category?: string;
}
type PointEvents = 'value' | 'values' | 'series' | null | false;
namespace internal {
type SimpleFn<T> = () => T;
type ObjectFn<T> = (d: any) => T;
type ObjectIndexFn<T> = (d: any, i: number) => T;
type UnionFn<T> = SimpleFn<T> | ObjectFn<T> | ObjectIndexFn<T>;
type BinSimpleFn<T> = (bin: any) => T;
type BinObjectFn<T> = (bin: any, d: any) => T;
type BinObjectIndexFn<T> = (bin: any, d: any, i: number) => T;
type BinUnionFn<T> = BinSimpleFn<T> | BinObjectFn<T> | BinObjectIndexFn<T>;
interface BaseChart {
margin(): Margin;
margin(v: Margin): this;
data(): any[];
data(v?: any[]): this;
init(container: any): this;
resize(): this;
redraw(): this;
}
interface DurationChart {
duration(): number;
duration(v: number): this;
}
interface MultiSeriesChart {
series(): Series[];
series(v? : Series[]): this;
}
interface KeyValueChart {
key(): UnionFn<string | number>;
key(v: UnionFn<string | number>): this;
value(): UnionFn<any>;
value(v: UnionFn<any>): this;
}
interface LabelChart {
label(): UnionFn<string>;
label(v: UnionFn<string>): this;
}
interface WidthChart {
width(): number;
width(v: number): this;
}
interface HeightChart {
height(): number;
height(v: number): this;
}
}
/*
* Charts
*/
export interface DonutChart
extends internal.BaseChart, internal.DurationChart, internal.HeightChart,
internal.LabelChart, internal.KeyValueChart, internal.WidthChart {
innerRadiusRatio(): number;
innerRadiusRatio(v: number): this;
colorScale(): any;
colorScale(v: any): this;
dispatch(): any;
legend(): DonutChartLegendConfig;
}
export interface DonutChartLegendConfig {
enabled: boolean,
markSize: number,
markMargin: number,
labelOffset: number,
position: string,
layout: string
}
export function chartDonut(): DonutChart;
export interface MatrixChart
extends internal.BaseChart, internal.DurationChart, internal.MultiSeriesChart {
cellSize(): number;
cellSize(v: number): this;
cellMargin(): number;
cellMargin(v: number): this;
colorScale(): any;
colorScale(v: any): this;
xScale(): any;
xScale(v: any): this;
yScale(): any;
yScale(v: any): this;
xExtent(): Extent;
xExtent(v: Extent): this;
valueExtent(): Extent;
valueExtent(v: Extent): this;
key(): internal.UnionFn<string | number>;
key(v: internal.UnionFn<string | number>): this;
dispatch(): any;
}
export function chartMatrix(): MatrixChart;
export interface VerticalBarsChart
extends internal.BaseChart, internal.DurationChart, internal.WidthChart,
internal.KeyValueChart, internal.LabelChart, internal.DurationChart {
barHeight(): number;
barHeight(v: number): this;
barPadding(): number;
barPadding(v: number): this;
widthExtent(): Extent;
widthExtent(v: Extent): this;
dispatch(): any;
}
export function chartVerticalBars(): VerticalBarsChart;
export interface TimelineChart
extends internal.BaseChart, internal.HeightChart, internal.MultiSeriesChart,
internal.WidthChart {
curve(): any;
curve(v: any): this;
pointEvents(): string;
pointEvents(v: PointEvents): this;
showGrid(): boolean;
showGrid(v: boolean): this;
showXGrid(): boolean;
showXGrid(v: boolean): this;
showYGrid(): boolean;
showYGrid(v: boolean): this;
xGridAxis(): any;
xGridAxis(v: any): this;
yGridAxis(): any;
yGridAxis(v: any): this;
xAxis(): any;
xAxis(v: any): this;
yAxis(): any;
yAxis(v: any): this;
xScale(): any;
xScale(v: any): this;
yScale(): any;
yScale(v: any): this;
xValue(): any;
xValue(v: any): this;
xExtent(): Extent;
xExtent(v: Extent): this;
yExtent(): Extent;
yExtent(v: Extent): this;
markers(): any[];
markers(v: any[]): this;
markerXValue(): internal.UnionFn<number>;
markerXValue(v: internal.UnionFn<number>): this;
markerLabel(): internal.UnionFn<string | number>;
markerLabel(v: internal.UnionFn<string | number>): this;
brush(): boolean;
brush(v: boolean): this;
setBrush(v?: [number, number] | null): this;
getBrush(): [number, number] | null;
dispatch(): any;
}
export function chartTimeline(): TimelineChart;
export interface RealtimeTimelineChart extends TimelineChart {
start(): void;
stop(): void;
restart(): void;
interval(): number;
interval(v: number): this;
delay(): number;
delay(v: number): this;
fps(): number;
fps(v: number): this;
}
export function chartRealtimeTimeline(): RealtimeTimelineChart;
export interface AutoBrushTimelineChart extends TimelineChart {
edgeTrigger(): number;
edgeTrigger(v: number): this;
zoomInTrigger(): number;
zoomInTrigger(v: number): this;
zoomOutTrigger(): number;
zoomOutTrigger(v: number): this;
zoomTarget(): number;
zoomTarget(v: number): this;
maxExtent(): [ number, number ];
maxExtent(v: [ number, number ]): this;
minExtent(): number;
minExtent(v: number): this;
minBrush(): number;
minBrush(v: number): this;
timelineDispatch(): any;
}
export function chartAutoBrushTimeline(): AutoBrushTimelineChart;
/*
* Controllers
*/
export interface RealtimeBinsController {
model(): BinsModel;
bins(): any[];
start(): this;
stop(): this;
running(): boolean;
add(v: any): this;
clear(): this;
binsize(): number;
binSize(v: number): this;
binCount(): number;
binCount(v: number): this;
}
export interface RealtimeBinsControllerConfig {
delay?: number,
binSize: number,
binCount: number
}
export function controllerRealtimeBins(config?: RealtimeBinsControllerConfig): RealtimeBinsController;
export interface TimelineBrush {
scale(): any;
scale(v: any): this;
brush(): any;
enabled(): boolean;
enabled(v: boolean): this;
getSelection(node: any): any;
setSelection(group: any, v: any): void;
}
export interface TimelineBrushConfig {
scale: any;
brush: any;
}
export function timelineBrush(config: TimelineBrushConfig): TimelineBrush;
export interface ResponsiveUnit {
key: string;
value: number
}
export interface ResponsiveUnitsController {
units(): ResponsiveUnit[];
units(v: ResponsiveUnit[]): this;
getUnit(v: [ number, number ]): ResponsiveUnit;
currentUnit(): ResponsiveUnit;
currentUnit(v: ResponsiveUnit): this;
}
export interface ResponsiveUnitsControllerConfig {
minTrigger?: number;
maxTrigger?: number;
}
export function controllerResponsiveUnits(config?: ResponsiveUnitsControllerConfig): ResponsiveUnitsController;
/*
* Models
*/
export interface BinsModel {
set(data: any[]): this;
clear(): this;
add(v: any): this;
lwm(v: number): this;
hwm(v: number): this;
getKey(): internal.UnionFn<string | number>;
getKey(v: internal.UnionFn<string | number>): this;
getValue(): internal.UnionFn<any>;
getValue(v: internal.UnionFn<any>): this;
updateBin(): internal.BinUnionFn<void>;
updateBin(v: internal.BinUnionFn<void>): this;
createSeed(): () => any;
createSeed(v: () => any): this;
countBin(): (bin: any) => number;
countBin(v: (bin: any) => number): this;
afterAdd(): (bins: any[], currentcount: number, previousCount: number) => void;
afterAdd(v: (bins: any[], currentcount: number, previousCount: number) => void): this;
afterUpdate(): (bins: any[], currentcount: number, previousCount: number) => void;
afterUpdate(v: (bins: any[], currentcount: number, previousCount: number) => void): this;
size(): number;
size(v: number): this;
count(): number;
count(v: number): this;
bins(): any[];
itemCount(): number;
clearBin(i: number): number;
}
export interface BinsModelConfig {
count: number,
size: number,
lwm: number,
createSeed?: () => any,
getKey?: internal.UnionFn<string | number>,
getValue?: internal.UnionFn<any>,
updateBin?: internal.BinUnionFn<void>,
countBin?: (bin: any) => number,
afterAdd?: (bins: any[], currentcount: number, previousCount: number) => void,
afterUpdate?: (bins: any[], currentcount: number, previousCount: number) => void
}
export function modelBins(config?: BinsModelConfig): BinsModel;
/**
* Extent utility. Adds convenience for things like default values, clamping,
* and dynamic element filtering.
*
* @param config
*/
export interface Extent {
/**
* Get the default value
*/
defaultValue(): [ number, number ];
/**
* Set the default value, which is used when an extent cannot be derived from the data
*/
defaultValue(v: [ number, number ]): this;
/**
* Get the override value
*/
overrideValue(): [ number, number ];
/**
* Set the override value, which is applied on top of the derived extent.
* 'undefined' for either value in the tuple means that element won't be overridden
* If override is [0, 5], the extent will always be [0, 5]
* If override is [undefined, 5], and the extent is [1, 10] the extent will be [1, 5]
* Default override is [undefined, undefined], which means don't override either value
*/
overrideValue(v: [ number, number ]): this;
/**
* Get the 'getValue' accessor function
*/
getValue(): internal.UnionFn<number>;
/**
* Set the 'setValue' accessor function, which is used to teach the extent utility how to
* get the value from the data array.
* @param v
*/
getValue(v: internal.UnionFn<number>): this;
/**
* Get the 'filter' function
*/
filter(): internal.UnionFn<boolean>;
/**
* Set the 'filter' function, which is used to omit elements from the data array when calculating
* the extent
*/
filter(v: internal.UnionFn<boolean>): this;
/**
* Get the extent given the data array and the current configuration of the extent utility
* @param data
*/
getExtent(data: any[]): [ number, number ];
}
/**
* Extent Configuration object
*/
export class ExtentConfig {
defaultValue?: [ number, number ];
overrideValue?: [ number, number ];
getValue?: internal.UnionFn<number>;
filter?: internal.UnionFn<boolean>;
}
/**
* Factory method to create an {{Extent}}
* @param config
*/
export function modelExtent(config?: ExtentConfig): Extent;
/**
* Multi-Extent Utility. This is a utility for deriving the extent of multiple data arrays at once
* The effective extent is the
*/
export interface MultiExtent {
extent(): Extent;
extent(v: Extent): this;
series(): Series;
series(v: Series): this;
getExtent(data: any[]): [ number, number ];
}
export interface MultiExtentConfig {
extent?: Extent;
series?: Series;
}
export function modelMultiExtent(config?: MultiExtentConfig): MultiExtent;
}
export = sentio;