Save chartkick chart as image or in pdf using python, flask and pisa/ xhtml2pdf

自古美人都是妖i 提交于 2019-12-12 02:32:45

问题


My app is in python using the flask framework. I have a chart that I've generated with chartlink. I'd like to include it on a pdf that I'm outputting with pisa. Is this possible? Is there some way to save the chartkick chart as an image? Or should I look into another chart-generating option like pygal or matplotlib?


回答1:


According to the chartkick documentation you can give users the option to download an image of the chart.

You will have to include canvg before chartkick.js.

Another option would be to generate the image on a PhantomJS instance and save the screenshot/image.



来源:https://stackoverflow.com/questions/22027683/save-chartkick-chart-as-image-or-in-pdf-using-python-flask-and-pisa-xhtml2pdf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!