开发者

graphviz svg autoresize

开发者 https://www.devze.com 2023-03-05 15:02 出处:网络
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'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 pu开发者_如何学Pythont 100% in there? Thanks!


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 =)

0

精彩评论

暂无评论...
验证码 换一张
取 消