Browse Source

graph: add date of birth to label

Fabian Peter Hammerle 4 years ago
parent
commit
7f75a6d737
2 changed files with 4 additions and 2 deletions
  1. 2 2
      tests/persons/digraph.gz
  2. 2 0
      yamily/_graphviz.py

+ 2 - 2
tests/persons/digraph.gz

@@ -1,7 +1,7 @@
 digraph yamily {
 	{
 		rank=same
-		"erika-mustermann" [label="Erika Mustermann" shape=box]
+		"erika-mustermann" [label="Erika Mustermann\n*1957-08-12" shape=box]
 		"thomas-mustermann" [label="thomas-mustermann" shape=box]
 		"relation-erika-mustermann-thomas-mustermann" [shape=point width=0]
 		"erika-mustermann" -> "relation-erika-mustermann-thomas-mustermann" [arrowhead=none constraint=False]
@@ -25,7 +25,7 @@ digraph yamily {
 	}
 	{
 		rank=same
-		"max-mustermann" [label="Max Mustermann" shape=box]
+		"max-mustermann" [label="Max Mustermann\n*1976-02-01" shape=box]
 	}
 	"alice-grandmother" -> "alice-father"
 	"relation-alice-father-alice-mother" -> alice

+ 2 - 0
yamily/_graphviz.py

@@ -7,6 +7,8 @@ from yamily import Person, PersonCollection
 
 def _add_person_node(graph: graphviz.dot.Digraph, person: Person) -> None:
     label = person.name or person.identifier
+    if person.birth_date is not None:
+        label += r"\n*{}".format(person.birth_date.isoformat())
     graph.node(person.identifier, label=label, shape="box")