[reportlab-users] Piechart labels

Simon Riek simon at newsnost.de
Wed Oct 10 14:17:24 EDT 2007


Thank you!

On Wed, October 10, 2007 6:17 pm, Robin Becker 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

>






More information about the reportlab-users mailing list