Comment produire un graphique relationnel

From Gramps
Revision as of 10:10, 12 July 2009 by Romjerome (talk | contribs)
Jump to: navigation, search


Ceci est un tutoriel pour réaliser un graphique relationnel (pouvant être les ascendants, descendants, des individus filtés, toute la base !) avec GRAMPS-3.0.x et un greffon (plugin) basé sur GraphViz.

Un exemple de graphique

Ce rapport est généré avec graphviz, ainsi vous avez besoin d'installer graphviz (sous linux, utilisez votre gestionnaire de paquets).

Avant de démarrer

GRAMPS peut produire des graphiques, mais pour les voir, vous avez besoin d'autres programmes. Nous vous recommandons :

  • Graphviz : nécessaire pour les graphiques relationnels.
  • Inkscape : pour voir ou éditer les graphiques 'svg'.
  • openoffice, koffice : pour voir et éditer les documents 'odt'.

Filtres : les personnes devant être imprimées ?

Qu'est ce que les filtres ?

Dans GRAMPS vous pouvez définir des filtres pour une sélection d'individus, voir les filtres. Dans la plupart des rapports, chaque filtre personnel que vous avez créé sera disponible, ainsi que les 'filtres standards' sur les descendants et ascendants. Ces derniers sont dépendant de la personne active lorsque que vous appelez le rapport.

Combien d'individus ?

Votre filtre peut contenir un nombre très important d'individus. De ce fait imprimer ou voir un très grand graphique peut être très problématique selon la capacité et la configuration de votre ordinateur.

Exemple 1-A: un graphique des descendants

Un graphique des descendants, cliquez pour les détails

Téléchargez example.gramps (clic droit 'Enregistrer sous ...'), créez une nouvelle base de données dans GRAMPS, et importez le fichier example.gramps.

Si ce n'est pas le cas, définissez la personne active : Garner, Lewis Anderson.

Pour générer un graphique des descendants avec le rapport relationnel, choisissez depuis le menu Rapports -> Graphiques -> Graphique relationnel...

Dans le dialogue, définissez le format .png et choisissez dans les onglets disponibles :

  1. Options Papier-> Taille : selon les nombre d'individus, choisissez la taille personnalisée (définir la hauteur et la largeur avec des grands nombres)
  2. Options du rapport-> Filtre : Descendants de Garner, Lewis Andersson
  3. Optons de mise en page-> Aspect : taille minimale

(Si vous avez des difficultés pour saisir une taille dans le dialogue. Une alternative étant d'utiliser le code graphviz de l'exemple 3, ci dessous.)

Le résultat (avec Gramps 2.2.7) est visible à la droite de l'écran. Vous pouvez utiliser la fonction imprimer liée à votre visualiseur d'image et votre imprimante (vérifiez la valeur DPI de votre fichier png !), ou vous pouvez utiliser cette image sur un site internet pour la partager. Dans ce dernier cas, vous pouvez également jetter un oeil sur Make flash plugin from a png, pour rendre le graphique plus 'navigable'.

Dans l'image, vous voyez les hommes en bleu, et les femmes en rose. Les cercles jaunes indiquent un noeud familial permettant l'impression des données de mariage (si connues). Vous pouvez ignorer les noeuds familiaux en désélectionnant l'option Afficher les noeuds familiaux dans les Options de Graphviz.

Example 1-B: a chart with ancestors

Fig. An ancestor chart. For the detailed image, click here (853kb!)


Download and open the example.gramps file as in Example 1


Set Warner, Carl Thomas to be the active person.

Repeat the process in Example 1-a, but choose the filter Ancestors of Warner, Carl Thomas this time.

You can see the result to the left.


This is already an extremely large graph.



It can only be readily viewed in a good image viewer.

For printing you need to resort to printing on several pages, or you need access to a large plotter.

Example 2: A chart with ancestors, descendants and their families

Fig. A large chart. For the detailed image, click here (363kb!)

Note: This example uses filters. See Examples of filters for an introductory example.



Open the file example.gramps and select Cristiansen, Frances as the active person.

First we create a helper filter: Open the filter editor and create a new filter, called Frances1. The filter should contain the rules

  • Ancestors of <person> choose Christiansen, Frances and check inclusive.
  • Descendants of <person> chose Christiansen, Frances



Make sure that "At least one rule must be fulfilled" is chosen, so that we get both ancestors and descendants!


Now we create the filter we will actually use for the report. It will be based on the previous filter: Create a new filter, called Frances2. This filter should contain the rules:

  • People matching the filter, choose Frances1
  • Parents of filter Frances1
  • Siblings of filter Frances1
  • Spouses of filter Frances1



Now close the filter editor, and follow the instructions given in Examples 1a and 1b, but this time choosing the filter Frances2 in the Report Options tab.




