This repository has been archived by the owner on Nov 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
/
index.d.ts
1976 lines (1702 loc) · 56.3 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
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Type definitions for timeline-plus 2.3.1, copied from vis.js 4.21
// Project: https://github.com/yotamberk/timeline-plus
// Definitions by: Michaël Bitard <https://github.com/MichaelBitard>
// MacLeod Broad <https://github.com/macleodbroad-wf>
// Adrian Caballero <https://github.com/adripanico>
// Severin <https://github.com/seveves>
// kaktus40 <https://github.com/kaktus40>
// Matthieu Maitre <https://github.com/mmaitre314>
// Adam Lewis <https://github.com/supercargo>
// Alex Soh <https://github.com/takato1314>
// Oleksii Kachura <https://github.com/alex-kachura>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { MomentInput, MomentFormatSpecification, Moment } from 'moment';
export type MomentConstructor1 =
(inp?: MomentInput, format?: MomentFormatSpecification, strict?: boolean) => Moment;
export type MomentConstructor2 =
(inp?: MomentInput, format?: MomentFormatSpecification, language?: string, strict?: boolean) => Moment;
export type MomentConstructor = MomentConstructor1 | MomentConstructor2;
export type IdType = string | number;
export type SubgroupType = IdType;
export type DateType = Date | number | string;
export type HeightWidthType = IdType;
export type TimelineItemType = 'box' | 'point' | 'range' | 'background';
export type TimelineAlignType = 'auto' | 'center' | 'left' | 'right';
export type TimelineTimeAxisScaleType = 'millisecond' | 'second' | 'minute' | 'hour' |
'weekday' | 'day' | 'month' | 'year';
export type TimelineEventPropertiesResultWhatType = 'item' | 'background' | 'axis' |
'group-label' | 'custom-time' | 'current-time';
export type TimelineEvents =
'currentTimeTick' |
'click' |
'contextmenu' |
'doubleClick' |
'drop' |
'mouseOver' |
'mouseDown' |
'mouseUp' |
'mouseMove' |
'groupDragged' |
'changed' |
'rangechange' |
'rangechanged' |
'select' |
'itemover' |
'itemout' |
'timechange' |
'timechanged';
export type Graph2dStyleType = 'line' | 'bar' | 'points';
export type Graph2dBarChartAlign = 'left' | 'center' | 'right';
export type Graph2dDrawPointsStyle = 'square' | 'circle';
export type LegendPositionType = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
export type ParametrizationInterpolationType = 'centripetal' | 'chordal' | 'uniform' | 'disabled';
export type TopBottomEnumType = 'top' | 'bottom';
export type RightLeftEnumType = 'right' | 'left';
export interface LegendPositionOptions {
visible?: boolean;
position?: LegendPositionType;
}
export interface LegendOptions {
enabled?: boolean;
icons?: boolean;
iconSize?: number;
iconSpacing?: number;
left?: LegendPositionOptions;
right?: LegendPositionOptions;
}
export interface DataItem {
className?: string;
content: string;
end?: DateType;
group?: any;
id?: IdType;
start: DateType;
style?: string;
subgroup?: SubgroupType;
title?: string;
type?: string;
editable?: boolean;
}
export interface PointItem extends DataItem {
x: string;
y: number;
}
export interface SubGroupStackOptions {
[name: string]: boolean;
}
export interface DataGroup {
className?: string;
content: string;
id: IdType;
options?: DataGroupOptions;
style?: string;
subgroupOrder?: string | (() => void);
title?: string;
nestedGroups?: number[];
subgroupStack?: SubGroupStackOptions | boolean;
}
export interface DataGroupOptions {
drawPoints?: Graph2dDrawPointsOption | (() => void); // TODO
excludeFromLegend?: boolean;
interpolation?: boolean | InterpolationOptions;
shaded?: Graph2dShadedOption;
style?: string;
yAxisOrientation?: RightLeftEnumType;
}
export interface InterpolationOptions {
parametrization: ParametrizationInterpolationType;
}
export interface TimelineEditableOption {
add?: boolean;
remove?: boolean;
updateGroup?: boolean;
updateTime?: boolean;
overrideItems?: boolean;
}
export type TimelineFormatLabelsFunction = (date: Date, scale: string, step: number) => string;
export interface TimelineFormatLabelsOption {
millisecond?: string;
second?: string;
minute?: string;
hour?: string;
weekday?: string;
day?: string;
week?: string;
month?: string;
year?: string;
}
export interface TimelineFormatOption {
minorLabels?: TimelineFormatLabelsOption | TimelineFormatLabelsFunction;
majorLabels?: TimelineFormatLabelsOption | TimelineFormatLabelsFunction;
}
export interface TimelineGroupEditableOption {
add?: boolean;
remove?: boolean;
order?: boolean;
}
export interface TimelineHiddenDateOption {
start: DateType;
end: DateType;
repeat?: 'daily' | 'weekly' | 'monthly' | 'yearly';
}
export interface TimelineItemsAlwaysDraggableOption {
item?: boolean;
range?: boolean;
}
export interface TimelineMarginItem {
horizontal?: number;
vertical?: number;
}
export type TimelineMarginItemType = number | TimelineMarginItem;
export interface TimelineMarginOption {
axis?: number;
item?: TimelineMarginItemType;
}
export interface TimelineOrientationOption {
axis?: string;
item?: string;
}
export interface TimelineTimeAxisOption {
scale?: TimelineTimeAxisScaleType;
step?: number;
}
export interface TimelineRollingModeOption {
follow?: boolean;
offset?: number;
}
export interface TimelineTooltipOption {
followMouse: boolean;
overflowMethod: 'cap' | 'flip';
}
export type TimelineOptionsConfigureFunction = (option: string, path: string[]) => boolean;
export type TimelineOptionsConfigureType = boolean | TimelineOptionsConfigureFunction;
export type TimelineOptionsDataAttributesType = boolean | string | string[];
export type TimelineOptionsEditableType = boolean | TimelineEditableOption;
export type TimelineOptionsItemCallbackFunction = (item: TimelineItem, callback: (item: TimelineItem | null) => void) => void;
export type TimelineOptionsGroupCallbackFunction = (group: TimelineGroup, callback: (group: TimelineGroup | null) => void) => void;
export type TimelineOptionsGroupEditableType = boolean | TimelineGroupEditableOption;
export type TimelineOptionsGroupOrderType = string | TimelineOptionsComparisonFunction;
export type TimelineOptionsGroupOrderSwapFunction = (fromGroup: any, toGroup: any, groups: DataSet<DataGroup>) => void;
export type TimelineOptionsHiddenDatesType = TimelineHiddenDateOption | TimelineHiddenDateOption[];
export type TimelineOptionsItemsAlwaysDraggableType = boolean | TimelineItemsAlwaysDraggableOption;
export type TimelineOptionsMarginType = number | TimelineMarginOption;
export type TimelineOptionsOrientationType = string | TimelineOrientationOption;
export type TimelineOptionsSnapFunction = (date: Date, scale: string, step: number) => Date | number;
export type TimelineOptionsTemplateFunction = (item?: any, element?: any, data?: any) => string;
export type TimelineOptionsComparisonFunction = (a: any, b: any) => number;
export interface TimelineOptions {
align?: TimelineAlignType;
autoResize?: boolean;
clickToUse?: boolean;
configure?: TimelineOptionsConfigureType;
dataAttributes?: TimelineOptionsDataAttributesType;
editable?: TimelineOptionsEditableType;
end?: DateType;
format?: TimelineFormatOption;
groupEditable?: TimelineOptionsGroupEditableType;
groupOrder?: TimelineOptionsGroupOrderType;
groupOrderSwap?: TimelineOptionsGroupOrderSwapFunction;
groupTemplate?: TimelineOptionsTemplateFunction;
height?: HeightWidthType;
hiddenDates?: TimelineOptionsHiddenDatesType;
horizontalScroll?: boolean;
itemsAlwaysDraggable?: TimelineOptionsItemsAlwaysDraggableType;
locale?: string;
locales?: any; // TODO
moment?: MomentConstructor;
margin?: TimelineOptionsMarginType;
max?: DateType;
maxHeight?: HeightWidthType;
maxMinorChars?: number;
min?: DateType;
minHeight?: HeightWidthType;
moveable?: boolean;
multiselect?: boolean;
multiselectPerGroup?: boolean;
onAdd?: TimelineOptionsItemCallbackFunction;
onAddGroup?: TimelineOptionsGroupCallbackFunction;
onUpdate?: TimelineOptionsItemCallbackFunction;
onMove?: TimelineOptionsItemCallbackFunction;
onMoveGroup?: TimelineOptionsGroupCallbackFunction;
onMoving?: TimelineOptionsItemCallbackFunction;
onRemove?: TimelineOptionsItemCallbackFunction;
onRemoveGroup?: TimelineOptionsGroupCallbackFunction;
order?: TimelineOptionsComparisonFunction;
orientation?: TimelineOptionsOrientationType;
rollingMode?: TimelineRollingModeOption;
rtl?: boolean;
selectable?: boolean;
showCurrentTime?: boolean;
showMajorLabels?: boolean;
showMinorLabels?: boolean;
showTooltips?: boolean;
stack?: boolean;
stackSubgroups?: boolean;
snap?: TimelineOptionsSnapFunction;
start?: DateType;
template?: TimelineOptionsTemplateFunction;
visibleFrameTemplate?: TimelineOptionsTemplateFunction;
throttleRedraw?: number;
timeAxis?: TimelineTimeAxisOption;
type?: string;
tooltip?: TimelineTooltipOption;
tooltipOnItemUpdateTime?: boolean | { template(item: any): any };
verticalScroll?: boolean;
width?: HeightWidthType;
zoomable?: boolean;
zoomKey?: string;
zoomMax?: number;
zoomMin?: number;
}
/**
* If true (default) or an Object, the range is animated smoothly to the new window.
* An object can be provided to specify duration and easing function.
* Default duration is 500 ms, and default easing function is 'easeInOutQuad'.
*/
export type TimelineAnimationType = boolean | AnimationOptions;
export interface TimelineAnimationOptions {
animation?: TimelineAnimationType;
}
export interface TimelineEventPropertiesResult {
/**
* The id of the clicked group
*/
group?: number | null;
/**
* The id of the clicked item.
*/
item?: IdType | null;
/**
* Absolute horizontal position of the click event.
*/
pageX: number;
/**
* Absolute vertical position of the click event.
*/
pageY: number;
/**
* Relative horizontal position of the click event.
*/
x: number;
/**
* Relative vertical position of the click event.
*/
y: number;
/**
* Date of the clicked event.
*/
time: Date;
/**
* Date of the clicked event, snapped to a nice value.
*/
snappedTime: Date;
/**
* Name of the clicked thing.
*/
what?: TimelineEventPropertiesResultWhatType;
/**
* The original click event.
*/
event: Event;
}
/**
* Options that can be passed to a DataSet.
*/
export interface DataSetOptions extends DataSetQueueOptions {
/**
* The name of the field containing the id of the items.
* When data is fetched from a server which uses some specific field to identify items,
* this field name can be specified in the DataSet using the option fieldId.
* For example CouchDB uses the field "_id" to identify documents.
*/
fieldId?: string;
/**
* An object containing field names as key, and data types as value.
* By default, the type of the properties of items are left unchanged.
* Item properties can be normalized by specifying a field type.
* This is useful for example to automatically convert stringified dates coming
* from a server into JavaScript Date objects.
* The available data types are listed in section Data Types.
*/
type?: any;
}
export interface DataSetQueueOptions {
/**
* Queue data changes ('add', 'update', 'remove') and flush them at once.
* The queue can be flushed manually by calling DataSet.flush(),
* or can be flushed after a configured delay or maximum number of entries.
* When queue is true, a queue is created with default options.
* Options can be specified by providing an object:
* delay: number - The queue will be flushed automatically after an inactivity of this delay in milliseconds. Default value is null.
* Default value is null.
* max: number - When the queue exceeds the given maximum number of entries, the queue is flushed automatically. Default value is Infinity.
* Default value is Infinity.
*/
queue?: any | boolean;
}
export class DataSet<T extends DataItem | DataGroup | Node | Edge> {
/**
* Creates an instance of DataSet.
*
* @param [options] DataSet options.
*/
constructor(options: DataSetOptions);
/**
* Creates an instance of DataSet.
*
* @param [data] An Array with items.
* @param [options] DataSet options.
*/
constructor(data?: T[], options?: DataSetOptions);
/**
* The number of items in the DataSet.
*/
length: number;
/**
* Add one or multiple items to the DataSet.
* Adding an item will fail when there already is an item with the same id.
*
* @param data data can be a single item or an array with items.
* @param [senderId] Optional sender id.
* @returns The function returns an array with the ids of the added items.
*/
add(data: T | T[], senderId?: IdType): IdType[];
/**
* Clear all data from the DataSet.
*
* @param [senderId] Optional sender id.
* @returns The function returns an array with the ids of the removed items.
*/
clear(senderId?: IdType): IdType[];
/**
* Find all distinct values of a specified field.
* If data items do not contain the specified field are ignored.
*
* @param field The search term.
* @returns Returns an unordered array containing all distinct values.
*/
distinct(field: string): any[];
/**
* Flush queued changes.
* Only available when the DataSet is configured with the option queue.
*/
flush(): void;
/**
* Execute a callback function for every item in the dataset.
*
* @param callback The item callback.
* @param [options] Optional options
*/
forEach(callback: (item: T, id: IdType) => void, options?: DataSelectionOptions<T>): void;
/**
* Get all items from the DataSet.
*
* @param [options] Optional options.
* @returns When no item is found, null is returned when a single item was requested,
* and and empty Array is returned in case of multiple id's.
*/
get(options?: DataSelectionOptions<T>): T[];
/**
* Get a single item from the DataSet.
*
* @param id The item id.
* @returns When no item is found, null is returned when a single item was requested,
* and and empty Array is returned in case of multiple id's.
*/
get(id: IdType, options?: DataSelectionOptions<T>): T;
/**
* Get multiple items from the DataSet.
*
* @param ids Array of item ids.
* @param [options] Optional options.
* @returns When no item is found, null is returned when a single item was requested,
* and and empty Array is returned in case of multiple id's.
*/
get(ids: IdType[], options?: DataSelectionOptions<T>): T[];
/**
* Get the DataSet itself.
* In case of a DataView, this function does not return the DataSet
* to which the DataView is connected.
*
* @returns The DataSet itself.
*/
getDataSet(): DataSet<T>;
/**
* Get ids of all items or of a filtered set of items.
*
* @returns ids of all items or of a filtered set of items.
*/
getIds(options?: DataSelectionOptions<T>): IdType[];
/**
* Map every item in the DataSet.
*
* @param callback The mapping callback.
* @param [options] Optional options.
* @returns The mapped items.
*/
map(callback: (item: T, id: IdType) => any, options?: DataSelectionOptions<T>): any[];
/**
* Find the item with maximum value of specified field.
*
* @returns Returns null if no item is found.
*/
max(field: string): T;
/**
* Find the item with minimum value of specified field.
*
* @returns Returns null if no item is found.
*/
min(field: string): T;
/**
* Subscribe from an event.
*
* @param event The event name.
* @param callback
* a callback function which will be called each time the event occurs.
*/
on(event: string, callback: (event: string, properties: any, senderId: IdType) => void): void;
/**
* Unsubscribe to an event.
*
* @param event The event name.
* @param callback
* The exact same callback that was used when calling 'on'.
*/
off(event: string, callback: (event: string, properties: any, senderId: IdType) => void): void;
/**
* Remove one or more items by id.
*
* @param id The item id.
* @param [senderId] The sender id.
* @returns Returns an array with the ids of the removed items.
*/
remove(id: IdType | IdType[], senderId?: IdType): IdType[];
/**
* Set options for the DataSet.
*/
setOptions(options?: DataSetQueueOptions): void;
/**
* Update one or multiple existing items.
* When an item doesn't exist, it will be created.
*
* @param data a single item or an array with items.
* @returns Returns an array with the ids of the updated items.
*/
update(data: T | T[], senderId?: IdType): IdType[];
}
/**
* The DataSet contains functionality to format, filter, and sort data retrieved
* via the methods get, getIds, forEach, and map.
* These methods can have these options as a parameter.
*/
export interface DataSelectionOptions<T> {
/**
* An array with field names, or an object with current field name
* and new field name that the field is returned as.
* By default, all properties of the items are emitted.
* When fields is defined, only the properties whose name is specified
* in fields will be included in the returned items.
*/
fields?: string[] | any;
/**
* An object containing field names as key, and data types as value.
* By default, the type of the properties of an item are left unchanged.
* When a field type is specified, this field in the items will be converted to the specified type.
* This can be used for example to convert ISO strings containing a date to a JavaScript Date object,
* or convert strings to numbers or vice versa. The available data types are listed in section Data Types.
*/
type?: any;
/**
* Items can be filtered on specific properties by providing a filter function.
* A filter function is executed for each of the items in the DataSet,
* and is called with the item as parameter.
* The function must return a boolean.
* All items for which the filter function returns true will be emitted.
* See section Data Filtering.
*/
filter?(item: T): boolean;
/**
* Order the items by a field name or custom sort function.
*/
order?: string | any;
/**
* Determine the type of output of the get function.
* Allowed values are 'Array' | 'Object'.
* The default returnType is an Array.
* The Object type will return a JSON object with the ID's as keys.
*/
returnType?: string;
}
export class DataView<T extends DataItem | DataGroup> {
length: number;
constructor(items: T[]);
}
export type DataItemCollectionType = DataItem[] | DataSet<DataItem> | DataView<DataItem>;
export type DataGroupCollectionType = DataGroup[] | DataSet<DataGroup> | DataView<DataGroup>;
export interface TitleOption {
text?: string;
style?: string;
}
export interface RangeType {
min: IdType;
max: IdType;
}
export interface DataAxisSideOption {
range?: RangeType;
format?(): string;
title?: TitleOption;
}
export interface Graph2dBarChartOption {
width?: number;
minWidth?: number;
sideBySide?: boolean;
align?: Graph2dBarChartAlign;
}
export interface Graph2dDataAxisOption {
orientation?: TimelineOptionsOrientationType;
showMinorLabels?: boolean;
showMajorLabels?: boolean;
majorLinesOffset?: number;
minorLinesOffset?: number;
labelOffsetX?: number;
labelOffsetY?: number;
iconWidth?: number;
width?: string;
icons?: boolean;
visible?: boolean;
alignZeros?: boolean;
left?: DataAxisSideOption;
right?: DataAxisSideOption;
}
export interface Graph2dDrawPointsOption {
enabled?: boolean;
onRender?(): boolean; // TODO
size?: number;
style: Graph2dDrawPointsStyle;
}
export interface Graph2dShadedOption {
orientation?: TopBottomEnumType;
groupid?: IdType;
}
export type Graph2dOptionBarChart = number | Graph2dBarChartOption;
export type Graph2dOptionDataAxis = boolean | Graph2dDataAxisOption;
export type Graph2dOptionDrawPoints = boolean | Graph2dDrawPointsOption;
export type Graph2dLegendOption = boolean | LegendOptions;
export interface Graph2dOptions {
autoResize?: boolean;
barChart?: Graph2dOptionBarChart;
clickToUse?: boolean;
configure?: TimelineOptionsConfigureType;
dataAxis?: Graph2dOptionDataAxis;
defaultGroup?: string;
drawPoints?: Graph2dOptionDrawPoints;
end?: DateType;
format?: any; // TODO
graphHeight?: HeightWidthType;
height?: HeightWidthType;
hiddenDates?: any; // TODO
legend?: Graph2dLegendOption;
locale?: string;
locales?: any; // TODO
moment?: MomentConstructor;
max?: DateType;
maxHeight?: HeightWidthType;
maxMinorChars?: number;
min?: DateType;
minHeight?: HeightWidthType;
moveable?: boolean;
multiselect?: boolean;
orientation?: string;
sampling?: boolean;
showCurrentTime?: boolean;
showMajorLabels?: boolean;
showMinorLabels?: boolean;
sort?: boolean;
stack?: boolean;
start?: DateType;
style?: Graph2dStyleType;
throttleRedraw?: number;
timeAxis?: TimelineTimeAxisOption;
width?: HeightWidthType;
yAxisOrientation?: RightLeftEnumType;
zoomable?: boolean;
zoomKey?: string;
zoomMax?: number;
zoomMin?: number;
zIndex?: number;
}
export class Graph2d {
constructor(
container: HTMLElement,
items: DataItemCollectionType,
groups: DataGroupCollectionType,
options?: Graph2dOptions
);
constructor(
container: HTMLElement,
items: DataItemCollectionType,
options?: Graph2dOptions
);
addCustomTime(time: DateType, id?: IdType): IdType;
destroy(): void;
fit(options?: TimelineAnimationOptions): void;
focus(ids: IdType | IdType[], options?: TimelineAnimationOptions): void;
getCurrentTime(): Date;
getCustomTime(id?: IdType): Date;
getEventProperties(event: Event): TimelineEventPropertiesResult;
getItemRange(): any; // TODO
getSelection(): IdType[];
getVisibleItems(): IdType[];
getWindow(): { start: Date, end: Date };
moveTo(time: DateType, options?: TimelineAnimationOptions): void;
on(event: TimelineEvents, callback: () => void): void;
off(event: TimelineEvents, callback: () => void): void;
redraw(): void;
removeCustomTime(id: IdType): void;
setCurrentTime(time: DateType): void;
setCustomTime(time: DateType, id?: IdType): void;
setCustomTimeTitle(title: string, id?: IdType): void;
setData(data: { groups?: DataGroupCollectionType; items?: DataItemCollectionType }): void;
setGroups(groups?: DataGroupCollectionType): void;
setItems(items: DataItemCollectionType): void;
setOptions(options: TimelineOptions): void;
setSelection(ids: IdType | IdType[]): void;
setWindow(start: DateType, end: DateType, options?: TimelineAnimationOptions): void;
}
export interface Graph2d {
setGroups(groups?: TimelineGroup[]): void;
setItems(items?: TimelineItem[]): void;
getLegend(): TimelineWindow;
getWindow(): TimelineWindow;
setWindow(start: any, date: any): void;
focus(selection: any): void;
on(event?: string, callback?: (properties: any) => void): void;
}
export class Timeline {
constructor(
container: HTMLElement,
items: DataItemCollectionType,
groups: DataGroupCollectionType,
options?: TimelineOptions
);
constructor(
container: HTMLElement,
items: DataItemCollectionType,
options?: TimelineOptions
);
/**
* Add new vertical bar representing a custom time that can be dragged by the user. Parameter time can be a Date, Number, or String, and is new Date() by default.
* Parameter id can be Number or String and is undefined by default. The id is added as CSS class name of the custom time bar, allowing to style multiple time bars differently.
* The method returns id of the created bar.
*/
addCustomTime(time: DateType, id?: IdType): IdType;
/**
* Destroy the Timeline. The timeline is removed from memory. all DOM elements and event listeners are cleaned up.
*/
destroy(): void;
/**
* Adjust the visible window such that it fits all items. See also focus(id).
*/
fit(options?: TimelineAnimationOptions): void;
/**
* Adjust the visible window such that the selected item (or multiple items) are centered on screen. See also function fit()
*/
focus(ids: IdType | IdType[], options?: TimelineAnimationOptions): void;
/**
* Get the current time. Only applicable when option showCurrentTime is true.
*/
getCurrentTime(): Date;
/**
* Retrieve the custom time from the custom time bar with given id.
* @param id Id is undefined by default.
*/
getCustomTime(id?: IdType): Date;
getEventProperties(event: Event): TimelineEventPropertiesResult;
/**
* Get the range of all the items as an object containing min date and max date
*/
getItemRange(): { min: Date, max: Date };
/**
* Get an array with the ids of the currently selected items
*/
getSelection(): IdType[];
/**
* Get an array with the ids of the currently visible items.
*/
getVisibleItems(): IdType[];
/**
* Get the current visible window.
*/
getWindow(): TimelineWindow;
/**
* Move the window such that given time is centered on screen.
*/
moveTo(time: DateType, options?: TimelineAnimationOptions, callback?: (properties?: any) => void): void;
/**
* Create an event listener. The callback function is invoked every time the event is triggered.
*/
on(event: TimelineEvents, callback?: (properties?: any) => void): void;
/**
* Remove an event listener created before via function on(event[, callback]).
*/
off(event: TimelineEvents, callback?: (properties?: any) => void): void;
/**
* Force a redraw of the Timeline. The size of all items will be recalculated.
* Can be useful to manually redraw when option autoResize=false and the window has been resized, or when the items CSS has been changed.
*/
redraw(): void;
/**
* Remove vertical bars previously added to the timeline via addCustomTime method.
* @param id ID of the custom vertical bar returned by addCustomTime method.
*/
removeCustomTime(id: IdType): void;
/**
* Set a current time. This can be used for example to ensure that a client's time is synchronized with a shared server time. Only applicable when option showCurrentTime is true.
*/
setCurrentTime(time: DateType): void;
/**
* Adjust the time of a custom time bar.
* @param time The time the custom time bar should point to
* @param id Id of the custom time bar, and is undefined by default.
*/
setCustomTime(time: DateType, id?: IdType): void;
/**
* Adjust the title attribute of a custom time bar.
* @param title The title shown when hover over time bar
* @param id Id of the custom time bar, and is undefined by default.
*/
setCustomTimeTitle(title: string, id?: IdType): void;
/**
* Set both groups and items at once. Both properties are optional.
* This is a convenience method for individually calling both setItems(items) and setGroups(groups).
* Both items and groups can be an Array with Objects, a DataSet (offering 2 way data binding), or a DataView (offering 1 way data binding).
*/
setData(data: { groups?: DataGroupCollectionType; items?: DataItemCollectionType }): void;
/**
* Set a data set with groups for the Timeline.
*/
setGroups(groups?: DataGroupCollectionType): void;
/**
* Set a data set with items for the Timeline.
*/
setItems(items: DataItemCollectionType): void;
/**
* Set or update options. It is possible to change any option of the timeline at any time. You can for example switch orientation on the fly.
*/
setOptions(options: TimelineOptions): void;
/**
* Select one or multiple items by their id. The currently selected items will be unselected. To unselect all selected items, call `setSelection([])`.
*/
setSelection(ids: IdType | IdType[], options?: { focus: boolean, animation: TimelineAnimationOptions }): void;
/**
* Set the current visible window.
* @param start If the parameter value of start is null, the parameter will be left unchanged.
* @param end If the parameter value of end is null, the parameter will be left unchanged.
* @param options Timeline animation options. See {@link TimelineAnimationOptions}
* @param callback The callback function
*/
setWindow(start: DateType, end: DateType, options?: TimelineAnimationOptions, callback?: () => void): void;
/**
* Toggle rollingMode.
*/
toggleRollingMode(): void;
/**
* Zoom in the current visible window.
* @param percentage A number and must be between 0 and 1. If null, the window will be left unchanged.
* @param options Timeline animation options. See {@link TimelineAnimationOptions}
* @param callback The callback function
*/
zoomIn(percentage: number, options?: TimelineAnimationOptions, callback?: () => void): void;
/**
* Zoom out the current visible window.
* @param percentage A number and must be between 0 and 1. If null, the window will be left unchanged.
* @param options Timeline animation options. See {@link TimelineAnimationOptions}
* @param callback The callback function
*/
zoomOut(percentage: number, options?: TimelineAnimationOptions, callback?: () => void): void;
}
export interface TimelineStatic {
new(id: HTMLElement, data: any, options?: any): Timeline;
}
export interface Timeline {
setGroups(groups?: TimelineGroup[]): void;
setItems(items?: TimelineItem[]): void;
getWindow(): TimelineWindow;
setWindow(start: any, date: any): void;
focus(selection: any): void;
on(event?: string, callback?: (properties: any) => void): void;
off(event: string, callback?: (properties?: any) => void): void;
}
export interface TimelineWindow {
start: Date;
end: Date;
}
export interface TimelineItemEditableOption {
remove?: boolean;
updateGroup?: boolean;
updateTime?: boolean;
}
export type TimelineItemEditableType = boolean | TimelineItemEditableOption;
export interface TimelineItem {
className?: string;
align?: TimelineAlignType;
content: string;
end?: DateType;
group?: IdType;
id: IdType;
start: DateType;
style?: string;
subgroup?: IdType;
title?: string;
type?: TimelineItemType;
editable?: TimelineItemEditableType;
}
export interface TimelineGroup {
className?: string;
content: string | HTMLElement;
id: IdType;
style?: string;
subgroupOrder?: TimelineOptionsGroupOrderType;
title?: string;
visible?: boolean;
nestedGroups?: IdType[];
showNested?: boolean;
}
export interface VisSelectProperties {
items: number[];
}
export type NetworkEvents =
'click' |
'doubleClick' |
'oncontext' |
'hold' |
'release' |
'select' |
'selectNode' |
'selectEdge' |
'deselectNode' |
'deselectEdge' |
'dragStart' |