0

I am trying to render a chart in PNG format, because this image is going to be embed in a email template and SVG are not supported on every email client, when I render the chart in SVG format it looks quite fine but when I render on PNG, the chart is fine but the legend looks wicked

enter image description here

The code I am using is pretty straightforward. I've installed PyCairo tinycss and cssselect ...

    pie_chart = pygal.Pie()
    pie_chart.title = 'Email usage on %s ' % month_str
    for k, v in data.items():
        if k in EMAIL_STATUS:
            pie_chart.add(k, float(v))
    if settings.DEBUG == True:
        path = os.path.join(settings.APP_ROOT, 'static')
    else:
        path = settings.STATIC_ROOT
    path = '%s/images/chart.png' % path
    pie_chart.render_to_png(path)

Any idea what am I missing here? Thanks

Cheluis
  • 1,402
  • 3
  • 22
  • 51

0 Answers0