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
| #!/usr/bin/perl
use strict;
use warnings;
use GraphViz;
my $graph = GraphViz->new(
node => {
shape => 'box',
fontname => 'arial',
fontsize => '14',
shape => 'record'
}
);
$graph->add_node(
'CR_central',
label => 'aaaaa \n bbb \n cccc \n ddddd \n eeeee',
color => 'orangered1',
style => 'bold',
);
$graph->add_node('ffff');
$graph->add_node('llll');
$graph->add_node(
'ffff2',
label => 'fffff \n gggg \n cccc \n \hhhh \n tttt',
color => 'limegreen'
);
$graph->add_node(
'llll2',
label => 'llll \n bbbb \n cccc \n bbbb \n jjjj',
color => 'limegreen'
);
$graph->add_edge(
'llll' => 'CR_central',
'color' => 'limegreen',
);
$graph->add_edge(
'CR_central' => 'ffff',
'color' => 'limegreen',
);
# Creation d'une image
my $image_file = "$input_path/graphiques/$CR_id";
open( my $fh_image, '>', $image_file ) or die("Impossible de creer l'image $image_file\n");
binmode $fh_image;
print {$fh_image} $graph->as_png;
close($fh_image); |
Partager