[reportlab-users] Bar chart category axes labels over multiple lines?

Robin Becker robin at reportlab.com
Mon Oct 4 06:16:48 EDT 2010


On 03/10/2010 14:05, Dinu Gherman wrote:

> Hi,

>

> I'm using RL again to generate some more sophisticated bar charts

> and find the category axes labels cannot span multiple lines by

> simple putting "\n" in them or by some other magic.

>

> I assume that hasn't changed over the last releases, has it? Other-

> wise it would be a most welcome surprise...

>

> Regards,

>

> Dinu

........

I just tried this for a simple chart and it seems to work for me


from reportlab.graphics.shapes import Drawing
from reportlab.graphics.charts.barcharts import VerticalBarChart

class TVBC(Drawing):
def __init__(self,width=400,height=200,*args,**kw):
apply(Drawing.__init__,(self,width,height)+args,kw)
self.add(VerticalBarChart(),name='chart')
self.chart.y = 40
self.chart.categoryAxis.categoryNames = ['a\n-\nc','b']

if __name__=="__main__": #NORUNTESTS
TVBC().save(formats=['pdf'],outDir='.',fnRoot=None)

is that not working for you?
--
Robin Becker


More information about the reportlab-users mailing list