[reportlab-users] Line wrapping legend

Anonymous Coward the_inner_voices_are_coming at yahoo.co.uk
Thu Oct 27 06:48:54 EDT 2011


Hi,

I'm new to using ReportLab and hoping someone could help me with a problem or two I'm having. The first is that I'm using reportlab.graphics.charts.legends.LineLegend to provide a legend for the chart I'm drawing which is rather nice until I use too many series resulting in the legend being drawn off the page since it doesn't line wrap. Is there a way to have the legend automatically line wrap? (Is this behaviour called flowable in ReportLab?)

The second niggle I have is I'm wondering if there is a way to use charts and the legend without having to provide the list of colours yourself? Currently I'm having to do something like this due to large number of series:

lc = HorizontalLineChart()
leg = LineLegend()


for i, item in enumerate(gen_colours(len(data))):
            lc.lines[i].strokeColor = item

leg.colorNamePairs = [(lc.lines[i].strokeColor, series[i]) for i in xrange(len(lc.data))]

Where gen_colours is a function that attempts split the range 000000-FFFFFF  (with some offset to exclude white) into the number of chunks specified by the length.


Is this the way correct way? Is the something more elegant using an in-built feature?


I've tried reading the examples, documentation and searching through Google but not been able to turn up anything, so any advice you guys can provide would be extremely helpful.

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


More information about the reportlab-users mailing list