[reportlab-users] Bug in reportlab horizontal/vertical bar chart modules ????

Robin Becker reportlab-users@reportlab.com
Thu, 11 Jul 2002 19:23:51 +0100


In article <5.1.1.6.0.20020711092717.009fb350@imap.datacraft.com.br>, Marcus Vinicius Laranjeira
<m.laranjeira@datacraft.com.br> writes
>
>
>All,
>
>I am currently having this problem: When I try to plot a horizontalbarchart 
>with less than 5 data series the chart is ploted correctly, when it has 5 
>or more data series, some black lines are ploted without a pattern, i.e., 
.......
>Please help !
>
>Thanks,
>
>Marcus
Here is one I ran up without too much trouble. If you change the 'pdf'
to 'gif' it will output a gif etc etc. has 
two data in six categories. You can try setting the data to
self.chart.data = [(100, 110, 120, 130,100,10), (70, 80, 85, 90,50,60),(70, 80, 85, 90,50,60),(70, 80,
85, 90,50,60),(70, 80, 85, 90,50,60),(70, 80, 85, 30,50,60)]

to get 6 data & 6 categories so there's no real limitation. The base colors
would need adjusting though.


from reportlab.graphics.charts.barcharts import HorizontalBarChart
from reportlab.graphics.shapes import Drawing
class Drawing_000(Drawing):
        def __init__(self,width=400,height=200,*args,**kw):
                apply(Drawing.__init__,(self,width,height)+args,kw)
                self.add(HorizontalBarChart(),'chart')
                self.chart.y = 20
                self.chart.data = [(100, 110, 120, 130,100,10), (70, 80, 85, 90,50,60)]
                self.chart.valueAxis.forceZero = 1
                self.chart.width = self.width-10-self.chart.x
                self.chart.height = self.height - 10 - self.chart.y

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