pdf v2

parent f8931e6d
......@@ -333,16 +333,27 @@ def dataToTable(name, data):
# create the table for our document
def myTable(path1, path2, basefile):
image1 = Image(path1, height=300, width=200, mask='auto')
#image1 = Image(path1, height=300, width=200, mask='auto')
image1 = Image(path1)
if image1.imageWidth < image1.imageHeight:
print ("mas alto que ancho")
image2 = Image(path1, height=300, width=200, mask='auto')
else:
image2 = Image(path1, height=150, width=400, mask='auto')
path, dirs, files = next(os.walk(path2))
for file in files:
if file.startswith(basefile[:8]):
if file.endswith('.tif') and not file.endswith('0.tif'):
# image2 = Image(path2 + file, height=300, width=200, mask='auto')
image2 = image1
image3 = image2
data = [['TCI', 'SCL'], [image1, image2]]
if image1.imageWidth < image1.imageHeight:
data = [['TCI', 'SCL'], [image2, image3]]
else:
data = [['TCI'], [image2], ['SCL'], [image3]]
t = Table(data)
GRID_STYLE = TableStyle(
......@@ -372,7 +383,7 @@ def myBarChart(data, maxi, fecha):
bc.strokeColor = colors.black
bc.valueAxis.valueMin = 0
bc.valueAxis.valueMax = maxi+100
bc.valueAxis.valueMax = maxi + 100
bc.valueAxis.valueStep = 50
bc.categoryAxis.labels.boxAnchor = 'ne'
......@@ -456,19 +467,25 @@ def PDFGenerator(request, ruta, reporteDir, datasets):
values = []
labels = []
maxi = 0
#for data in datasets:
# for data in datasets:
for data in datasets[:len(datasets) - 1]:
if maxi > data['data'][index]:
maxi = maxi
else:
maxi = data['data'][index]
#print (maxi)
# print (maxi)
values.append([data['data'][index]])
labels.append(data['label'])
path1 = thumbs + file
# Header
# print (width)
#########################33
im = Image(USERS_PATH + 'header.png', width=300, height=70)
im.hAlign = 'CENTER'
story.append(im)
......@@ -491,9 +508,9 @@ def PDFGenerator(request, ruta, reporteDir, datasets):
story.append(Spacer(1, .5 * inch))
# add barchart and legend
#drawing = myBarChart(values[:len(values) - 1], maxi, file)
# drawing = myBarChart(values[:len(values) - 1], maxi, file)
drawing = myBarChart(values, maxi, file)
#drawing = myBarLegend(drawing, labels[:len(labels) - 1])
# drawing = myBarLegend(drawing, labels[:len(labels) - 1])
drawing = myBarLegend(drawing, labels)
drawing.hAlign = 'CENTER'
story.append(drawing)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment