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

Robin Becker reportlab-users@reportlab.com
Thu, 11 Jul 2002 21:01:41 +0100


In article <5.1.1.6.0.20020711153607.009fd0f0@imap.datacraft.com.br>, Marcus Vinicius Laranjeira <m.laranjeira@datacraft
.com.br> writes
>    Robin,
>
>    I can't save the chart as a PDF since this chart is inserted in a 
>    flowable and then in a PDF...
>
>    I have made tests and the problem is happening actually with 9 or 
>    more data in the data series... with less than 9 (i.e. 8, 7...) it 
>    seems to create the chart fine...
>
>    Any other suggestion !?
>
>    Thanks,
>
>    Marcus
.... do you mean 9 categories or 9 data/category? Drawings are already flowables so I don't mind how it's rendered.

try setting

the data member in my example to
data = [(100, 110, 120, 130, 80, 80, 60, 55, 23, 200, 110, 210)]
this chart has 12 categories and works fine for me.

import reportlab
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin

#Autogenerated by ReportLab guiedit do not edit
import reportlab
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin
from reportlab.lib.colors import maroon, lime, coral, lightgreen, ReportLabBlue, \
        purple, lightgrey,yellow, pink, lightblue

class Drawing_003(_DrawingEditorMixin,Drawing):
        def __init__(self,width=400,height=200,*args,**kw):
                apply(Drawing.__init__,(self,width,height)+args,kw)
                self.add(reportlab.graphics.charts.barcharts.HorizontalBarChart(),name='chart')
                self.chart.y=20
                self.chart.width=self.width-self.chart.x-10
                self.chart.height=self.height-self.chart.y-10
                self.chart.data= [(100,),(110,),(120,),(130,),(80,),(80,),(60,),(55,),(23,),(200,),(110,),(210,)]
                self.chart.valueAxis.rangeRound='both'
                self.chart.bars[2].fillColor = pink
                self.chart.bars[3].fillColor = maroon
                self.chart.bars[4].fillColor = lime
                self.chart.bars[5].fillColor = yellow
                self.chart.bars[6].fillColor = lightblue
                self.chart.bars[7].fillColor = coral
                self.chart.bars[8].fillColor = lightgreen
                self.chart.bars[9].fillColor = ReportLabBlue
                self.chart.bars[10].fillColor = purple
                self.chart.bars[11].fillColor = lightgrey


hbc = Drawing_003()

#hbc has 12 data in one category


hbc=Drawing_003()
hbc.chart.data=[(100,110,120,130,80,80,60,55,23,200,110,210)]
#hbc now has 12 categories with one datum in each category.




>    PS: I am in a hurry.... please heeeellllllpppppppp :-) 
>
>    At 19:23 11/07/02 +0100, you wrote:
>>       In article 
>>       <5.1.1.6.0.20020711092717.009fb350@imap.datacraft.com.br>, 

-- 
Robin Becker