[reportlab-users] get all values of data points above the line chart

Robin Becker robin at reportlab.com
Tue Feb 11 08:32:43 EST 2014


On 11/02/2014 11:18, Helga Peters wrote:

> Hello,

>

> Currently I am working on a mixed chart. Below find the first part of my

> chart:

.....
Helga, it's not clear what you mean by below chart etc etc. A simple box diagram
of what you're trying to do or achieve

Also it's better if you provide a runnable example, from your code I constructed
this

############################################
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) ] # total

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

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 = 2
lc.lines[0].strokeColor= colors.beige
data3=[ (0,0,0,2,7,0,1,1,7,5,6,2), # task1
(0,0,0,5,5,0,0,0,0,0,0,1), # task2
(0,0,0,0,0,0,0,0,2,6,4,1), # task3
(1,1,1,1,1,0,0,0,1,1,1,1), # task4
(1,1,1,1,1,0,0,0,1,1,0,1), # task5
(0,1,1,0,0,0,0,0,0,0,0,1), # task6
(0,0,0,1,0,1,0,0,0,0,1,0) # task7
]
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')
############################################

but it's output in PDF doesn't give me much clue what you want to do.
--
Robin Becker


More information about the reportlab-users mailing list