Repository navigation
Expand file tree
/
Copy pathVis.fs
More file actions
1553 lines (1412 loc) · 77.9 KB
/
Copy pathVis.fs
File metadata and controls
1553 lines (1412 loc) · 77.9 KB
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
module rec Vis
#nowarn "3390" // disable warnings for invalid XML comments
open System
open Fable.Core
open Browser.Types
type Array<'T> = System.Collections.Generic.IList<'T>
// type Moment = Moment.Moment
// type MomentFormatSpecification = Moment.MomentFormatSpecification
// type MomentInput = Moment.MomentInput
type [<AllowNullLiteral>] IExports =
abstract DataSet: DataSetStatic
abstract DataView: DataViewStatic
abstract Graph2d: Graph2dStatic
/// Network is a visualization to display networks and networks consisting of nodes and edges.
/// The visualization is easy to use and supports custom shapes, styles, colors, sizes, images, and more.
/// The network visualization works smooth on any modern browser for up to a few thousand nodes and edges.
/// To handle a larger amount of nodes, Network has clustering support. Network uses HTML canvas for rendering.
abstract Network: NetworkStatic
//type [<AllowNullLiteral>] MomentConstructor1 =
// [<Emit("$0($1...)")>] abstract Invoke: ?inp: MomentInput * ?format: MomentFormatSpecification * ?strict: bool -> Moment
//type [<AllowNullLiteral>] MomentConstructor2 =
// [<Emit("$0($1...)")>] abstract Invoke: ?inp: MomentInput * ?format: MomentFormatSpecification * ?language: string * ?strict: bool -> Moment
//type MomentConstructor =
// U2<MomentConstructor1, MomentConstructor2>
type IdType =
U2<string, float>
type SubgroupType =
IdType
type DateType =
U3<DateTime, float, string>
type [<StringEnum>] [<RequireQualifiedAccess>] DirectionType =
| From
| To
type HeightWidthType =
IdType
type [<StringEnum>] [<RequireQualifiedAccess>] TimelineItemType =
| Box
| Point
| Range
| Background
type [<StringEnum>] [<RequireQualifiedAccess>] TimelineAlignType =
| Auto
| Center
| Left
| Right
type [<StringEnum>] [<RequireQualifiedAccess>] TimelineTimeAxisScaleType =
| Millisecond
| Second
| Minute
| Hour
| Weekday
| Day
| Week
| Month
| Year
type [<StringEnum>] [<RequireQualifiedAccess>] TimelineEventPropertiesResultWhatType =
| Item
| Background
| Axis
| [<CompiledName("group-label")>] GroupLabel
| [<CompiledName("custom-time")>] CustomTime
| [<CompiledName("current-time")>] CurrentTime
type [<StringEnum>] [<RequireQualifiedAccess>] TimelineEvents =
| CurrentTimeTick
| Click
| Contextmenu
| DoubleClick
| Drop
| MouseOver
| MouseDown
| MouseUp
| MouseMove
| GroupDragged
| Changed
| Rangechange
| Rangechanged
| Select
| Itemover
| Itemout
| Timechange
| Timechanged
type [<StringEnum>] [<RequireQualifiedAccess>] Graph2dStyleType =
| Line
| Bar
| Points
type [<StringEnum>] [<RequireQualifiedAccess>] Graph2dBarChartAlign =
| Left
| Center
| Right
type [<StringEnum>] [<RequireQualifiedAccess>] Graph2dDrawPointsStyle =
| Square
| Circle
type [<StringEnum>] [<RequireQualifiedAccess>] LegendPositionType =
| [<CompiledName("top-right")>] TopRight
| [<CompiledName("top-left")>] TopLeft
| [<CompiledName("bottom-right")>] BottomRight
| [<CompiledName("bottom-left")>] BottomLeft
type [<StringEnum>] [<RequireQualifiedAccess>] ParametrizationInterpolationType =
| Centripetal
| Chordal
| Uniform
| Disabled
type [<StringEnum>] [<RequireQualifiedAccess>] TopBottomEnumType =
| Top
| Bottom
type [<StringEnum>] [<RequireQualifiedAccess>] RightLeftEnumType =
| Right
| Left
type [<AllowNullLiteral>] LegendPositionOptions =
abstract visible: bool option with get, set
abstract position: LegendPositionType option with get, set
type [<AllowNullLiteral>] LegendOptions =
abstract enabled: bool option with get, set
abstract icons: bool option with get, set
abstract iconSize: float option with get, set
abstract iconSpacing: float option with get, set
abstract left: LegendPositionOptions option with get, set
abstract right: LegendPositionOptions option with get, set
type [<AllowNullLiteral>] DataItem =
abstract className: string option with get, set
abstract content: string with get, set
abstract ``end``: DateType option with get, set
abstract group: obj option with get, set
abstract id: IdType option with get, set
abstract start: DateType with get, set
abstract style: string option with get, set
abstract subgroup: SubgroupType option with get, set
abstract title: string option with get, set
abstract ``type``: string option with get, set
abstract editable: bool option with get, set
type [<AllowNullLiteral>] PointItem =
inherit DataItem
abstract x: string with get, set
abstract y: float with get, set
type [<AllowNullLiteral>] SubGroupStackOptions =
[<EmitIndexer>] abstract Item: name: string -> bool with get, set
type [<AllowNullLiteral>] DataGroup =
abstract className: string option with get, set
abstract content: string with get, set
abstract id: IdType with get, set
abstract options: DataGroupOptions option with get, set
abstract style: string option with get, set
abstract subgroupOrder: U2<string, (unit -> unit)> option with get, set
abstract title: string option with get, set
abstract nestedGroups: ResizeArray<IdType> option with get, set
abstract subgroupStack: U2<SubGroupStackOptions, bool> option with get, set
abstract visible: bool option with get, set
abstract showNested: bool option with get, set
type [<AllowNullLiteral>] DataGroupOptions =
abstract drawPoints: U2<Graph2dDrawPointsOption, (unit -> unit)> option with get, set
abstract excludeFromLegend: bool option with get, set
abstract interpolation: U2<bool, InterpolationOptions> option with get, set
abstract shaded: Graph2dShadedOption option with get, set
abstract style: string option with get, set
abstract yAxisOrientation: RightLeftEnumType option with get, set
type [<AllowNullLiteral>] InterpolationOptions =
abstract parametrization: ParametrizationInterpolationType with get, set
type [<AllowNullLiteral>] TimelineEditableOption =
abstract add: bool option with get, set
abstract remove: bool option with get, set
abstract updateGroup: bool option with get, set
abstract updateTime: bool option with get, set
abstract overrideItems: bool option with get, set
type [<AllowNullLiteral>] TimelineFormatLabelsFunction =
[<Emit("$0($1...)")>] abstract Invoke: date: DateTime * scale: string * step: float -> string
type [<AllowNullLiteral>] TimelineFormatLabelsOption =
abstract millisecond: string option with get, set
abstract second: string option with get, set
abstract minute: string option with get, set
abstract hour: string option with get, set
abstract weekday: string option with get, set
abstract day: string option with get, set
abstract week: string option with get, set
abstract month: string option with get, set
abstract year: string option with get, set
type [<AllowNullLiteral>] TimelineFormatOption =
abstract minorLabels: U2<TimelineFormatLabelsOption, TimelineFormatLabelsFunction> option with get, set
abstract majorLabels: U2<TimelineFormatLabelsOption, TimelineFormatLabelsFunction> option with get, set
type [<AllowNullLiteral>] TimelineGroupEditableOption =
abstract add: bool option with get, set
abstract remove: bool option with get, set
abstract order: bool option with get, set
type [<AllowNullLiteral>] TimelineHiddenDateOption =
abstract start: DateType with get, set
abstract ``end``: DateType with get, set
abstract repeat: TimelineHiddenDateOptionRepeat option with get, set
type [<AllowNullLiteral>] TimelineItemsAlwaysDraggableOption =
abstract item: bool option with get, set
abstract range: bool option with get, set
type [<AllowNullLiteral>] TimelineMarginItem =
abstract horizontal: float option with get, set
abstract vertical: float option with get, set
type TimelineMarginItemType =
U2<float, TimelineMarginItem>
type [<AllowNullLiteral>] TimelineMarginOption =
abstract axis: float option with get, set
abstract item: TimelineMarginItemType option with get, set
type [<AllowNullLiteral>] TimelineOrientationOption =
abstract axis: string option with get, set
abstract item: string option with get, set
type [<AllowNullLiteral>] TimelineTimeAxisOption =
abstract scale: TimelineTimeAxisScaleType option with get, set
abstract step: float option with get, set
type [<AllowNullLiteral>] TimelineRollingModeOption =
abstract follow: bool option with get, set
abstract offset: float option with get, set
type [<AllowNullLiteral>] TimelineTooltipOption =
abstract followMouse: bool option with get, set
abstract overflowMethod: TimelineTooltipOptionOverflowMethod option with get, set
type [<AllowNullLiteral>] TimelineOptionsConfigureFunction =
[<Emit("$0($1...)")>] abstract Invoke: option: string * path: ResizeArray<string> -> bool
type TimelineOptionsConfigureType =
U2<bool, TimelineOptionsConfigureFunction>
type TimelineOptionsDataAttributesType =
U3<bool, string, ResizeArray<string>>
type TimelineOptionsEditableType =
U2<bool, TimelineEditableOption>
type [<AllowNullLiteral>] TimelineOptionsItemCallbackFunction =
[<Emit("$0($1...)")>] abstract Invoke: item: TimelineItem * callback: (TimelineItem option -> unit) -> unit
type [<AllowNullLiteral>] TimelineOptionsGroupCallbackFunction =
[<Emit("$0($1...)")>] abstract Invoke: group: TimelineGroup * callback: (TimelineGroup option -> unit) -> unit
type TimelineOptionsGroupEditableType =
U2<bool, TimelineGroupEditableOption>
type TimelineOptionsGroupOrderType =
U2<string, TimelineOptionsComparisonFunction>
type [<AllowNullLiteral>] TimelineOptionsGroupOrderSwapFunction =
[<Emit("$0($1...)")>] abstract Invoke: fromGroup: obj option * toGroup: obj option * groups: DataSet<DataGroup> -> unit
type TimelineOptionsHiddenDatesType =
U2<TimelineHiddenDateOption, ResizeArray<TimelineHiddenDateOption>>
type TimelineOptionsItemsAlwaysDraggableType =
U2<bool, TimelineItemsAlwaysDraggableOption>
type TimelineOptionsMarginType =
U2<float, TimelineMarginOption>
type TimelineOptionsOrientationType =
U2<string, TimelineOrientationOption>
type [<AllowNullLiteral>] TimelineOptionsSnapFunction =
[<Emit("$0($1...)")>] abstract Invoke: date: DateTime * scale: string * step: float -> U2<DateTime, float>
type [<AllowNullLiteral>] TimelineOptionsTemplateFunction =
[<Emit("$0($1...)")>] abstract Invoke: ?item: obj * ?element: obj * ?data: obj -> string
type [<AllowNullLiteral>] TimelineOptionsComparisonFunction =
[<Emit("$0($1...)")>] abstract Invoke: a: obj option * b: obj option -> float
type [<AllowNullLiteral>] TimelineOptions =
abstract align: TimelineAlignType option with get, set
abstract autoResize: bool option with get, set
abstract clickToUse: bool option with get, set
abstract configure: TimelineOptionsConfigureType option with get, set
abstract dataAttributes: TimelineOptionsDataAttributesType option with get, set
abstract editable: TimelineOptionsEditableType option with get, set
abstract ``end``: DateType option with get, set
abstract format: TimelineFormatOption option with get, set
abstract groupEditable: TimelineOptionsGroupEditableType option with get, set
abstract groupOrder: TimelineOptionsGroupOrderType option with get, set
abstract groupOrderSwap: TimelineOptionsGroupOrderSwapFunction option with get, set
abstract groupTemplate: TimelineOptionsTemplateFunction option with get, set
abstract height: HeightWidthType option with get, set
abstract hiddenDates: TimelineOptionsHiddenDatesType option with get, set
abstract horizontalScroll: bool option with get, set
abstract itemsAlwaysDraggable: TimelineOptionsItemsAlwaysDraggableType option with get, set
abstract locale: string option with get, set
abstract locales: Locales option with get, set
abstract margin: TimelineOptionsMarginType option with get, set
abstract max: DateType option with get, set
abstract maxHeight: HeightWidthType option with get, set
abstract maxMinorChars: float option with get, set
abstract min: DateType option with get, set
abstract minHeight: HeightWidthType option with get, set
abstract moveable: bool option with get, set
abstract multiselect: bool option with get, set
abstract multiselectPerGroup: bool option with get, set
abstract onAdd: TimelineOptionsItemCallbackFunction option with get, set
abstract onAddGroup: TimelineOptionsGroupCallbackFunction option with get, set
abstract onInitialDrawComplete: (unit -> unit) option with get, set
abstract onUpdate: TimelineOptionsItemCallbackFunction option with get, set
abstract onMove: TimelineOptionsItemCallbackFunction option with get, set
abstract onMoveGroup: TimelineOptionsGroupCallbackFunction option with get, set
abstract onMoving: TimelineOptionsItemCallbackFunction option with get, set
abstract onRemove: TimelineOptionsItemCallbackFunction option with get, set
abstract onRemoveGroup: TimelineOptionsGroupCallbackFunction option with get, set
abstract order: TimelineOptionsComparisonFunction option with get, set
abstract orientation: TimelineOptionsOrientationType option with get, set
abstract rollingMode: TimelineRollingModeOption option with get, set
abstract rtl: bool option with get, set
abstract selectable: bool option with get, set
abstract showCurrentTime: bool option with get, set
abstract showMajorLabels: bool option with get, set
abstract showMinorLabels: bool option with get, set
abstract showTooltips: bool option with get, set
abstract stack: bool option with get, set
abstract stackSubgroups: bool option with get, set
abstract snap: TimelineOptionsSnapFunction option with get, set
abstract start: DateType option with get, set
abstract template: TimelineOptionsTemplateFunction option with get, set
abstract visibleFrameTemplate: TimelineOptionsTemplateFunction option with get, set
abstract throttleRedraw: float option with get, set
abstract timeAxis: TimelineTimeAxisOption option with get, set
abstract ``type``: string option with get, set
abstract tooltip: TimelineTooltipOption option with get, set
abstract tooltipOnItemUpdateTime: U2<bool, {| template: obj option -> obj option |}> option with get, set
abstract verticalScroll: bool option with get, set
abstract width: HeightWidthType option with get, set
abstract zoomable: bool option with get, set
abstract zoomKey: string option with get, set
abstract zoomMax: float option with get, set
abstract zoomMin: float option with get, set
/// 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'.
type TimelineAnimationType =
U2<bool, AnimationOptions>
type [<AllowNullLiteral>] TimelineAnimationOptions =
abstract animation: TimelineAnimationType option with get, set
type [<AllowNullLiteral>] TimelineEventPropertiesResult =
/// The id of the clicked group
abstract group: float option with get, set
/// The id of the clicked item.
abstract item: IdType option with get, set
/// Absolute horizontal position of the click event.
abstract pageX: float with get, set
/// Absolute vertical position of the click event.
abstract pageY: float with get, set
/// Relative horizontal position of the click event.
abstract x: float with get, set
/// Relative vertical position of the click event.
abstract y: float with get, set
/// Date of the clicked event.
abstract time: DateTime with get, set
/// Date of the clicked event, snapped to a nice value.
abstract snappedTime: DateTime with get, set
/// Name of the clicked thing.
abstract what: TimelineEventPropertiesResultWhatType option with get, set
/// The original click event.
abstract ``event``: Event with get, set
/// Options that can be passed to a DataSet.
type [<AllowNullLiteral>] DataSetOptions =
inherit 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.
abstract fieldId: string option with get, set
/// 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.
abstract ``type``: obj option with get, set
type [<AllowNullLiteral>] 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.
abstract queue: U2<obj option, bool> option with get, set
type [<AllowNullLiteral>] DataSet<'T> =
/// The number of items in the DataSet.
abstract length: float with get, set
/// <summary>
/// Add one or multiple items to the DataSet.
/// Adding an item will fail when there already is an item with the same id.
/// </summary>
/// <param name="data">data can be a single item or an array with items.</param>
/// <param name="senderId">Optional sender id.</param>
/// <returns>The function returns an array with the ids of the added items.</returns>
abstract add: data: U2<'T, ResizeArray<'T>> * ?senderId: IdType -> ResizeArray<IdType>
/// <summary>Clear all data from the DataSet.</summary>
/// <param name="senderId">Optional sender id.</param>
/// <returns>The function returns an array with the ids of the removed items.</returns>
abstract clear: ?senderId: IdType -> ResizeArray<IdType>
/// <summary>
/// Find all distinct values of a specified field.
/// If data items do not contain the specified field are ignored.
/// </summary>
/// <param name="field">The search term.</param>
/// <returns>Returns an unordered array containing all distinct values.</returns>
abstract distinct: field: string -> ResizeArray<obj option>
/// Flush queued changes.
/// Only available when the DataSet is configured with the option queue.
abstract flush: unit -> unit
/// <summary>Execute a callback function for every item in the dataset.</summary>
/// <param name="callback">The item callback.</param>
/// <param name="options">Optional options</param>
abstract forEach: callback: ('T -> IdType -> unit) * ?options: DataSelectionOptions<'T> -> unit
/// <summary>Get all items from the DataSet.</summary>
/// <param name="options">Optional options.</param>
/// <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.
/// </returns>
abstract get: ?options: DataSelectionOptions<'T> -> ResizeArray<'T>
/// <summary>Get a single item from the DataSet.</summary>
/// <param name="id">The item id.</param>
/// <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.
/// </returns>
abstract get: id: IdType * ?options: DataSelectionOptions<'T> -> 'T option
/// <summary>Get multiple items from the DataSet.</summary>
/// <param name="ids">Array of item ids.</param>
/// <param name="options">Optional options.</param>
/// <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.
/// </returns>
abstract get: ids: ResizeArray<IdType> * ?options: DataSelectionOptions<'T> -> ResizeArray<'T>
/// <summary>
/// Get the DataSet itself.
/// In case of a DataView, this function does not return the DataSet
/// to which the DataView is connected.
/// </summary>
/// <returns>The DataSet itself.</returns>
abstract getDataSet: unit -> DataSet<'T>
/// <summary>Get ids of all items or of a filtered set of items.</summary>
/// <returns>ids of all items or of a filtered set of items.</returns>
abstract getIds: ?options: DataSelectionOptions<'T> -> ResizeArray<IdType>
/// <summary>Map every item in the DataSet.</summary>
/// <param name="callback">The mapping callback.</param>
/// <param name="options">Optional options.</param>
/// <returns>The mapped items.</returns>
abstract map: callback: ('T -> IdType -> 'M) * ?options: DataSelectionOptions<'T> -> ResizeArray<'M>
/// <summary>Find the item with maximum value of specified field.</summary>
/// <returns>Returns null if no item is found.</returns>
abstract max: field: string -> 'T
/// <summary>Find the item with minimum value of specified field.</summary>
/// <returns>Returns null if no item is found.</returns>
abstract min: field: string -> 'T
/// <summary>Subscribe from an event.</summary>
/// <param name="event">The event name.</param>
/// <param name="callback">a callback function which will be called each time the event occurs.</param>
abstract on: ``event``: string * callback: (string -> obj option -> IdType -> unit) -> unit
/// <summary>Unsubscribe to an event.</summary>
/// <param name="event">The event name.</param>
/// <param name="callback">The exact same callback that was used when calling 'on'.</param>
abstract off: ``event``: string * callback: (string -> obj option -> IdType -> unit) -> unit
/// <summary>Remove one or more items by id.</summary>
/// <param name="id">The item id.</param>
/// <param name="senderId">The sender id.</param>
/// <returns>Returns an array with the ids of the removed items.</returns>
abstract remove: id: U2<IdType, ResizeArray<IdType>> * ?senderId: IdType -> ResizeArray<IdType>
/// Set options for the DataSet.
abstract setOptions: ?options: DataSetQueueOptions -> unit
/// <summary>
/// Update one or multiple existing items.
/// When an item doesn't exist, it will be created.
/// </summary>
/// <param name="data">a single item or an array with items.</param>
/// <returns>Returns an array with the ids of the updated items.</returns>
abstract update: data: U2<'T, ResizeArray<'T>> * ?senderId: IdType -> ResizeArray<IdType>
type [<AllowNullLiteral>] DataSetStatic =
/// <summary>Creates an instance of DataSet.</summary>
/// <param name="options">DataSet options.</param>
[<EmitConstructor>] abstract Create: options: DataSetOptions -> DataSet<'T>
/// <summary>Creates an instance of DataSet.</summary>
/// <param name="data">An Array with items.</param>
/// <param name="options">DataSet options.</param>
[<EmitConstructor>] abstract Create: ?data: ResizeArray<'T> * ?options: DataSetOptions -> DataSet<'T>
/// 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.
type [<AllowNullLiteral>] 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.
abstract fields: U2<ResizeArray<string>, obj option> option with get, set
/// 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.
abstract ``type``: obj option with get, set
/// 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.
abstract filter: item: 'T -> bool
/// Order the items by a field name or custom sort function.
abstract order: U2<string, ('T -> 'T -> float)> option with get, set
/// 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.
abstract returnType: DataSelectionOptionsReturnType option with get, set
type [<AllowNullLiteral>] DataView<'T> =
abstract length: float with get, set
type [<AllowNullLiteral>] DataViewStatic =
[<EmitConstructor>] abstract Create: items: ResizeArray<'T> -> DataView<'T>
type DataItemCollectionType =
U3<ResizeArray<DataItem>, DataSet<DataItem>, DataView<DataItem>>
type DataGroupCollectionType =
U3<ResizeArray<DataGroup>, DataSet<DataGroup>, DataView<DataGroup>>
type [<AllowNullLiteral>] TitleOption =
abstract text: string option with get, set
abstract style: string option with get, set
type [<AllowNullLiteral>] RangeType =
abstract min: IdType with get, set
abstract max: IdType with get, set
type [<AllowNullLiteral>] DataAxisSideOption =
abstract range: RangeType option with get, set
abstract format: unit -> string
abstract title: TitleOption option with get, set
type [<AllowNullLiteral>] Graph2dBarChartOption =
abstract width: float option with get, set
abstract minWidth: float option with get, set
abstract sideBySide: bool option with get, set
abstract align: Graph2dBarChartAlign option with get, set
type [<AllowNullLiteral>] Graph2dDataAxisOption =
abstract orientation: TimelineOptionsOrientationType option with get, set
abstract showMinorLabels: bool option with get, set
abstract showMajorLabels: bool option with get, set
abstract majorLinesOffset: float option with get, set
abstract minorLinesOffset: float option with get, set
abstract labelOffsetX: float option with get, set
abstract labelOffsetY: float option with get, set
abstract iconWidth: float option with get, set
abstract width: string option with get, set
abstract icons: bool option with get, set
abstract visible: bool option with get, set
abstract alignZeros: bool option with get, set
abstract left: DataAxisSideOption option with get, set
abstract right: DataAxisSideOption option with get, set
type [<AllowNullLiteral>] Graph2dDrawPointsOption =
abstract enabled: bool option with get, set
abstract onRender: unit -> bool
abstract size: float option with get, set
abstract style: Graph2dDrawPointsStyle with get, set
type [<AllowNullLiteral>] Graph2dShadedOption =
abstract orientation: TopBottomEnumType option with get, set
abstract groupid: IdType option with get, set
type Graph2dOptionBarChart =
U2<float, Graph2dBarChartOption>
type Graph2dOptionDataAxis =
U2<bool, Graph2dDataAxisOption>
type Graph2dOptionDrawPoints =
U2<bool, Graph2dDrawPointsOption>
type Graph2dLegendOption =
U2<bool, LegendOptions>
type [<AllowNullLiteral>] Graph2dOptions =
abstract autoResize: bool option with get, set
abstract barChart: Graph2dOptionBarChart option with get, set
abstract clickToUse: bool option with get, set
abstract configure: TimelineOptionsConfigureType option with get, set
abstract dataAxis: Graph2dOptionDataAxis option with get, set
abstract defaultGroup: string option with get, set
abstract drawPoints: Graph2dOptionDrawPoints option with get, set
abstract ``end``: DateType option with get, set
abstract format: obj option with get, set
abstract graphHeight: HeightWidthType option with get, set
abstract height: HeightWidthType option with get, set
abstract hiddenDates: obj option with get, set
abstract legend: Graph2dLegendOption option with get, set
abstract locale: string option with get, set
abstract locales: Locales option with get, set
abstract max: DateType option with get, set
abstract maxHeight: HeightWidthType option with get, set
abstract maxMinorChars: float option with get, set
abstract min: DateType option with get, set
abstract minHeight: HeightWidthType option with get, set
abstract moveable: bool option with get, set
abstract multiselect: bool option with get, set
abstract orientation: string option with get, set
abstract sampling: bool option with get, set
abstract showCurrentTime: bool option with get, set
abstract showMajorLabels: bool option with get, set
abstract showMinorLabels: bool option with get, set
abstract sort: bool option with get, set
abstract stack: bool option with get, set
abstract start: DateType option with get, set
abstract style: Graph2dStyleType option with get, set
abstract throttleRedraw: float option with get, set
abstract timeAxis: TimelineTimeAxisOption option with get, set
abstract width: HeightWidthType option with get, set
abstract yAxisOrientation: RightLeftEnumType option with get, set
abstract zoomable: bool option with get, set
abstract zoomKey: string option with get, set
abstract zoomMax: float option with get, set
abstract zoomMin: float option with get, set
abstract zIndex: float option with get, set
type [<AllowNullLiteral>] Graph2d =
abstract addCustomTime: time: DateType * ?id: IdType -> IdType
abstract destroy: unit -> unit
abstract fit: ?options: TimelineAnimationOptions -> unit
abstract focus: ids: U2<IdType, ResizeArray<IdType>> * ?options: TimelineAnimationOptions -> unit
abstract getCurrentTime: unit -> DateTime
abstract getCustomTime: ?id: IdType -> DateTime
abstract getEventProperties: ``event``: Event -> TimelineEventPropertiesResult
abstract getItemRange: unit -> obj option
abstract getSelection: unit -> ResizeArray<IdType>
abstract getVisibleItems: unit -> ResizeArray<IdType>
abstract getWindow: unit -> {| start: DateTime; ``end``: DateTime |}
abstract moveTo: time: DateType * ?options: TimelineAnimationOptions -> unit
abstract on: ``event``: TimelineEvents * callback: (unit -> unit) -> unit
abstract off: ``event``: TimelineEvents * callback: (unit -> unit) -> unit
abstract redraw: unit -> unit
abstract removeCustomTime: id: IdType -> unit
abstract setCurrentTime: time: DateType -> unit
abstract setCustomTime: time: DateType * ?id: IdType -> unit
abstract setCustomTimeTitle: title: string * ?id: IdType -> unit
abstract setData: data: {| groups: DataGroupCollectionType option; items: DataItemCollectionType option |} -> unit
abstract setGroups: ?groups: DataGroupCollectionType -> unit
abstract setItems: items: DataItemCollectionType -> unit
abstract setOptions: options: TimelineOptions -> unit
abstract setSelection: ids: U2<IdType, ResizeArray<IdType>> -> unit
abstract setWindow: start: DateType * ``end``: DateType * ?options: TimelineAnimationOptions -> unit
abstract setGroups: ?groups: ResizeArray<TimelineGroup> -> unit
abstract setItems: ?items: ResizeArray<TimelineItem> -> unit
abstract getLegend: unit -> TimelineWindow
abstract setWindow: start: obj option * date: obj option -> unit
abstract focus: selection: obj option -> unit
abstract on: ?``event``: string * ?callback: (obj option -> unit) -> unit
type [<AllowNullLiteral>] Graph2dStatic =
[<EmitConstructor>] abstract Create: container: HTMLElement * items: DataItemCollectionType * groups: DataGroupCollectionType * ?options: Graph2dOptions -> Graph2d
[<EmitConstructor>] abstract Create: container: HTMLElement * items: DataItemCollectionType * ?options: Graph2dOptions -> Graph2d
type [<AllowNullLiteral>] Timeline =
/// 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.
abstract addCustomTime: time: DateType * ?id: IdType -> IdType
/// Destroy the Timeline. The timeline is removed from memory. all DOM elements and event listeners are cleaned up.
abstract destroy: unit -> unit
/// Adjust the visible window such that it fits all items. See also focus(id).
abstract fit: ?options: TimelineAnimationOptions -> unit
/// Adjust the visible window such that the selected item (or multiple items) are centered on screen. See also function fit()
abstract focus: ids: U2<IdType, ResizeArray<IdType>> * ?options: TimelineAnimationOptions -> unit
/// Get the current time. Only applicable when option showCurrentTime is true.
abstract getCurrentTime: unit -> DateTime
/// <summary>Retrieve the custom time from the custom time bar with given id.</summary>
/// <param name="id">Id is undefined by default.</param>
abstract getCustomTime: ?id: IdType -> DateTime
abstract getEventProperties: ``event``: Event -> TimelineEventPropertiesResult
/// Get the range of all the items as an object containing min date and max date
abstract getItemRange: unit -> {| min: DateTime; max: DateTime |}
/// Get an array with the ids of the currently selected items
abstract getSelection: unit -> ResizeArray<IdType>
/// Get an array with the ids of the currently visible items.
abstract getVisibleItems: unit -> ResizeArray<IdType>
/// Get the current visible window.
abstract getWindow: unit -> TimelineWindow
/// Move the window such that given time is centered on screen.
abstract moveTo: time: DateType * ?options: TimelineAnimationOptions * ?callback: ((obj) option -> unit) -> unit
/// Create an event listener. The callback function is invoked every time the event is triggered.
abstract on: ``event``: TimelineEvents * ?callback: ((obj) option -> unit) -> unit
/// Remove an event listener created before via function on(event[, callback]).
abstract off: ``event``: TimelineEvents * ?callback: ((obj) option -> unit) -> unit
/// 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.
abstract redraw: unit -> unit
/// <summary>Remove vertical bars previously added to the timeline via addCustomTime method.</summary>
/// <param name="id">ID of the custom vertical bar returned by addCustomTime method.</param>
abstract removeCustomTime: id: IdType -> unit
/// 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.
abstract setCurrentTime: time: DateType -> unit
/// <summary>Adjust the time of a custom time bar.</summary>
/// <param name="time">The time the custom time bar should point to</param>
/// <param name="id">Id of the custom time bar, and is undefined by default.</param>
abstract setCustomTime: time: DateType * ?id: IdType -> unit
/// <summary>Adjust the title attribute of a custom time bar.</summary>
/// <param name="title">The title shown when hover over time bar</param>
/// <param name="id">Id of the custom time bar, and is undefined by default.</param>
abstract setCustomTimeTitle: title: string * ?id: IdType -> unit
/// 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).
abstract setData: data: {| groups: DataGroupCollectionType option; items: DataItemCollectionType option |} -> unit
/// Set a data set with groups for the Timeline.
abstract setGroups: ?groups: DataGroupCollectionType -> unit
/// Set a data set with items for the Timeline.
abstract setItems: items: DataItemCollectionType -> unit
/// 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.
abstract setOptions: options: TimelineOptions -> unit
/// <summary>
/// Select one or multiple items by their id. The currently selected items will be unselected.
/// To unselect all selected items, call <c>setSelection([])</c>.
/// </summary>
abstract setSelection: ids: U2<IdType, ResizeArray<IdType>> * ?options: {| focus: bool; animation: TimelineAnimationOptions |} -> unit
/// <summary>Set the current visible window.</summary>
/// <param name="start">If the parameter value of start is null, the parameter will be left unchanged.</param>
/// <param name="end">If the parameter value of end is null, the parameter will be left unchanged.</param>
/// <param name="options">Timeline animation options. See <see cref="TimelineAnimationOptions" /></param>
/// <param name="callback">The callback function</param>
abstract setWindow: start: DateType * ``end``: DateType * ?options: TimelineAnimationOptions * ?callback: (unit -> unit) -> unit
/// Toggle rollingMode.
abstract toggleRollingMode: unit -> unit
/// <summary>Zoom in the current visible window.</summary>
/// <param name="percentage">A number and must be between 0 and 1. If null, the window will be left unchanged.</param>
/// <param name="options">Timeline animation options. See <see cref="TimelineAnimationOptions" /></param>
/// <param name="callback">The callback function</param>
abstract zoomIn: percentage: float * ?options: TimelineAnimationOptions * ?callback: (unit -> unit) -> unit
/// <summary>Zoom out the current visible window.</summary>
/// <param name="percentage">A number and must be between 0 and 1. If null, the window will be left unchanged.</param>
/// <param name="options">Timeline animation options. See <see cref="TimelineAnimationOptions" /></param>
/// <param name="callback">The callback function</param>
abstract zoomOut: percentage: float * ?options: TimelineAnimationOptions * ?callback: (unit -> unit) -> unit
abstract setGroups: ?groups: ResizeArray<TimelineGroup> -> unit
abstract setItems: ?items: ResizeArray<TimelineItem> -> unit
abstract setWindow: start: obj option * date: obj option -> unit
abstract focus: selection: obj option -> unit
abstract on: ?``event``: string * ?callback: (obj option -> unit) -> unit
abstract off: ``event``: string * ?callback: ((obj) option -> unit) -> unit
type [<AllowNullLiteral>] TimelineStatic =
[<EmitConstructor>] abstract Create: container: HTMLElement * items: DataItemCollectionType * groups: DataGroupCollectionType * ?options: TimelineOptions -> Timeline
[<EmitConstructor>] abstract Create: container: HTMLElement * items: DataItemCollectionType * ?options: TimelineOptions -> Timeline
type [<AllowNullLiteral>] TimelineStaticStatic =
[<EmitConstructor>] abstract Create: id: HTMLElement * data: obj option * ?options: obj -> TimelineStatic
type [<AllowNullLiteral>] TimelineWindow =
abstract start: DateTime with get, set
abstract ``end``: DateTime with get, set
type [<AllowNullLiteral>] TimelineItemEditableOption =
abstract remove: bool option with get, set
abstract updateGroup: bool option with get, set
abstract updateTime: bool option with get, set
type TimelineItemEditableType =
U2<bool, TimelineItemEditableOption>
type [<AllowNullLiteral>] TimelineItem =
abstract className: string option with get, set
abstract align: TimelineAlignType option with get, set
abstract content: string with get, set
abstract ``end``: DateType option with get, set
abstract group: IdType option with get, set
abstract id: IdType with get, set
abstract start: DateType with get, set
abstract style: string option with get, set
abstract subgroup: IdType option with get, set
abstract title: string option with get, set
abstract ``type``: TimelineItemType option with get, set
abstract editable: TimelineItemEditableType option with get, set
type [<AllowNullLiteral>] TimelineGroup =
abstract className: string option with get, set
abstract content: U2<string, HTMLElement> with get, set
abstract id: IdType with get, set
abstract style: string option with get, set
abstract order: float option with get, set
abstract subgroupOrder: TimelineOptionsGroupOrderType option with get, set
abstract title: string option with get, set
abstract visible: bool option with get, set
abstract nestedGroups: ResizeArray<IdType> option with get, set
abstract showNested: bool option with get, set
type [<AllowNullLiteral>] VisSelectProperties =
abstract items: ResizeArray<float> with get, set
type [<StringEnum>] [<RequireQualifiedAccess>] NetworkEvents =
| Click
| DoubleClick
| Oncontext
| Hold
| Release
| Select
| SelectNode
| SelectEdge
| DeselectNode
| DeselectEdge
| DragStart
| Dragging
| DragEnd
| ControlNodeDragging
| ControlNodeDragEnd
| HoverNode
| BlurNode
| HoverEdge
| BlurEdge
| Zoom
| ShowPopup
| HidePopup
| StartStabilizing
| StabilizationProgress
| StabilizationIterationsDone
| Stabilized
| Resize
| InitRedraw
| BeforeDrawing
| AfterDrawing
| AnimationFinished
| ConfigChange
/// Network is a visualization to display networks and networks consisting of nodes and edges.
/// The visualization is easy to use and supports custom shapes, styles, colors, sizes, images, and more.
/// The network visualization works smooth on any modern browser for up to a few thousand nodes and edges.
/// To handle a larger amount of nodes, Network has clustering support. Network uses HTML canvas for rendering.
type [<AllowNullLiteral>] Network =
/// Remove the network from the DOM and remove all Hammer bindings and references.
abstract destroy: unit -> unit
/// <summary>
/// Override all the data in the network.
/// If stabilization is enabled in the physics module,
/// the network will stabilize again.
/// This method is also performed when first initializing the network.
/// </summary>
/// <param name="data">network data</param>
abstract setData: data: Data -> unit
/// <summary>
/// Set the options.
/// All available options can be found in the modules above.
/// Each module requires it's own container with the module name to contain its options.
/// </summary>
/// <param name="options">network options</param>
abstract setOptions: options: Options -> unit
/// <summary>
/// Set an event listener.
/// Depending on the type of event you get different parameters for the callback function.
/// </summary>
/// <param name="eventName">the name of the event, f.e. 'click'</param>
/// <param name="callback">the callback function that will be raised</param>
abstract on: eventName: NetworkEvents * callback: ((obj) option -> unit) -> unit
/// <summary>
/// Remove an event listener.
/// The function you supply has to be the exact same as the one you used in the on function.
/// If no function is supplied, all listeners will be removed.
/// </summary>
/// <param name="eventName">the name of the event, f.e. 'click'</param>
/// <param name="callback">the exact same callback function that was used when calling 'on'</param>
abstract off: eventName: NetworkEvents * ?callback: ((obj) option -> unit) -> unit
/// <summary>
/// Set an event listener only once.
/// After it has taken place, the event listener will be removed.
/// Depending on the type of event you get different parameters for the callback function.
/// </summary>
/// <param name="eventName">the name of the event, f.e. 'click'</param>
/// <param name="callback">the callback function that will be raised once</param>
abstract once: eventName: NetworkEvents * callback: ((obj) option -> unit) -> unit
/// <summary>
/// This function converts canvas coordinates to coordinates on the DOM.
/// Input and output are in the form of {x:Number, y:Number} (IPosition interface).
/// The DOM values are relative to the network container.
/// </summary>
/// <param name="position">the canvas coordinates</param>
/// <returns>the DOM coordinates</returns>
abstract canvasToDOM: position: Position -> Position
/// <summary>
/// This function converts DOM coordinates to coordinates on the canvas.
/// Input and output are in the form of {x:Number,y:Number} (IPosition interface).
/// The DOM values are relative to the network container.
/// </summary>
/// <param name="position">the DOM coordinates</param>
/// <returns>the canvas coordinates</returns>
abstract DOMtoCanvas: position: Position -> Position
/// Redraw the network.
abstract redraw: unit -> unit
/// <summary>
/// Set the size of the canvas.
/// This is automatically done on a window resize.
/// </summary>
/// <param name="width">width in a common format, f.e. '100px'</param>
/// <param name="height">height in a common format, f.e. '100px'</param>
abstract setSize: width: string * height: string -> unit
/// The joinCondition function is presented with all nodes.
abstract cluster: ?options: ClusterOptions -> unit
/// <summary>
/// This method looks at the provided node and makes a cluster of it and all it's connected nodes.
/// The behaviour can be customized by proving the options object.
/// All options of this object are explained below.
/// The joinCondition is only presented with the connected nodes.
/// </summary>
/// <param name="nodeId">the id of the node</param>
/// <param name="options">the cluster options</param>
abstract clusterByConnection: nodeId: string * ?options: ClusterOptions -> unit
/// <summary>
/// This method checks all nodes in the network and those with a equal or higher
/// amount of edges than specified with the hubsize qualify.
/// If a hubsize is not defined, the hubsize will be determined as the average
/// value plus two standard deviations.
/// For all qualifying nodes, clusterByConnection is performed on each of them.
/// The options object is described for clusterByConnection and does the same here.
/// </summary>
/// <param name="hubsize">optional hubsize</param>
/// <param name="options">optional cluster options</param>
abstract clusterByHubsize: ?hubsize: float * ?options: ClusterOptions -> unit
/// <summary>This method will cluster all nodes with 1 edge with their respective connected node.</summary>
/// <param name="options">optional cluster options</param>
abstract clusterOutliers: ?options: ClusterOptions -> unit
/// <summary>
/// Nodes can be in clusters.
/// Clusters can also be in clusters.
/// This function returns an array of nodeIds showing where the node is.
///
/// Example:
/// cluster 'A' contains cluster 'B', cluster 'B' contains cluster 'C',
/// cluster 'C' contains node 'fred'.
///
/// network.clustering.findNode('fred') will return ['A','B','C','fred'].
/// </summary>
/// <param name="nodeId">the node id.</param>
/// <returns>an array of nodeIds showing where the node is</returns>
abstract findNode: nodeId: IdType -> ResizeArray<IdType>
/// <summary>
/// Similar to findNode in that it returns all the edge ids that were
/// created from the provided edge during clustering.
/// </summary>
/// <param name="baseEdgeId">the base edge id</param>
/// <returns>an array of edgeIds</returns>
abstract getClusteredEdges: baseEdgeId: IdType -> ResizeArray<IdType>