[reportlab-users] Fwd: reportlab-users Digest, Vol 122, Issue 10

Helga Peters helga at full-control.nl
Mon Feb 17 04:21:53 EST 2014


Dear Robin,

My excusses for not providing you with a runnable example.
I try to be clearer.

##############################
if __name__=='__main__':
from reportlab.graphics.shapes import Drawing
from reportlab.graphics.charts.barcharts import VerticalBarChart
from reportlab.graphics.charts.linecharts import HorizontalLineChart
from reportlab.lib import colors
drawing = Drawing(250, 175)
data = [ (3,3,3,10,14,1,1,1,11,13,12,7) ]

lc = HorizontalLineChart()
lc.x = 40
lc.y = -175
lc.height = 225
lc.width = 610
lc.data = data
lc.joinedLines = 1
lc.inFill = 0

lc.categoryAxis.categoryNames = ['0:00','2:00','4:00',
'6:00','8:00','10:00','12:00','14:00','16:00', '18:00','20:00','22:00']
lc.valueAxis.valueMin = 0
lc.valueAxis.valueMax = 15
lc.lineLabelFormat = '%0.0f'
lc.lineLabelNudge = 5
lc.lines[0].strokeColor= colors.beige

data3=[ (0,0,0,2,7,0,1,1,7,5,6,2),
(0,0,0,5,5,0,0,0,0,0,0,1),
(0,0,0,0,0,0,0,0,2,6,4,1),
(1,1,1,1,1,0,0,0,1,1,1,1),
(1,1,1,1,1,0,0,0,1,1,0,1),
(0,1,1,0,0,0,0,0,0,0,0,1),
(0,0,0,1,0,1,0,0,0,0,1,0)
]
bc = VerticalBarChart()
bc.x = lc.x
bc.y = lc.y
bc.height = lc.height
bc.width = lc.width
bc.data = data3
bc.categoryAxis.style = 'stacked'
bc.valueAxis.valueMin = 0
bc.valueAxis.valueMax = lc.valueAxis.valueMax
bc.categoryAxis.visibleAxis =0
bc.categoryAxis.categoryNames = None
drawing.add(bc)
drawing.save(formats=['pdf'],fnRoot='helga-000',outDir='/tmp')
##############################

Before adding 'data3' the output look like in the first image below. The
data point values with red arrows are on or below the line, when
'data3' is added
(second image below) these marked values can no longer be seen. When I
increase the 'lineLabelNudge', the values only move further from the line,
or when I make it really small (e.g. 0.5), all the values move to on the
line but are only half visible.
Since in all the examples that I could find the values are shown above the
lines, I wondered whether there is setting that I have missed ?
Hope this was clearer,
Regards,
Helga
[image: Inline afbeelding 1]
[image: Inline afbeelding 2]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20140217/6424da80/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: screenshot2.png
Type: image/png
Size: 26040 bytes
Desc: not available
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20140217/6424da80/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: screenshot1.png
Type: image/png
Size: 20012 bytes
Desc: not available
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20140217/6424da80/attachment-0003.png>


More information about the reportlab-users mailing list