From e2d959a33d0694b0ad4ce0ae894c85b662c09424 Mon Sep 17 00:00:00 2001 From: liova99 Date: Sat, 30 Apr 2016 12:39:49 +0200 Subject: [PATCH 1/2] Update output.rst Add one more method for the flask app rendering --- docs/documentation/output.rst | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/docs/documentation/output.rst b/docs/documentation/output.rst index 2ea12b5..503af96 100644 --- a/docs/documentation/output.rst +++ b/docs/documentation/output.rst @@ -108,7 +108,7 @@ If pyquery is installed you can get the pyquery object wrapping the chart by cal chart.render_pyquery() # Return pyquery object -Flask response +Flask App -------------- If you are using pygal in a flask app the ``render_response`` may come in handy: @@ -121,6 +121,31 @@ If you are using pygal in a flask app the ``render_response`` may come in handy: ... return chart.render_response() +An other way is to use a Base 64 data URI for your flask app. + +In python file: + +.. code-block:: python + + @app.route('/charts/') + def line_route(): + chart = pygal.Line() + ... + chart = chart.render_data_uri() + + return render_template( 'charts.html', chart = chart) + +In HTML file: + +.. code-block:: html + + +
+ +
+ + + Django response --------------- From 117c57a393da634ad35bfa5fad011785d9248a11 Mon Sep 17 00:00:00 2001 From: Donald Edgar Date: Sun, 8 May 2016 16:03:42 -0700 Subject: [PATCH 2/2] Typo Quick typo fix --- docs/documentation/web.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/documentation/web.rst b/docs/documentation/web.rst index bec4d15..52c5968 100644 --- a/docs/documentation/web.rst +++ b/docs/documentation/web.rst @@ -5,7 +5,7 @@ Embedding in a web page Within an embed tag ------------------- -First setup an url entry point for you svg: ``/mysvg.svg`` don't forget to set the mime-type to ``image/svg+xml``. (If you are using flask you can use the ``render_response`` method.) +First set up an url entry point for your svg: ``/mysvg.svg`` don't forget to set the mime-type to ``image/svg+xml``. (If you are using flask you can use the ``render_response`` method.) Then in your html put an embed tag like this: