1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | import { DataInterface, DataSet, DataView } from 'vis-data';
|
20 | export type DataInterfaceEdges = DataInterface<Edge, 'id'>
|
21 | export type DataInterfaceNodes = DataInterface<Node, 'id'>
|
22 | export type DataSetEdges = DataSet<Edge, 'id'>
|
23 | export type DataSetNodes = DataSet<Node, 'id'>
|
24 | export type DataViewEdges = DataView<Edge, 'id'>
|
25 | export type DataViewNodes = DataView<Node, 'id'>
|
26 |
|
27 | export type IdType = string | number;
|
28 | export type DirectionType = 'from' | 'to';
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | export type TimelineAnimationType = boolean | AnimationOptions;
|
36 |
|
37 | export type NetworkEvents =
|
38 | 'click' |
|
39 | 'doubleClick' |
|
40 | 'oncontext' |
|
41 | 'hold' |
|
42 | 'release' |
|
43 | 'select' |
|
44 | 'selectNode' |
|
45 | 'selectEdge' |
|
46 | 'deselectNode' |
|
47 | 'deselectEdge' |
|
48 | 'dragStart' |
|
49 | 'dragging' |
|
50 | 'dragEnd' |
|
51 | 'controlNodeDragging' |
|
52 | 'controlNodeDragEnd' |
|
53 | 'hoverNode' |
|
54 | 'blurNode' |
|
55 | 'hoverEdge' |
|
56 | 'blurEdge' |
|
57 | 'zoom' |
|
58 | 'showPopup' |
|
59 | 'hidePopup' |
|
60 | 'startStabilizing' |
|
61 | 'stabilizationProgress' |
|
62 | 'stabilizationIterationsDone' |
|
63 | 'stabilized' |
|
64 | 'resize' |
|
65 | 'initRedraw' |
|
66 | 'beforeDrawing' |
|
67 | 'afterDrawing' |
|
68 | 'animationFinished' |
|
69 | 'configChange';
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 | export class Network {
|
78 | |
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 | constructor(container: HTMLElement, data: Data, options?: Options);
|
86 |
|
87 | /**
|
88 | * Remove the network from the DOM and remove all Hammer bindings and references.
|
89 | */
|
90 | destroy(): void;
|
91 |
|
92 | /**
|
93 | * Override all the data in the network.
|
94 | * If stabilization is enabled in the physics module,
|
95 | * the network will stabilize again.
|
96 | * This method is also performed when first initializing the network.
|
97 | *
|
98 | * @param data network data
|
99 | */
|
100 | setData(data: Data): void;
|
101 |
|
102 | /**
|
103 | * Set the options.
|
104 | * All available options can be found in the modules above.
|
105 | * Each module requires it's own container with the module name to contain its options.
|
106 | *
|
107 | * @param options network options
|
108 | */
|
109 | setOptions(options: Options): void;
|
110 |
|
111 | /**
|
112 | * Set an event listener.
|
113 | * Depending on the type of event you get different parameters for the callback function.
|
114 | *
|
115 | * @param eventName the name of the event, f.e. 'click'
|
116 | * @param callback the callback function that will be raised
|
117 | */
|
118 | on(eventName: NetworkEvents, callback: (params?: any) => void): void;
|
119 |
|
120 | /**
|
121 | * Remove an event listener.
|
122 | * The function you supply has to be the exact same as the one you used in the on function.
|
123 | * If no function is supplied, all listeners will be removed.
|
124 | *
|
125 | * @param eventName the name of the event, f.e. 'click'
|
126 | * @param [callback] the exact same callback function that was used when calling 'on'
|
127 | */
|
128 | off(eventName: NetworkEvents, callback?: (params?: any) => void): void;
|
129 |
|
130 | /**
|
131 | * Set an event listener only once.
|
132 | * After it has taken place, the event listener will be removed.
|
133 | * Depending on the type of event you get different parameters for the callback function.
|
134 | *
|
135 | * @param eventName the name of the event, f.e. 'click'
|
136 | * @param callback the callback function that will be raised once
|
137 | */
|
138 | once(eventName: NetworkEvents, callback: (params?: any) => void): void;
|
139 |
|
140 | /**
|
141 | * This function converts canvas coordinates to coordinates on the DOM.
|
142 | * Input and output are in the form of {x:Number, y:Number} (IPosition interface).
|
143 | * The DOM values are relative to the network container.
|
144 | *
|
145 | * @param position the canvas coordinates
|
146 | * @returns the DOM coordinates
|
147 | */
|
148 | canvasToDOM(position: Position): Position;
|
149 |
|
150 | /**
|
151 | * This function converts DOM coordinates to coordinates on the canvas.
|
152 | * Input and output are in the form of {x:Number,y:Number} (IPosition interface).
|
153 | * The DOM values are relative to the network container.
|
154 | *
|
155 | * @param position the DOM coordinates
|
156 | * @returns the canvas coordinates
|
157 | */
|
158 | DOMtoCanvas(position: Position): Position;
|
159 |
|
160 | /**
|
161 | * Redraw the network.
|
162 | */
|
163 | redraw(): void;
|
164 |
|
165 | /**
|
166 | * Set the size of the canvas.
|
167 | * This is automatically done on a window resize.
|
168 | *
|
169 | * @param width width in a common format, f.e. '100px'
|
170 | * @param height height in a common format, f.e. '100px'
|
171 | */
|
172 | setSize(width: string, height: string): void;
|
173 |
|
174 | /**
|
175 | * The joinCondition function is presented with all nodes.
|
176 | */
|
177 | cluster(options?: ClusterOptions): void;
|
178 |
|
179 | /**
|
180 | * This method looks at the provided node and makes a cluster of it and all it's connected nodes.
|
181 | * The behaviour can be customized by proving the options object.
|
182 | * All options of this object are explained below.
|
183 | * The joinCondition is only presented with the connected nodes.
|
184 | *
|
185 | * @param nodeId the id of the node
|
186 | * @param [options] the cluster options
|
187 | */
|
188 | clusterByConnection(nodeId: string, options?: ClusterOptions): void;
|
189 |
|
190 | /**
|
191 | * This method checks all nodes in the network and those with a equal or higher
|
192 | * amount of edges than specified with the hubsize qualify.
|
193 | * If a hubsize is not defined, the hubsize will be determined as the average
|
194 | * value plus two standard deviations.
|
195 | * For all qualifying nodes, clusterByConnection is performed on each of them.
|
196 | * The options object is described for clusterByConnection and does the same here.
|
197 | *
|
198 | * @param [hubsize] optional hubsize
|
199 | * @param [options] optional cluster options
|
200 | */
|
201 | clusterByHubsize(hubsize?: number, options?: ClusterOptions): void;
|
202 |
|
203 | /**
|
204 | * This method will cluster all nodes with 1 edge with their respective connected node.
|
205 | *
|
206 | * @param [options] optional cluster options
|
207 | */
|
208 | clusterOutliers(options?: ClusterOptions): void;
|
209 |
|
210 | /**
|
211 | * Nodes can be in clusters.
|
212 | * Clusters can also be in clusters.
|
213 | * This function returns an array of nodeIds showing where the node is.
|
214 | *
|
215 | * Example:
|
216 | * cluster 'A' contains cluster 'B', cluster 'B' contains cluster 'C',
|
217 | * cluster 'C' contains node 'fred'.
|
218 | *
|
219 | * network.clustering.findNode('fred') will return ['A','B','C','fred'].
|
220 | *
|
221 | * @param nodeId the node id.
|
222 | * @returns an array of nodeIds showing where the node is
|
223 | */
|
224 | findNode(nodeId: IdType): IdType[];
|
225 |
|
226 | /**
|
227 | * Similar to findNode in that it returns all the edge ids that were
|
228 | * created from the provided edge during clustering.
|
229 | *
|
230 | * @param baseEdgeId the base edge id
|
231 | * @returns an array of edgeIds
|
232 | */
|
233 | getClusteredEdges(baseEdgeId: IdType): IdType[];
|
234 |
|
235 | /**
|
236 | * When a clusteredEdgeId is available, this method will return the original
|
237 | * baseEdgeId provided in data.edges ie.
|
238 | * After clustering the 'SelectEdge' event is fired but provides only the clustered edge.
|
239 | * This method can then be used to return the baseEdgeId.
|
240 | */
|
241 | getBaseEdge(clusteredEdgeId: IdType): IdType;
|
242 |
|
243 | /**
|
244 | * For the given clusteredEdgeId, this method will return all the original
|
245 | * base edge id's provided in data.edges.
|
246 | * For a non-clustered (i.e. 'base') edge, clusteredEdgeId is returned.
|
247 | * Only the base edge id's are returned.
|
248 | * All clustered edges id's under clusteredEdgeId are skipped,
|
249 | * but scanned recursively to return their base id's.
|
250 | */
|
251 | getBaseEdges(clusteredEdgeId: IdType): IdType[];
|
252 |
|
253 | /**
|
254 | * Visible edges between clustered nodes are not the same edge as the ones provided
|
255 | * in data.edges passed on network creation. With each layer of clustering, copies of
|
256 | * the edges between clusters are created and the previous edges are hidden,
|
257 | * until the cluster is opened. This method takes an edgeId (ie. a base edgeId from data.edges)
|
258 | * and applys the options to it and any edges that were created from it while clustering.
|
259 | */
|
260 | updateEdge(startEdgeId: IdType, options?: EdgeOptions): void;
|
261 |
|
262 | /**
|
263 | * Clustered Nodes when created are not contained in the original data.nodes
|
264 | * passed on network creation. This method updates the cluster node.
|
265 | */
|
266 | updateClusteredNode(clusteredNodeId: IdType, options?: NodeOptions): void;
|
267 |
|
268 | /**
|
269 | * Returns true if the node whose ID has been supplied is a cluster.
|
270 | *
|
271 | * @param nodeId the node id.
|
272 | */
|
273 | isCluster(nodeId: IdType): boolean;
|
274 |
|
275 | /**
|
276 | * Returns an array of all nodeIds of the nodes that
|
277 | * would be released if you open the cluster.
|
278 | *
|
279 | * @param clusterNodeId the id of the cluster node
|
280 | */
|
281 | getNodesInCluster(clusterNodeId: IdType): IdType[];
|
282 |
|
283 | /**
|
284 | * Opens the cluster, releases the contained nodes and edges,
|
285 | * removing the cluster node and cluster edges.
|
286 | * The options object is optional and currently supports one option,
|
287 | * releaseFunction, which is a function that can be used to manually
|
288 | * position the nodes after the cluster is opened.
|
289 | *
|
290 | * @param nodeId the node id
|
291 | * @param [options] optional open cluster options
|
292 | */
|
293 | openCluster(nodeId: IdType, options?: OpenClusterOptions): void;
|
294 |
|
295 | /**
|
296 | * If you like the layout of your network
|
297 | * and would like it to start in the same way next time,
|
298 | * ask for the seed using this method and put it in the layout.randomSeed option.
|
299 | *
|
300 | * @returns the current seed of the network.
|
301 | */
|
302 | getSeed(): number | string;
|
303 |
|
304 | /**
|
305 | * Programatically enable the edit mode.
|
306 | * Similar effect to pressing the edit button.
|
307 | */
|
308 | enableEditMode(): void;
|
309 |
|
310 | /**
|
311 | * Programatically disable the edit mode.
|
312 | * Similar effect to pressing the close icon (small cross in the corner of the toolbar).
|
313 | */
|
314 | disableEditMode(): void;
|
315 |
|
316 | /**
|
317 | * Go into addNode mode. Having edit mode or manipulation enabled is not required.
|
318 | * To get out of this mode, call disableEditMode().
|
319 | * The callback functions defined in handlerFunctions still apply.
|
320 | * To use these methods without having the manipulation GUI, make sure you set enabled to false.
|
321 | */
|
322 | addNodeMode(): void;
|
323 |
|
324 | /**
|
325 | * Edit the selected node.
|
326 | * The explaination from addNodeMode applies here as well.
|
327 | */
|
328 | editNode(): void;
|
329 |
|
330 | /**
|
331 | * Go into addEdge mode.
|
332 | * The explaination from addNodeMode applies here as well.
|
333 | */
|
334 | addEdgeMode(): void;
|
335 |
|
336 | /**
|
337 | * Go into editEdge mode.
|
338 | * The explaination from addNodeMode applies here as well.
|
339 | */
|
340 | editEdgeMode(): void;
|
341 |
|
342 | /**
|
343 | * Delete selected.
|
344 | * Having edit mode or manipulation enabled is not required.
|
345 | */
|
346 | deleteSelected(): void;
|
347 |
|
348 | /**
|
349 | * Returns the x y positions in canvas space of a requested node or array of nodes.
|
350 | *
|
351 | * @remarks
|
352 | * - If `nodeIds` is supplied as a single id that does not correspond
|
353 | * to a node in the network, this function will return an empty object.
|
354 | * - If `nodeIds` is supplied as an array of ids, but one or more do not correspond to a node in the network, the
|
355 | * returned object will *not* include entries for the non-existent node positions.
|
356 | *
|
357 | * @param nodeIds - Either an array of node ids or a single node id. If not supplied, all node ids in the network will be used.
|
358 | * @returns A an object containing the x y positions in canvas space of the nodes in the network, keyed by id.
|
359 | */
|
360 | getPositions(nodeIds?: IdType[] | IdType): { [nodeId: string]: Position };
|
361 |
|
362 | |
363 |
|
364 |
|
365 |
|
366 |
|
367 |
|
368 |
|
369 |
|
370 |
|
371 |
|
372 |
|
373 | getPosition(nodeId: IdType): Position;
|
374 |
|
375 | |
376 |
|
377 |
|
378 |
|
379 |
|
380 |
|
381 |
|
382 |
|
383 |
|
384 |
|
385 |
|
386 |
|
387 |
|
388 |
|
389 | storePositions(): void;
|
390 |
|
391 | |
392 |
|
393 |
|
394 |
|
395 |
|
396 |
|
397 |
|
398 |
|
399 | moveNode(nodeId: IdType, x: number, y: number): void;
|
400 |
|
401 | |
402 |
|
403 |
|
404 |
|
405 | getBoundingBox(nodeId: IdType): BoundingBox;
|
406 |
|
407 | |
408 |
|
409 |
|
410 |
|
411 |
|
412 |
|
413 |
|
414 | getConnectedNodes(nodeOrEdgeId: IdType, direction?: DirectionType): IdType[] | Array<{ fromId: IdType, toId: IdType }>;
|
415 |
|
416 | |
417 |
|
418 |
|
419 |
|
420 |
|
421 | getConnectedEdges(nodeId: IdType): IdType[];
|
422 |
|
423 | |
424 |
|
425 |
|
426 |
|
427 |
|
428 | startSimulation(): void;
|
429 |
|
430 | |
431 |
|
432 |
|
433 |
|
434 |
|
435 | stopSimulation(): void;
|
436 |
|
437 | |
438 |
|
439 |
|
440 |
|
441 |
|
442 |
|
443 |
|
444 | stabilize(iterations?: number): void;
|
445 |
|
446 | |
447 |
|
448 |
|
449 |
|
450 | getSelection(): { nodes: IdType[], edges: IdType[] };
|
451 |
|
452 | |
453 |
|
454 |
|
455 |
|
456 |
|
457 | getSelectedNodes(): IdType[];
|
458 |
|
459 | |
460 |
|
461 |
|
462 |
|
463 |
|
464 | getSelectedEdges(): IdType[];
|
465 |
|
466 | |
467 |
|
468 |
|
469 |
|
470 |
|
471 | getNodeAt(position: Position): IdType;
|
472 |
|
473 | |
474 |
|
475 |
|
476 |
|
477 |
|
478 | getEdgeAt(position: Position): IdType;
|
479 |
|
480 | |
481 |
|
482 |
|
483 |
|
484 |
|
485 |
|
486 | selectNodes(nodeIds: IdType[], highlightEdges?: boolean): void;
|
487 |
|
488 | |
489 |
|
490 |
|
491 |
|
492 |
|
493 |
|
494 | selectEdges(edgeIds: IdType[]): void;
|
495 |
|
496 | |
497 |
|
498 |
|
499 |
|
500 |
|
501 | setSelection(selection: { nodes?: IdType[], edges?: IdType[] }, options?: SelectionOptions): void;
|
502 |
|
503 | |
504 |
|
505 |
|
506 |
|
507 | unselectAll(): void;
|
508 |
|
509 | |
510 |
|
511 |
|
512 |
|
513 |
|
514 |
|
515 | getScale(): number;
|
516 |
|
517 | |
518 |
|
519 |
|
520 |
|
521 |
|
522 | getViewPosition(): Position;
|
523 |
|
524 | |
525 |
|
526 |
|
527 |
|
528 |
|
529 | fit(options?: FitOptions): void;
|
530 |
|
531 | |
532 |
|
533 |
|
534 |
|
535 |
|
536 |
|
537 | focus(nodeId: IdType, options?: FocusOptions): void;
|
538 |
|
539 | |
540 |
|
541 |
|
542 |
|
543 | moveTo(options: MoveToOptions): void;
|
544 |
|
545 | |
546 |
|
547 |
|
548 | releaseNode(): void;
|
549 |
|
550 | |
551 |
|
552 |
|
553 |
|
554 |
|
555 | getOptionsFromConfigurator(): any;
|
556 | }
|
557 |
|
558 |
|
559 |
|
560 |
|
561 | export interface FocusOptions extends ViewPortOptions {
|
562 | |
563 |
|
564 |
|
565 |
|
566 |
|
567 | locked?: boolean;
|
568 | }
|
569 |
|
570 |
|
571 |
|
572 |
|
573 | export interface ViewPortOptions {
|
574 | |
575 |
|
576 |
|
577 |
|
578 | scale?: number;
|
579 |
|
580 | |
581 |
|
582 |
|
583 |
|
584 | offset?: Position;
|
585 |
|
586 | |
587 |
|
588 |
|
589 |
|
590 | animation?: AnimationOptions | boolean;
|
591 | }
|
592 |
|
593 |
|
594 |
|
595 |
|
596 |
|
597 | export interface MoveToOptions extends ViewPortOptions {
|
598 | |
599 |
|
600 |
|
601 | position?: Position;
|
602 | }
|
603 |
|
604 |
|
605 |
|
606 |
|
607 | export interface AnimationOptions {
|
608 | |
609 |
|
610 |
|
611 | duration: number;
|
612 | |
613 |
|
614 |
|
615 |
|
616 |
|
617 |
|
618 |
|
619 |
|
620 | easingFunction: EasingFunction;
|
621 | }
|
622 |
|
623 | export type EasingFunction =
|
624 | 'linear' |
|
625 | 'easeInQuad' |
|
626 | 'easeOutQuad' |
|
627 | 'easeInOutQuad' |
|
628 | 'easeInCubic' |
|
629 | 'easeOutCubic' |
|
630 | 'easeInOutCubic' |
|
631 | 'easeInQuart' |
|
632 | 'easeOutQuart' |
|
633 | 'easeInOutQuart' |
|
634 | 'easeInQuint' |
|
635 | 'easeOutQuint' |
|
636 | 'easeInOutQuint';
|
637 |
|
638 |
|
639 |
|
640 |
|
641 | export interface FitOptions {
|
642 | |
643 |
|
644 |
|
645 | nodes?: IdType[];
|
646 |
|
647 | |
648 |
|
649 |
|
650 |
|
651 |
|
652 |
|
653 | minZoomLevel?: number;
|
654 |
|
655 | |
656 |
|
657 |
|
658 |
|
659 |
|
660 |
|
661 | maxZoomLevel?: number;
|
662 |
|
663 | |
664 |
|
665 |
|
666 |
|
667 | animation?: TimelineAnimationType;
|
668 | }
|
669 |
|
670 | export interface SelectionOptions {
|
671 | unselectAll?: boolean;
|
672 | highlightEdges?: boolean;
|
673 | }
|
674 |
|
675 |
|
676 |
|
677 |
|
678 | export interface BoundingBox {
|
679 | top: number;
|
680 | left: number;
|
681 | right: number;
|
682 | bottom: number;
|
683 | }
|
684 |
|
685 |
|
686 |
|
687 |
|
688 | export interface ClusterOptions {
|
689 | |
690 |
|
691 |
|
692 |
|
693 |
|
694 |
|
695 |
|
696 | joinCondition?(nodeOptions: any): boolean;
|
697 |
|
698 | |
699 |
|
700 |
|
701 |
|
702 |
|
703 |
|
704 |
|
705 | processProperties?(clusterOptions: any, childNodesOptions: any[], childEdgesOptions: any[]): any;
|
706 |
|
707 | |
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 |
|
714 |
|
715 | clusterNodeProperties?: NodeOptions;
|
716 |
|
717 | |
718 |
|
719 |
|
720 |
|
721 |
|
722 |
|
723 |
|
724 |
|
725 | clusterEdgeProperties?: EdgeOptions;
|
726 | }
|
727 |
|
728 |
|
729 |
|
730 |
|
731 | export interface OpenClusterOptions {
|
732 | |
733 |
|
734 |
|
735 |
|
736 |
|
737 |
|
738 |
|
739 |
|
740 |
|
741 |
|
742 |
|
743 |
|
744 | releaseFunction(
|
745 | clusterPosition: Position,
|
746 | containedNodesPositions: { [nodeId: string]: Position }): { [nodeId: string]: Position };
|
747 | }
|
748 |
|
749 | export interface Position {
|
750 | x: number;
|
751 | y: number;
|
752 | }
|
753 |
|
754 | export interface Data {
|
755 | nodes?: Node[] | DataInterfaceNodes;
|
756 | edges?: Edge[] | DataInterfaceEdges;
|
757 | }
|
758 |
|
759 | export interface Node extends NodeOptions {
|
760 | id?: IdType;
|
761 | }
|
762 |
|
763 | export interface Edge extends EdgeOptions {
|
764 | from?: IdType;
|
765 | to?: IdType;
|
766 | id?: IdType;
|
767 | }
|
768 |
|
769 | export interface Locales {
|
770 | [language: string]: LocaleMessages | undefined;
|
771 | en?: LocaleMessages;
|
772 | cn?: LocaleMessages;
|
773 | de?: LocaleMessages;
|
774 | es?: LocaleMessages;
|
775 | it?: LocaleMessages;
|
776 | nl?: LocaleMessages;
|
777 | 'pt-br'?: LocaleMessages;
|
778 | ru?: LocaleMessages;
|
779 | }
|
780 |
|
781 | export interface LocaleMessages {
|
782 | edit: string;
|
783 | del: string;
|
784 | back: string;
|
785 | addNode: string;
|
786 | addEdge: string;
|
787 | editNode: string;
|
788 | editEdge: string;
|
789 | addDescription: string;
|
790 | edgeDescription: string;
|
791 | editEdgeDescription: string;
|
792 | createEdgeError: string;
|
793 | deleteClusterError: string;
|
794 | editClusterError: string;
|
795 | }
|
796 |
|
797 | export interface Options {
|
798 | autoResize?: boolean;
|
799 |
|
800 | width?: string;
|
801 |
|
802 | height?: string;
|
803 |
|
804 | locale?: string;
|
805 |
|
806 | locales?: Locales;
|
807 |
|
808 | clickToUse?: boolean;
|
809 |
|
810 | configure?: any;
|
811 |
|
812 | edges?: EdgeOptions;
|
813 |
|
814 | nodes?: NodeOptions;
|
815 |
|
816 | groups?: any;
|
817 |
|
818 | layout?: any;
|
819 |
|
820 | interaction?: any;
|
821 |
|
822 | manipulation?: any;
|
823 |
|
824 | physics?: any;
|
825 | }
|
826 |
|
827 | export interface Image {
|
828 | unselected?: string;
|
829 | selected?: string;
|
830 | }
|
831 |
|
832 | export interface ImagePadding {
|
833 | top?: number;
|
834 | right?: number;
|
835 | bottom?: number;
|
836 | left?: number;
|
837 | }
|
838 |
|
839 | export interface Color {
|
840 | border?: string;
|
841 |
|
842 | background?: string;
|
843 |
|
844 | highlight?: string | {
|
845 | border?: string;
|
846 | background?: string;
|
847 | };
|
848 |
|
849 | hover?: string | {
|
850 | border?: string;
|
851 | background?: string;
|
852 | };
|
853 | }
|
854 |
|
855 | export interface ChosenLabelValues {
|
856 | color: string;
|
857 | face: string;
|
858 | mod: string;
|
859 | size: number;
|
860 | strokeColor: string;
|
861 | strokeWidth: number;
|
862 | vadjust: number;
|
863 | }
|
864 | export type NodeChosenLabelFunction = (
|
865 | values: ChosenLabelValues,
|
866 | id: IdType,
|
867 | selected: boolean,
|
868 | hovered: boolean
|
869 | ) => void;
|
870 |
|
871 | export interface ChosenNodeValues {
|
872 | borderColor: string;
|
873 | borderDashes: boolean | number[];
|
874 | borderRadius: number;
|
875 | borderWidth: number;
|
876 | color: string;
|
877 | shadow: boolean;
|
878 | shadowColor: string;
|
879 | shadowSize: number;
|
880 | shadowX: number;
|
881 | shadowY: number;
|
882 | size: number;
|
883 | }
|
884 | export type NodeChosenNodeFunction = (
|
885 | values: ChosenNodeValues,
|
886 | id: IdType,
|
887 | selected: boolean,
|
888 | hovered: boolean
|
889 | ) => void;
|
890 |
|
891 | export interface NodeChosen {
|
892 | node: boolean | NodeChosenNodeFunction;
|
893 | label: boolean | NodeChosenLabelFunction;
|
894 | }
|
895 |
|
896 | export interface NodeOptions {
|
897 | borderWidth?: number;
|
898 |
|
899 | borderWidthSelected?: number;
|
900 |
|
901 | brokenImage?: string;
|
902 |
|
903 | color?: string | Color;
|
904 |
|
905 | chosen?: boolean | NodeChosen;
|
906 |
|
907 | opacity?: number;
|
908 |
|
909 | fixed?: boolean | {
|
910 | x?: boolean,
|
911 | y?: boolean,
|
912 | };
|
913 |
|
914 | font?: string | Font;
|
915 |
|
916 | group?: string;
|
917 |
|
918 | hidden?: boolean;
|
919 |
|
920 | icon?: {
|
921 | face?: string,
|
922 | code?: string,
|
923 | size?: number,
|
924 | color?: string,
|
925 | weight?: number | string,
|
926 | };
|
927 |
|
928 | image?: string | Image;
|
929 |
|
930 | imagePadding?: number | ImagePadding;
|
931 |
|
932 | label?: string;
|
933 |
|
934 | labelHighlightBold?: boolean;
|
935 |
|
936 | level?: number;
|
937 |
|
938 | margin?: {
|
939 | top?: number;
|
940 | right?: number;
|
941 | bottom?: number;
|
942 | left?: number;
|
943 | };
|
944 |
|
945 | mass?: number;
|
946 |
|
947 | physics?: boolean;
|
948 |
|
949 | scaling?: OptionsScaling;
|
950 |
|
951 | shadow?: boolean | OptionsShadow;
|
952 |
|
953 | shape?: string;
|
954 |
|
955 | shapeProperties?: {
|
956 | borderDashes?: boolean | number[],
|
957 | borderRadius?: number,
|
958 | interpolation?: boolean,
|
959 | useImageSize?: boolean,
|
960 | useBorderWithImage?: boolean,
|
961 | coordinateOrigin?: string
|
962 | };
|
963 |
|
964 | size?: number;
|
965 |
|
966 | title?: string | HTMLElement;
|
967 |
|
968 | value?: number;
|
969 |
|
970 | |
971 |
|
972 |
|
973 |
|
974 |
|
975 | widthConstraint?: number | boolean | { minimum?: number, maximum?: number };
|
976 |
|
977 | x?: number;
|
978 |
|
979 | y?: number;
|
980 | }
|
981 |
|
982 | export interface EdgeOptions {
|
983 | arrows?: string | {
|
984 | to?: boolean | ArrowHead
|
985 | middle?: boolean | ArrowHead
|
986 | from?: boolean | ArrowHead
|
987 | };
|
988 |
|
989 | arrowStrikethrough?: boolean;
|
990 |
|
991 | chosen?: boolean | {
|
992 | edge?: boolean,
|
993 | label?: boolean,
|
994 | };
|
995 |
|
996 | color?: string | {
|
997 | color?: string,
|
998 | highlight?: string,
|
999 | hover?: string,
|
1000 | inherit?: boolean | string,
|
1001 | opacity?: number,
|
1002 | };
|
1003 |
|
1004 | dashes?: boolean | number[];
|
1005 |
|
1006 | font?: string | Font;
|
1007 |
|
1008 | hidden?: boolean;
|
1009 |
|
1010 | hoverWidth?: number;
|
1011 |
|
1012 | label?: string;
|
1013 |
|
1014 | labelHighlightBold?: boolean;
|
1015 |
|
1016 | length?: number;
|
1017 |
|
1018 | physics?: boolean;
|
1019 |
|
1020 | scaling?: OptionsScaling;
|
1021 |
|
1022 | selectionWidth?: number;
|
1023 |
|
1024 | selfReferenceSize?: number;
|
1025 |
|
1026 | selfReference?: {
|
1027 | size?: number,
|
1028 | angle?: number,
|
1029 | renderBehindTheNode?: boolean
|
1030 | };
|
1031 |
|
1032 | shadow?: boolean | OptionsShadow;
|
1033 |
|
1034 | smooth?: boolean | {
|
1035 | enabled: boolean,
|
1036 | type: string,
|
1037 | forceDirection?: string | boolean,
|
1038 | roundness: number,
|
1039 | };
|
1040 |
|
1041 | title?: string | HTMLElement;
|
1042 |
|
1043 | value?: number;
|
1044 |
|
1045 | width?: number;
|
1046 |
|
1047 | widthConstraint?: number | boolean | {
|
1048 | maximum?: number;
|
1049 | };
|
1050 | }
|
1051 |
|
1052 | export interface ArrowHead {
|
1053 | enabled?: boolean,
|
1054 | imageHeight?: number,
|
1055 | imageWidth?: number,
|
1056 | scaleFactor?: number,
|
1057 | src?: string,
|
1058 | type?: string;
|
1059 | }
|
1060 |
|
1061 | export interface Font {
|
1062 | color?: string,
|
1063 | size?: number,
|
1064 | face?: string,
|
1065 | background?: string,
|
1066 | strokeWidth?: number,
|
1067 | strokeColor?: string,
|
1068 | align?: string,
|
1069 | vadjust?: number,
|
1070 | multi?: boolean | string,
|
1071 | bold?: string | FontStyles,
|
1072 | ital?: string | FontStyles,
|
1073 | boldital?: string | FontStyles,
|
1074 | mono?: string | FontStyles,
|
1075 | }
|
1076 |
|
1077 | export interface FontStyles {
|
1078 | color?: string;
|
1079 | size?: number;
|
1080 | face?: string;
|
1081 | mod?: string;
|
1082 | vadjust?: number;
|
1083 | }
|
1084 |
|
1085 | export interface OptionsScaling {
|
1086 | min?: number;
|
1087 | max?: number;
|
1088 | label?: boolean | {
|
1089 | enabled?: boolean,
|
1090 | min?: number,
|
1091 | max?: number,
|
1092 | maxVisible?: number,
|
1093 | drawThreshold?: number
|
1094 | };
|
1095 | customScalingFunction?(min?: number, max?: number, total?: number, value?: number): number;
|
1096 | }
|
1097 |
|
1098 | export interface OptionsShadow {
|
1099 | enabled?: boolean;
|
1100 | color?: string;
|
1101 | size?: number;
|
1102 | x?: number;
|
1103 | y?: number;
|
1104 | }
|