[reportlab-users] Two stacked charts on one column

Dirk Hesse reportlab-users@reportlab.com
Fri, 7 Nov 2003 16:22:11 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_0029_01C3A54B.4C575D30
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello all

I want to draw a stacked Chart like this example from the =
graphicsguide_reference.pdf :

   =20
def sampleStacked1():

"Simple bar chart using symbol attribute."

drawing =3D Drawing(400, 200)

data =3D dataSample5

bc =3D VerticalBarChart()

bc.categoryAxis.style =3D 'stacked'

bc.x =3D 50

bc.y =3D 50

bc.height =3D 125

bc.width =3D 300

bc.data =3D data

bc.strokeColor =3D colors.black

bc.barWidth =3D 10

bc.groupSpacing =3D 15

bc.valueAxis.valueMin =3D 0

bc.categoryAxis.labels.boxAnchor =3D 'e'

bc.categoryAxis.categoryNames =3D ['Ying', 'Yang']

from reportlab.graphics.widgets.grids import ShadedRect

bc.bars.symbol =3D ShadedRect()

bc.bars.symbol.fillColorStart =3D colors.red

bc.bars.symbol.fillColorEnd =3D colors.white

bc.bars.symbol.orientation =3D 'vertical'

bc.bars.symbol.cylinderMode =3D 1

bc.bars.symbol.strokeWidth =3D 0

bc.bars[1].symbol =3D ShadedRect()

bc.bars[1].symbol.fillColorStart =3D colors.magenta

bc.bars[1].symbol.fillColorEnd =3D colors.white

bc.bars[1].symbol.orientation =3D 'vertical'

bc.bars[1].symbol.cylinderMode =3D 1

bc.bars[1].symbol.strokeWidth =3D 0

bc.bars[2].symbol =3D ShadedRect()

bc.bars[2].symbol.fillColorStart =3D colors.green

bc.bars[2].symbol.fillColorEnd =3D colors.white

bc.bars[2].symbol.orientation =3D 'vertical'

bc.bars[2].symbol.cylinderMode =3D 1

bc.bars[2].symbol.strokeWidth =3D 0

bc.bars[3].symbol =3D ShadedRect()

bc.bars[3].symbol.fillColorStart =3D colors.blue

bc.bars[3].symbol.fillColorEnd =3D colors.white

bc.bars[3].symbol.orientation =3D 'vertical'

bc.bars[3].symbol.cylinderMode =3D 1

bc.bars[3].symbol.strokeWidth =3D 0

drawing.add(bc)

return drawing

But Is there any Possiblilty to draw 2 stacked Charts on one =
column/day??

Thanks D. Hesse

------=_NextPart_000_0029_01C3A54B.4C575D30
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1264" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hello all</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I want to draw a stacked Chart like =
this example=20
from the graphicsguide_reference.pdf :</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; <FONT =
face=3DCourier>
<P align=3Dleft><FONT face=3DArial size=3D1>def =
sampleStacked1():</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>"Simple bar chart using =
symbol=20
attribute."</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>drawing =3D Drawing(400, =
200)</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>data =3D =
dataSample5</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>bc =3D =
VerticalBarChart()</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>bc.categoryAxis.style =3D=20
'stacked'</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>bc.x =3D 50</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>bc.y =3D 50</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>bc.height =3D 125</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>bc.width =3D 300</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>bc.data =3D data</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>bc.strokeColor =3D =
colors.black</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>bc.barWidth =3D =
10</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>bc.groupSpacing =3D =
15</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>bc.valueAxis.valueMin =3D =
0</FONT></P>
<P align=3Dleft><FONT face=3DArial =
size=3D1>bc.categoryAxis.labels.boxAnchor =3D=20
'e'</FONT></P>
<P align=3Dleft><FONT face=3DArial =
size=3D1>bc.categoryAxis.categoryNames =3D ['Ying',=20
'Yang']</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>from =
reportlab.graphics.widgets.grids=20
import ShadedRect</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>bc.bars.symbol =3D =
ShadedRect()</FONT></P>
<P align=3Dleft><FONT face=3DArial =
size=3D1>bc.bars.symbol.fillColorStart =3D=20
colors.red</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>bc.bars.symbol.fillColorEnd =
=3D=20
colors.white</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>bc.bars.symbol.orientation =
=3D=20
'vertical'</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>bc.bars.symbol.cylinderMode =
=3D 1</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>bc.bars.symbol.strokeWidth =
=3D 0</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>bc.bars[1].symbol =3D=20
ShadedRect()</FONT></P>
<P align=3Dleft><FONT face=3DArial =
size=3D1>bc.bars[1].symbol.fillColorStart =3D=20
colors.magenta</FONT></P>
<P align=3Dleft><FONT face=3DArial =
size=3D1>bc.bars[1].symbol.fillColorEnd =3D=20
colors.white</FONT></P>
<P align=3Dleft><FONT face=3DArial =
size=3D1>bc.bars[1].symbol.orientation =3D=20
'vertical'</FONT></P>
<P align=3Dleft><FONT face=3DArial =
size=3D1>bc.bars[1].symbol.cylinderMode =3D=20
1</FONT></P>
<P align=3Dleft><FONT face=3DArial =
size=3D1>bc.bars[1].symbol.strokeWidth =3D=20
0</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>bc.bars[2].symbol =3D=20
ShadedRect()</FONT></P>
<P align=3Dleft><FONT face=3DArial =
size=3D1>bc.bars[2].symbol.fillColorStart =3D=20
colors.green</FONT></P>
<P align=3Dleft><FONT face=3DArial =
size=3D1>bc.bars[2].symbol.fillColorEnd =3D=20
colors.white</FONT></P>
<P align=3Dleft><FONT face=3DArial =
size=3D1>bc.bars[2].symbol.orientation =3D=20
'vertical'</FONT></P>
<P align=3Dleft><FONT face=3DArial =
size=3D1>bc.bars[2].symbol.cylinderMode =3D=20
1</FONT></P>
<P align=3Dleft><FONT face=3DArial =
size=3D1>bc.bars[2].symbol.strokeWidth =3D=20
0</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>bc.bars[3].symbol =3D=20
ShadedRect()</FONT></P>
<P align=3Dleft><FONT face=3DArial =
size=3D1>bc.bars[3].symbol.fillColorStart =3D=20
colors.blue</FONT></P>
<P align=3Dleft><FONT face=3DArial =
size=3D1>bc.bars[3].symbol.fillColorEnd =3D=20
colors.white</FONT></P>
<P align=3Dleft><FONT face=3DArial =
size=3D1>bc.bars[3].symbol.orientation =3D=20
'vertical'</FONT></P>
<P align=3Dleft><FONT face=3DArial =
size=3D1>bc.bars[3].symbol.cylinderMode =3D=20
1</FONT></P>
<P align=3Dleft><FONT face=3DArial =
size=3D1>bc.bars[3].symbol.strokeWidth =3D=20
0</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>drawing.add(bc)</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D1>return=20
drawing</FONT></P></FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>But Is&nbsp;there any Possiblilty to =
draw 2 stacked=20
Charts on one column/day??</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks D. Hesse</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0029_01C3A54B.4C575D30--