[reportlab-users] Problem with bar chart example in graphics guide page 24
waxmop@gtcinternet.com
reportlab-users@reportlab.com
Mon, 25 Aug 2003 15:11:28 -0400
Hi -
I tried the example program on page 24 of the graphics guide, and got an
error=2E Here's the program:
# copied right out of the graphics guide, page 24=2E
from reportlab=2Egraphics=2Eshapes import Drawing
from reportlab=2Egraphics=2Echarts=2Ebarcharts import VerticalBarChart
from reportlab=2Elib import colors
drawing =3D Drawing(400,200)
data =3D [
(13, 5, 20, 22, 37, 45, 19, 4),
(14, 6, 21, 23, 38, 46, 20, 5)
]
bc =3D VerticalBarChart()
bc=2Ex =3D 50
bc=2Ey =3D 50
bc=2Eheight =3D 125
bc=2Ewidth =3D 300
bc=2EstrokeColor =3D colors=2Eblack
#set the range and tick marks on the y-axis
bc=2EvalueAxis=2EvalueMin =3D 0
bc=2EvalueAxis=2EvalueMax =3D 50
bc=2EvalueAxis=2EvalueStep =3D 10
bc=2EcategoryAxis=2Elabels=2EboxAnchor =3D 'ne'
bc=2EcategoryAxis=2Elabels=2Edx =3D 8
bc=2EcategoryAxis=2Elabels=2Edy =3D -2
bc=2EcategoryAxis=2Elabels=2Eangle =3D 30
bc=2EcategoryAxis=2EcategoryNames =3D ['Jan-99', 'Feb-99', 'Mar-99',
'Apr-99', 'May-99', 'Jun-99',
=09=09=09=09 'Jul-99', 'Aug-99']
drawing=2Eadd(bc)
from reportlab=2Egraphics import renderPDF
renderPDF=2EdrawToFile(drawing, 'funchart=2Epdf', 'Simple Bar Chart')
---
And here is the error I get:
>>> import funchart
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "funchart=2Epy", line 37, in ?
renderPDF=2EdrawToFile(drawing, 'funchart=2Epdf', 'Simple Bar Chart')
File "c:\python23\lib\reportlab\graphics\renderPDF=2Epy", line 276, in
drawToFil
e
draw(d, c, 0, 0, showBoundary=3DshowBoundary)
File "c:\python23\lib\reportlab\graphics\renderPDF=2Epy", line 25, in dr=
aw
R=2Edraw(drawing, canvas, x, y, showBoundary=3DshowBoundary)
File "c:\python23\lib\reportlab\graphics\renderPDF=2Epy", line 54, in dr=
aw
self=2EdrawNode(drawing)
File "c:\python23\lib\reportlab\graphics\renderPDF=2Epy", line 75, in
drawNode
self=2EdrawNodeDispatcher(node)
File "c:\python23\lib\reportlab\graphics\renderbase=2Epy", line 217, in
drawNode
Dispatcher
self=2EdrawGroup(node)
File "c:\python23\lib\reportlab\graphics\renderbase=2Epy", line 241, in
drawGrou
p
self=2EdrawNode(node)
File "c:\python23\lib\reportlab\graphics\renderPDF=2Epy", line 75, in
drawNode
self=2EdrawNodeDispatcher(node)
File "c:\python23\lib\reportlab\graphics\renderbase=2Epy", line 217, in
drawNode
Dispatcher
self=2EdrawGroup(node)
File "c:\python23\lib\reportlab\graphics\renderbase=2Epy", line 234, in
drawGrou
p
node =3D _expandUserNode(node,canvas)
File "c:\python23\lib\reportlab\graphics\renderbase=2Epy", line 155, in
_expandU
serNode
node =3D node=2EprovideNode()
File "c:\python23\lib\reportlab\graphics\widgetbase=2Epy", line 147, in
provideN
ode
return self=2Edraw()
File "c:\python23\lib\reportlab\graphics\charts\axes=2Epy", line 153, in=
draw
g=2Eadd(self=2EmakeTickLabels())
File "c:\python23\lib\reportlab\graphics\charts\axes=2Epy", line 302, in=
makeTic
kLabels
assert len(self=2EcategoryNames) =3D=3D catCount, \
AssertionError: expected 8 category names but found 4 in axis=2E
categories =3D ['Jan-99', 'Feb-99', 'Mar-99', 'Apr-99', 'May-99', 'Jun-99=
',
'Jul-
99', 'Aug-99']
I don't get it=2E It says categories only has four names? Can anyone hel=
p
me out?
--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web=2Ecom/ =2E