Remove padding from diagram

67 views
Skip to first unread message

Ronald Naber

unread,
Jul 25, 2015, 2:53:16 AM7/25/15
to blockdiag-discuss
Hi,

How could I remove the padding in the picture generated by blockdiag's SVG function? I have been going through the source code but cannot follow yet how the program flow is exactly. It probably has to do with SVG's viewbox command, but I don't know how to change the viewbox; I can only turn it off.

The reason I want to remove the padding is that I integrate the picture into a PyQt application, which already has its own padding. My code for this is below. I tried adding options to the drawer initiation command, but it had no effect so far except for noviewbox.

Cheers,
Ronald



        hbox = QtGui.QHBoxLayout()


        tree = parser.parse_string(curr_diagram)


        diagram = builder.ScreenNodeBuilder.build(tree)


        draw = drawer.DiagramDraw('SVG', diagram, filename="")


        draw.draw()


        svg_string = draw.save()




        svg_widget = QtSvg.QSvgWidget()


        svg_widget.load(QtCore.QString(svg_string).toLocal8Bit())


 


        hbox.addWidget(svg_widget)


        hbox.addStretch(1)            


        vbox.addLayout(hbox)



Ronald Naber

unread,
Jul 29, 2015, 11:20:03 AM7/29/15
to blockdiag-discuss, rcgn...@gmail.com
For future reference: with the 'node_width', 'node_height', 'span_width' and 'span_height' settings in the diagram definition you can change the padding around the diagram, but it changes the diagram as well.


On Saturday, 25 July 2015 08:53:16 UTC+2, Ronald Naber wrote:
Hi,

How could I remove the padding in the picture generated by blockdiag's SVG function? I have been going through the source code but cannot follow yet how the program flow is exactly. It probably has to do with SVG's viewbox command, but I don't know how to change the viewbox; I can only turn it off.

The reason I want to remove the padding is that I integrate the picture into a PyQt application, which already has its own padding. My code for this is below. I tried adding options to the drawer initiation command, but it had no effect so far except for noviewbox.

Cheers,
Ronald


...

Komiya Takeshi

unread,
Jul 30, 2015, 10:46:55 AM7/30/15
to blockdia...@googlegroups.com, rcgn...@gmail.com
Hi,

Sorry, there is no way to change padding arround diagram.
For now, the padding is determined by span_width and span_height.


Thanks,

Takeshi KOMIYA
> --
> このメールは Google グループのグループ「blockdiag-discuss」に登録しているユーザーに送られています。
> このグループから退会し、グループからのメールの配信を停止するには
> blockdiag-disc...@googlegroups.com にメールを送信してください。
> その他のオプションについては https://groups.google.com/d/optout にアクセスしてください。
Reply all
Reply to author
Forward
0 new messages