[Django]-Display mpld3 chart in HTML with django

5👍

the answer is…
in views.py:

js_data = json.dumps(mpld3.fig_to_dict(fig))
return render_to_response('plot.html', {"my_data": js_data})

and in template:

graph = {{ my_data|safe }};

mpld3.draw_figure("fig01", graph);

Leave a comment