The result is visible to the right (363kb, large file !)

Example 3, Generating the graph by using the Graphviz command line tool

Gnome-important.png
Note: The current stable version of Graphviz (v2.12) has a bug. In order to correctly display the family nodes (yellow balloons), all occurrences of the word ellipse should be changed to egg (see bug report 1078).

Preparation with GRAMPS

Use this only as a way to work around problems like setting the paper size.

In the menu, select Reports -> Code Generators -> Relationship graph....

Choose the filter you want to use, and set also as many of the other options as possible to the desired values (as explained in Example 1-A), but the format should be "Graphviz (dot)". Click Ok. You should now have a file of type ".dot". This file is a text file, so it can be opened in any text-editor.

Manual changes

The dot file is a text file with a well explained structure, for extra info: www.graphviz.org

digraph GRAMPS_graph
{
 bgcolor=white;
 center="true"; 
 charset="utf-8";
 concentrate="false";
 dpi="75";
 graph [fontsize=12];

...

then the actual GRAMPS data are shown:

I3493 [ shape="box" fillcolor="pink" style="solid,filled" label="Blancke, Charlotte\n(1801)" ];

... You can optimize the layout by making changes in the file.

  • For paper size: look for the "page" (paper size) and "size" (area of paper to use), and change these to some large values. This is important as otherwise the figure will be wrongly scaled giving bad picture quality (eg unreadable text).
  • You can also change the font by adding a font family. Look for the lines
node [style=filled fontsize="12"];
and change that into eg
node [style=filled fontsize="12" fontname="Sans"];
to use the Sans font. On the command line you will see which ttf font Graphviz finds on your PC (using the verbose flag, see below).

Generation of the Image

Save the modified file under the name report.dot, and run the command

dot -Tpng -oreport.png report.dot

This should use the graphviz "dot" tool to generate the .png file containing the report.

To see information messages (like font) use the -v flag. You can also output other image formats, eg, for jpeg with verbose output:

dot -Tjpg -oreport.jpg report.dot -v

...

Activated plugin library: libgvplugin_pango.so.5
Using textlayout: textlayout:cairo
Activated plugin library: libgvplugin_dot_layout.so.5
Using layout: dot:dot_layout
Using render: cairo:cairo
Activated plugin library: libgvplugin_gd.so.5
Using device: jpg:cairo:gd
The plugin configuration file:	/usr/lib/graphviz/config4 was successfully loaded.
   render	:  cairo dot fig gd map ps svg vml vrml xdot
   layout	:  circo dot fdp neato nop nop1 nop2 twopi
   textlayout	:  textlayout
   device	:  canon cmap cmapx cmapx_np dia dot fig gd gd2 gif hpgl imap imap_np ismap jpe jpeg jpg mif mp pcl pdf pic plain plain-ext png ps ps2 svg svgz vml vmlz vrml vtx wbmp xdot xlib
   loadimage	:  (lib) gd gd2 gif jpe jpeg jpg png ps
dot: fontname "Times-Roman" resolved to: "Times New Roman, Normal" /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf
network simplex: 11 nodes 10 edges 0 iter 0.00 sec
mincross: pass 0 iter 0 trying 0 cur_cross 0 best_cross 0
mincross GRAMPS_graph: 0 crossings, 0.00 secs.
network simplex: 23 nodes 37 edges 7 iter 0.00 sec
routesplines: 10 edges, 30 boxes 0.00 sec
Using render: cairo:cairo
Using device: jpg:cairo:gd

...

Troubleshooting

  • If you encounter bad fonts (missing characters) or wrong fontsizes, see Example 3 on how you can set the font yourself.
  • If you have a bad resolution of png, eg unreadable text, this is probably because you have set a paper size which is to small. See Exampe 1-A: set the papersize of number of pages to a high number, but select in Layout Options, in Aspect ratio: automatically use optimal number pages, or use minimal size
Gnome-important.png
Reports and custom IDs

After a GEDCOM import, your database can use some non-standard IDs (ie. 123I or 456U not set on Edit --> Preferences --> Identifiants ID). If generated reports do not properly display data, then try Reorder GRAMPS IDs tool (Tools-->Database Processing-->Reorder GRAMPS IDs).

Further cool things to do

  • You can make descendant charts and add them to the media gallery of the person. Like that, the chart is available from the website.
  • offer a chart on your website as a flash relationship graph, enabling zooming, moving, ... over your data or just use SVG for Firefox and Opera, see DenominoViso

Want to help developing ?

If you go through the dot specifications, you will note that more can be done with graphics. If you have programming skills you can add some functionality:

  • more/better text in the boxes: what text and how to organize it?
  • coloring. See the Familylines plugin: a color per family, for specific relations, for the central person, ...

Lien vers le manuel

Par ailleurs, jettez un oeil sur le graphique relationnel.