Hi Paulo,
autoload_static returns a tuple with two items, only one of which you need to template into your document. Here is the reference page for autoload_static:
http://bokeh.pydata.org/docs/reference.html#bokeh.embed.autoload_static
But to elaborate further, it returns a two things tuple (code, tag) The "code" portion is all the js code that describes your plot. You need to save this code in a .js file accessible at the path you pass in to autoload_static. For example:
(code, tag) = autoload_static(p, CDN, 'static/js/myplot.js')
if you look at the value of tag, it is something like:
In [11]: print(tag)
<script
src="static/js/myplot.js"
id="8adc6135-0731-40e0-819f-9690599fe7ad"
async="true"
data-bokeh-data="static"
data-bokeh-modelid="d1244277-3f02-42b0-b339-9af6fc8e15c0"
data-bokeh-modeltype="Plot"
></script>
*This* is what you need to template into your Jinja template. Wherever you put this script, it will be replaced by the plot. Notice the "src" attribute of the <script> tag is exactly the path passed in to autoload_static above. You need to save the value of "code" (which is too long to include here) to a file at "static/js/myplot.js" (you need to give the *full* path to a .js file to autoload_static)
Let us know if we can help further,
Bryan
···
On Aug 14, 2014, at 10:24 AM, Paulo Nuin <paulo.nuin@gmail.com> wrote:
Hi
I used to have an embedded snippet in a html page generated by a Flask app using this syntax:
snippet = embed.autoload_static(curplor(), server=False, embed_base_url='http://192.168.1.72:5003/static/js/',
embed_save_loc='./static/js',
static_path='http://192.168.1.72:5003/static/'\)
but with new versions all my attempts to actually have the same result failed. My latest try was:
snippet = autoload_static(curplot(), CDN, './static/js')
but now I don't see the graph, the snippet embedded into the html (using Jinja2 {{ snippet | safe}}) doesn't seem to be a valid javascript, not at least the way the object is being returned by my Bokeh plotting procedure.
I looked at the documentation but there's not much there that can help me.
Thanks in advance
Paulo
--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/9bd2ded6-892d-4ee1-8f03-113ddc137c8f%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.