@@ -4,17 +4,17 @@ description: Discover the properties of directives in Memgraph through our compr
4
4
---
5
5
6
6
import {CommunityLinks } from ' /components/social-card/CommunityLinks'
7
-
7
+ import { Callout } from ' nextra/components '
8
8
9
9
# Directive properties
10
10
11
- Graph Style Script currently has four directives:
11
+ Graph Style Script currently has these directives:
12
12
13
13
* [ ` @NodeStyle ` directive] ( #nodestyle-directive ) - for defining the visual style of graph nodes.
14
14
* [ ` @EdgeStyle ` directive] ( #edgestyle-directive ) - for defining the visual style of graph relationships.
15
15
* [ ` @ViewStyle ` directive] ( #viewstyle-directive ) - for defining the general graph style properties.
16
16
* [ ` @ViewStyle.Map ` directive] ( #viewstylemap-directive ) - for defining the graph style properties when map
17
- is in the background.
17
+ is in the background. ( ** DEPRECATED in Lab 3.4 ** )
18
18
19
19
Each directive includes a set of configurable properties, along with their
20
20
expected data types.
@@ -425,56 +425,97 @@ Example:
425
425
## ` @ViewStyle ` directive
426
426
427
427
` @ViewStyle ` directive is used for defining style properties of a general
428
- graph view: link distance, view, physics, repel force, etc. You can read more about
429
- each property in the following sections.
428
+ graph view: view type, link distance, view, physics, repel force, etc. It is also
429
+ possible to use a predicate expression which acts as a filter to apply
430
+ the defined properties to the final directive output.
430
431
431
432
Here is the list of all properties that can be defined in the ` @ViewStyle ` directive,
432
433
along with their expected types.
433
434
434
- ### ` collision-radius: number `
435
+ ### ` force- collision-radius: number`
435
436
436
437
Sets the margin radius for each node from its centre. If node ` size ` is ` 10 ` and
437
- ` collision-radius ` is set to ` 20 ` , it means there will be ` 10 ` spaces left around each
438
+ ` force- collision-radius` is set to ` 20 ` , it means there will be ` 10 ` spaces left around each
438
439
node. No other node can be in that space.
439
440
440
- The default ` collision-radius ` is ` 15 ` .
441
+ The default ` force- collision-radius` is ` 15 ` .
441
442
442
443
Example:
443
444
444
- - ` collision-radius: 15 ` sets the margin radius for each node from its centre to ` 15 ` .
445
+ - ` force- collision-radius: 15` sets the margin radius for each node from its centre to ` 15 ` .
445
446
446
- ### ` repel-force: number `
447
+ ### ` force- repel-force: number`
447
448
448
449
Sets the strength of repel force between all nodes. If positive, it adds a force that
449
450
moves nodes away from each other, if negative, it moves nodes towards each other.
450
451
451
- The default ` repel-force ` is ` -100 ` .
452
+ The default ` force- repel-force` is ` -100 ` .
452
453
453
454
Example:
454
455
455
- - ` repel-force: -100 ` sets the repel force between all nodes to ` -100 ` .
456
+ - ` force- repel-force: -100` sets the repel force between all nodes to ` -100 ` .
456
457
457
- ### ` link-distance: number `
458
+ ### ` force- link-distance: number`
458
459
459
460
Sets the minimum required distance between two connected nodes from their centres.
460
461
461
- The default ` link-distance ` is ` 30 ` . If node sizes are ` 20 ` and link distance is ` 30 ` ,
462
+ The default ` force- link-distance` is ` 30 ` . If node sizes are ` 20 ` and link distance is ` 30 ` ,
462
463
nodes might overlap because the minimum distance from one node centre to another is
463
464
` 20 + 20 = 40 ` .
464
465
465
466
Example:
466
467
467
- - ` link-distance: 30 ` sets the minimum required distance to ` 30 ` .
468
+ - ` force- link-distance: 30` sets the minimum required distance to ` 30 ` .
468
469
469
- ### ` physics-enabled: boolean `
470
+ ### ` force- physics-enabled: boolean`
470
471
471
472
Enables or disables physics which is a real-time simulation for graph node positions.
472
473
When physics is enabled, the graph is not static anymore.
473
474
474
475
Examples:
475
476
476
- - ` physics-enabled: True ` enables the physics.
477
- - ` physics-enabled: Greater(NodeCount(graph), 100) ` enables the physics for graphs with more than 100 nodes.
477
+ - ` force-physics-enabled: True ` enables the physics.
478
+ - ` force-physics-enabled: Greater(NodeCount(graph), 100) ` enables the physics for graphs with more than 100 nodes.
479
+
480
+ ### ` tree-orientation: "horizontal" | "vertical" `
481
+
482
+ Determines the direction in which the ` "tree" ` layout is rendered.
483
+
484
+ - ` "vertical" ` (default): Renders the tree from top to bottom, with parent nodes above their children.
485
+ - ` "horizontal" ` : Renders the tree from left to right, with parent nodes to the left of their children.
486
+
487
+ Example:
488
+
489
+ - ` tree-orientation: "horizontal" ` lays out the tree from left to right.
490
+
491
+ ### ` tree-node-gap: number `
492
+
493
+ Specifies the spacing between sibling nodes within the same depth
494
+ level in the ` "tree" ` layout.
495
+ This affects the horizontal or vertical distance between nodes,
496
+ depending on the tree orientation.
497
+
498
+ Example:
499
+
500
+ - ` tree-node-gap: 50 ` increases the spacing between nodes on the same level.
501
+
502
+ ### ` tree-level-gap: number `
503
+
504
+ Sets the spacing between different depth levels in the ` "tree" ` layout.
505
+ This controls the vertical or horizontal distance between parent and
506
+ child nodes based on the tree orientation.
507
+
508
+ Example:
509
+
510
+ - ` tree-level-gap: 100 ` increases the space between levels in the tree.
511
+
512
+ ### ` map-tile-layer: "detailed" | "light" | "dark" | "basic" | "satellite" `
513
+
514
+ Sets the map tile for the map background. The default map tile is ` "light" ` .
515
+
516
+ Examples:
517
+
518
+ - ` map-tile-layer: "dark" ` sets the map tile to be type ` "dark" ` .
478
519
479
520
### ` background-color: Color `
480
521
@@ -485,33 +526,116 @@ Examples:
485
526
- ` background-color: #DDDDDD ` sets the background color of the canvas to light gray.
486
527
- ` background-color: black ` sets the background color of the canvas to black.
487
528
488
- ### ` view: string: "default" | "map" `
529
+ ### ` view: string: "default" | "map" | "force" | "tree" `
530
+
531
+ Sets the current graph view.
532
+
533
+ - ` "default" ` automatically selects between ` "force" ` and ` "map" ` views based on the available graph data.
534
+ - ` "map" ` displays the graph over a geographical map. Each node must include ` latitude ` and ` longitude ` to be positioned correctly.
535
+ - ` "force" ` renders a force-directed layout, placing nodes on a canvas with repelling forces between them.
536
+ - ` "tree" ` arranges the nodes in a hierarchical layout, displaying the structure from root to leaf nodes.
537
+
538
+ The default value of ` view ` is ` "default" ` .
539
+
540
+ Examples:
541
+
542
+ - ` view: "default" ` uses automatic view selection.
543
+ - ` view: "map" ` sets the view to a map layout, which will only render if at least one node includes both ` latitude ` and ` longitude ` .
544
+
545
+ ### ` collision-radius: number `
546
+
547
+ <Callout type = " warning" >
548
+
549
+ ** DEPRECATED in Lab 3.4** : Use ` force-collision-radius ` instead.
550
+
551
+ </Callout >
552
+
553
+ Sets the margin radius for each node from its centre. If node ` size ` is ` 10 ` and
554
+ ` collision-radius ` is set to ` 20 ` , it means there will be ` 10 ` spaces left around each
555
+ node. No other node can be in that space.
556
+
557
+ The default ` collision-radius ` is ` 15 ` .
558
+
559
+ Example:
560
+
561
+ - ` collision-radius: 15 ` sets the margin radius for each node from its centre to ` 15 ` .
562
+
563
+ ### ` repel-force: number `
564
+
565
+ <Callout type = " warning" >
566
+
567
+ ** DEPRECATED in Lab 3.4** : Use ` force-repel-force ` instead.
568
+
569
+ </Callout >
570
+
571
+ Sets the strength of repel force between all nodes. If positive, it adds a force that
572
+ moves nodes away from each other, if negative, it moves nodes towards each other.
573
+
574
+ The default ` repel-force ` is ` -100 ` .
575
+
576
+ Example:
577
+
578
+ - ` repel-force: -100 ` sets the repel force between all nodes to ` -100 ` .
579
+
580
+ ### ` link-distance: number `
581
+
582
+ <Callout type = " warning" >
583
+
584
+ ** DEPRECATED in Lab 3.4** : Use ` force-link-distance ` instead.
489
585
490
- Sets the current graph view that can be either ` "default" ` or ` "map" ` . The ` "default" ` view is
491
- a graph visualization on a blank background. The ` "map" ` view is a graph visualization with a map
492
- as a background where each node needs to provide ` latitude ` and ` longitude ` to be positioned
493
- on the map.
586
+ </Callout >
494
587
495
- The default ` view ` is ` "default" ` .
588
+ Sets the minimum required distance between two connected nodes from their centres.
589
+
590
+ The default ` link-distance ` is ` 30 ` . If node sizes are ` 20 ` and link distance is ` 30 ` ,
591
+ nodes might overlap because the minimum distance from one node centre to another is
592
+ ` 20 + 20 = 40 ` .
593
+
594
+ Example:
595
+
596
+ - ` link-distance: 30 ` sets the minimum required distance to ` 30 ` .
597
+
598
+ ### ` physics-enabled: boolean `
599
+
600
+ <Callout type = " warning" >
601
+
602
+ ** DEPRECATED in Lab 3.4** : Use ` force-physics-enabled ` instead.
603
+
604
+ </Callout >
605
+
606
+ Enables or disables physics which is a real-time simulation for graph node positions.
607
+ When physics is enabled, the graph is not static anymore.
496
608
497
609
Examples:
498
610
499
- - ` view: "default" ` sets the view to the default view.
500
- - ` view: "map" ` sets the view to the map view that will be shown only if at least one node has
501
- required geo information: ` latitude ` and ` longitude ` .
611
+ - ` physics-enabled: True ` enables the physics.
612
+ - ` physics-enabled: Greater(NodeCount(graph), 100) ` enables the physics for graphs with more than 100 nodes.
502
613
503
614
## ` @ViewStyle.Map ` directive
504
615
616
+ <Callout type = " warning" >
617
+
618
+ ` @ViewStyle.Map ` is deprecated in Lab 3.4. Check updated directive ` @ViewStyle ` to
619
+ set up map view and map tile layer.
620
+
621
+ </Callout >
622
+
505
623
` @ViewStyle.Map ` directive is a subset of ` @ViewStyle ` because it defines
506
- additional style properties for a graph view when there is a map background.
507
- Style properties of the ` @ViewStyle.Map ` directive are used to style the
624
+ additional style properties for a graph view when there is a map background.
625
+ Style properties of the ` @ViewStyle.Map ` directive are used to style the
508
626
background map.
509
627
510
628
Here is the list of all properties that can be defined in the ` @ViewStyle.Map `
511
629
directive, along with their expected types.
512
630
513
631
### ` tile-layer: string: "detailed" | "light" | "dark" | "basic" | "satellite" `
514
632
633
+ <Callout type = " warning" >
634
+
635
+ ** DEPRECATED in Lab 3.4** : Use ` @ViewStyle { map-tile-layer } ` instead.
636
+
637
+ </Callout >
638
+
515
639
Sets the map tile for the map background. The default map tile is ` "light" ` .
516
640
517
641
Examples:
0 commit comments