[reportlab-users] Graphics and titles

Knud Riishøjgård knudriis at indicator.dk
Wed Jul 6 09:48:08 EDT 2005


Another approach to solving your problem could be: Use the KeepTogether 
flowable.


completelistofparagraphs = []
do this for each pie/chart:
   listofparagraphs = []
   listofparagraphs.append(Paragraph('Header', style))
   drawing = shapes.Drawing(width, height)
   pie = Pie() #any other kind of chart
   #do a lot w pie :-)
   drawing.add(pie)
   listofparagraphs.append(drawing)
   completelistofparagraphs.append(KeepTogether(listofparagraphs))

I hope the above makes sense - I'm using KeepTogethers a lot.

Best regards
Knud Riishojgaard



JP Glutting wrote:
> Ok, I am trying a workaround for this thing, and it is giving me some 
> odd errors. I tried breaking the string up into smaller strings, and 
> printing each one seperately (with an offset, but I never get to the 
> part where I calibrate that). When I do this, i get this error:
> 
> AssertionError: expected one category name but foud 6 in axis.
>    categories = ['1. survey question']
> 
> Any idea what is going on here? It looks to me like the strings i am 
> putting into this drawing are being interpreted as tick labels (almost 
> certainly, because the function that returns the error is called 
> makeTickLabels). I don't understand why that is - tha ta single string 
> can be priinted, but multiple strings are intepreted as labels.
> 
> Thanks!
> 
> JP
> 
> 
> JP Glutting wrote:
> 
>> No, no problem. I found it - just a little glitch. I only imported 
>> Drawing from reportlab.graphics.shapes when I originally wrote this 
>> (can't remember why), so I had to go tweak the imports, that is all.
>>
>> It looks really nice. The only problem is that I have some titles I 
>> want to wrap (multi line). I am digging for tricks on doing that, but 
>> if you happen to know offhand, that would be great.
>>
>> Thanks again!
>> JP
>>
>> Andy Robinson wrote:
>>
>>>> It does not seem to be in platypus, pdfgen or pdfbase.
>>>>
>>>> Or do you mean PDFString?
>>>>
>>>>   
>>>
>>>
>>>
>>> reportlab.graphics.shapes.String:
>>>
>>> class String(Shape):
>>>    """Not checked against the spec, just a way to make something work.
>>>    Can be anchored left, middle or end."""
>>>
>>>    # to do.
>>>    _attrMap = AttrMap(
>>>        x = AttrMapValue(isNumber),
>>>        y = AttrMapValue(isNumber),
>>>        text = AttrMapValue(isString),
>>>        fontName = AttrMapValue(None),
>>>        fontSize = AttrMapValue(isNumber),
>>>        fillColor = AttrMapValue(isColorOrNone),
>>>        textAnchor = AttrMapValue(isTextAnchor),
>>>        )
>>>
>>>
>>> When you said you were doign charts, I presumed using the
>>> numerous Drawing and chart-related Shape objects in reportlab/graphics;
>>> If this is not the case and you are drawing your own with pdfgen, 
>>> then you have a large new subpackage to explore.  (it's been there 
>>> for 4 years!)  The graphics guide and reference
>>> are probably the starting point:
>>>
>>>   http://www.reportlab.com/docs/graphguide.pdf
>>>  http://www.reportlab.com/docs/graphics_reference.pdf
>>>
>>>
>>>
>>> Best Regards,
>>>
>>>
>>> Andy Robinson
>>> _______________________________________________
>>> reportlab-users mailing list
>>> reportlab-users at reportlab.com
>>> http://two.pairlist.net/mailman/listinfo/reportlab-users
>>>  
>>>
>> __
> 
> 
> 
> _______________________________________________
> 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