如何限制pygal中svg的宽度/高度

时间:2014-11-13 18:52:26

标签: python pygal

如何限制pygal生成的SVG的宽度/高度?我目前通过img代码进行此操作,但有更好的方法吗?

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

2 个答案:

答案 0 :(得分:3)

如果它对某人有帮助,就像在参数中指定width = 1000,height = 800一样简单:

chart = pygal.StackedLine(width=1000, height=800)

答案 1 :(得分:1)

你可以使用div ....

将以下内容放入您的代码中:

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

并将其放在.css文件中

.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;
}