Dec-19-2017, 04:48 PM
(This post was last modified: Dec-19-2017, 04:48 PM by denissanga.)
I'm sorry
import reportlab from reportlab.pdfgen import canvas from reportlab.graphics import renderPDF from reportlab.graphics.shapes import Drawing from reportlab.graphics.charts.lineplots import LinePlot from reportlab.graphics.charts.barcharts import VerticalBarChart from reportlab.graphics.widgets.markers import makeMarker from reportlab.graphics.charts.legends import LineLegend from reportlab.graphics.charts.lineplots import GridLinePlot from reportlab.graphics.charts.lineplots import GridLinePlot from reportlab.lib.colors import Color from reportlab.graphics.charts.legends import LineLegend from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin from reportlab.lib.validators import Auto from reportlab.graphics.charts.axes import NormalDateXValueAxis def line_plot(): drawing = Drawing(400, 200) Data = [[[1,1], [2,2], [2.5,1], [3,3], [4,5]],[[1,2], [4,6]]] lp = LinePlot() lp.y = 40 lp.x = 30 lp.width = 500 lp.height = 500 lp.lineLabels.fontSize = 6 lp.lineLabels.boxStrokeWidth = 0.5 lp.lineLabels.visible = 1 lp.lineLabels.boxAnchor = 'c' lp.lineLabels.angle = 0 lp.lineLabelNudge = 10 lp.joinedLines = 1 lp.lines.strokeWidth = 1.5 lp.data = Data drawing.add(lp) return drawing the_canvas = canvas.Canvas("output.pdf") the_canvas.drawString(100,750,"Welcome to Reportlab!") renderPDF.draw(line_plot(), the_canvas, 10, 10) the_canvas.showPage() the_canvas.save()