Answer the question
In order to leave comments, you need to log in
How to dynamically display charts on a page in Django using matplotlib?
Good afternoon!
Do I need to use Primary Key (pk) to build charts on matplotlib and display them independently of each other?
Answer the question
In order to leave comments, you need to log in
Do you really need matplotlib?
If yes, then you can use matplotlib to generate png plots, and then use JS to organize an update on the page.
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
def plot_pic(request):
# делаешь графики
plt.draw()
response = HttpResponse(content_type="image/jpeg")
plt.savefig(response, format="png")
plt.clf()
return response
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question