I am trying to make simple chart using reportlab with python.
I made chart with title of x and y, but the font seems like small.
I wanna change font to be bold and increase font size.
here is my code.
def DrawPowerChart(self):
    arrX = [0]*6
    arrY = [0]*3
    for i in range(6):
        arrX[i] = i * 60
    for i in range(3):
        arrY[i] = i * 40    
    drawing = Drawing(400,400)
    self.data = [
        ((10,30), (40,3), (70,72), (100,33), (130,14), (160,52), (190,68), (220,37),(250,70),(280,80))
    ]
    lp = LinePlot()
    lp.x = 50
    lp.y = 50
    lp.height = 300
    lp.width = 300
    lp.data = self.data
    lp.joinedLines = 3
    lp.lines[0].strokeWidth = 4
    lp.strokeColor = colors.black
    lp.xValueAxis.valueMin = 0
    lp.xValueAxis.valueMax = 300
    lp.yValueAxis.valueMin = 0
    lp.yValueAxis.valueMax = 80
    lp.xValueAxis.valueSteps = arrX
    lp.yValueAxis.valueSteps = arrY
    drawing.add(String(360,40,"Time(s)")) #this is label x
    drawing.add(String(30,370,"Power(W)")) #this is label y 
I knew if i use canvas i will be solved but I wanna make chart picture including title
See page 95 of the ReportLab User Guide for details. Here's an example of how you can change the font size and colour:
d.add(String(150,100, 'Hello World', fontSize=18, fillColor=colors.red))
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With