我提前道歉,但我就是想不通......
我正在尝试从 sqlite 数据库中读取数据并将数据填充到 reportlab 条形图。我拥有的示例数据是来自http://www.reportlab.com/snippets/3/的片段
sqlite3 代码是:
def arrData():
conn = sqlite3.connect('alarmdb.sqlite')
ccursor = conn.cursor()
strSQL = "Select distinct ErrorMsg, count(*) as Amt from tmpTable where cast(source as int)<20 group by ErrorMsg Order by count(*) desc limit 10"
ccursor.execute(strSQL)
arrResult = ccursor.fetchall()
arrErrAmt = [int(element[1]) for element in arrResult]
return arrErrAmt
但这会返回 [200, 100, 50, 40,..],但在 reportlab 示例中它们显示:self.bar.data = [[4.22], [4.12], [3.65], [3.56], ... ]
如何使用我的 arrData 函数做到这一点?