[reportlab-users] Piechart labels

Nizam Sayeed ibnameen at gmail.com
Wed Oct 10 13:24:48 EDT 2007


Robin,

Thanks for the sample code! That's exactly what I was looking for.

Best regards,

Nizam

On 10/10/07, Robin Becker <robin at reportlab.com> wrote:

>

> Simon Riek wrote:

> > I am experimenting with pie-charts also atm and tried to work with

> > pointers but when I set the pointerLabelMode to not None, I get very

> weird

> > results. The piechart is deformed and the labels are drawn all over the

> > place with no obvious rules for placement (doesn't matter if

> simpleLabels

> > or not, nor does checkLabelOverlap seem to matter). Does anyone have a

> > working example for pointers?

> >

> > Thanks in advance

> >

> > Simon

> ......

> not ideal, but working; this stuff was a nightmare and still doesn't work

> all

> that well.

>

> ######################

> from reportlab.graphics.charts.piecharts import Pie

> from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin

>

> class Drawing_001(_DrawingEditorMixin,Drawing):

> def __init__(self,width=400,height=200,*args,**kw):

> apply(Drawing.__init__,(self,width,height)+args,kw)

> self._add(self,Pie(),name='pie',validate=None,desc=None)

> self.pie.pointerLabelMode='LeftRight'

> self.pie.labels = ['a','b','c','d']

> self.pie.sameRadii = True

> self.pie.pointerLabelMode='LeftAndRight'

> self.pie.slices.labelRadius = 1.2

> self.pie.labels = ['a', 'b', 'c', 'deee']

> self.pie.simpleLabels = 0

> self.pie.slices.label_pointer_elbowLength = 5

> self.pie.slices.label_pointer_edgePad = 5

> self.pie.slices.label_pointer_piePad = 4

> self.pie.slices.label_textAnchor='boxauto'

> self.pie.width = 200

> self.pie.height = 200

> self.pie.pointerLabelMode='LeftRight'

>

> if __name__=="__main__": #NORUNTESTS

> Drawing_001().save(formats=['pdf'],outDir='.',fnRoot=None)

> ######################

> --

> Robin Becker

> _______________________________________________

> reportlab-users mailing list

> reportlab-users at reportlab.com

> http://two.pairlist.net/mailman/listinfo/reportlab-users

>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20071010/d8bf239a/attachment.html>


More information about the reportlab-users mailing list