k102
k102

Reputation: 8079

graphviz svg autoresize

I've got a graph made by graphviz circo (or dot, i guess in this issue there's no difference) in svg format and i'd like this image to be resized automaticly. I know it can be done if i set

<svg width="100%" height="100%"...

but i can't realize how to make circo to do this.

The graph file for circo is generated in php like this:

$graph = "digraph structs {
node [shape=record, URL=\"http://localhost/gr.php?object=\N\"];
overlap = prism;
size=\"50,50\";`

I've tried size=\"100%,100%\"; but circo translates it into <svg width="3600pt" height="2946pt". So, how can i make circo put 100% in there? Thanks!

Upvotes: 3

Views: 1432

Answers (1)

k102
k102

Reputation: 8079

the only thing worked for me is

$svg = file('circo.svg');
$svg[6] = preg_replace("/\d+pt/","100%",$svg[6]); //the line number is fixed
foreach($svg as $line)
{
    echo "$line";
}

maybe it will help someone =)

Upvotes: 3

Related Questions