How to limit the width/height of svg in pygal

1.5k views Asked by At

How do I limit the width/height of a pygal generated SVG? I'm currently doing it via img tags, but is there a better way?

<img src="http://localhost/images/Store.Diapers.svg" width=800 height=600/>
2

There are 2 answers

0
Brongadier On BEST ANSWER

In case it helps someone, it's as simple as specifying width=1000, height=800 in the parameters:

chart = pygal.StackedLine(width=1000, height=800)
3
Matthijs Otterloo On

You can use a div for that....

Place the following in your code:

<div class="parent">    
   <img src="http://localhost/images/Store.Diapers.svg">    
</div>    

And place this in your .css file

.imagebox {
width: 42px; /*This is the height of the div class it self */
height: 42px;
}

/* This changes the height of any image with the <img> tag within the div class*/
.imagebox img {
height: 800px;
width: 600px;
}