Commit 0c4b120b authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update views/graphs to remove produced image

parent ccb13c85
...@@ -6,12 +6,15 @@ ...@@ -6,12 +6,15 @@
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
import base64 import base64
import io import io
import matplotlib as mpl
import urllib.parse import urllib.parse
from datetime import datetime from datetime import datetime
buf = io.BytesIO() buf = io.BytesIO()
fig.savefig(buf, format="svg") fig.savefig(buf, format="svg")
mpl.pyplot.close(fig)
data = base64.b64encode(buf.getbuffer()).decode("ascii") data = base64.b64encode(buf.getbuffer()).decode("ascii")
data = urllib.parse.quote(data) data = urllib.parse.quote(data)
...@@ -25,4 +28,4 @@ ...@@ -25,4 +28,4 @@
=P(delta, BR(), request.now.strftime("%d %b %Y %H:%M"), _class="dbui-p") =P(delta, BR(), request.now.strftime("%d %b %Y %H:%M"), _class="dbui-p")
=BR() =BR()
}} }}
\ No newline at end of file
{{ {{
import base64 import base64
import io import io
import matplotlib as mpl
buf = io.BytesIO() buf = io.BytesIO()
fig.savefig(buf, format="pdf") fig.savefig(buf, format="pdf")
mpl.pyplot.close(fig)
data = base64.b64encode(buf.getbuffer()).decode("ascii") data = base64.b64encode(buf.getbuffer()).decode("ascii")
response.body = io.StringIO() response.body = io.StringIO()
response.headers['Content-Type']='application/pdf' response.headers['Content-Type']='application/pdf'
response.write(data, escape=False) response.write(data, escape=False)
}} }}
\ No newline at end of file
{{ {{
import base64 import base64
import io import io
import matplotlib as mpl
buf = io.BytesIO() buf = io.BytesIO()
fig.savefig(buf, format="png", dpi=300) fig.savefig(buf, format="png", dpi=300)
mpl.pyplot.close(fig)
data = base64.b64encode(buf.getbuffer()).decode("ascii") data = base64.b64encode(buf.getbuffer()).decode("ascii")
response.body = io.StringIO() response.body = io.StringIO()
response.headers['Content-Type']='application/png' response.headers['Content-Type']='application/png'
response.write(data, escape=False) response.write(data, escape=False)
}} }}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment