Hi,
Firstly - NICE!
Yes. The ids are not static. They are generated by bokeh on the fly. I believe I have an issue somewhere about overriding this that would make this kind of thing easier.
For the div id - you can probably get away without this, just wrap your chart in your own div and then you can manually target this to get the current width/height, for your desired width, you can just use the window.width()
But you do need the element id for: https://github.com/Panzki/specs/blob/gh-pages/js/resize.js#L37 Bokeh.index["44bb4831-9213-491e-86c8-ee43ea32ec53"];
To get this you are going to need the new components method - which I recently updated for this exact use case. https://github.com/bokeh/bokeh/blob/0.9.3/bokeh/embed.py#L38
This is what I did in gtimelog-viz. See:
https://github.com/birdsarah/gtimelog-viz/blob/master/app/utils/embed_charts.py#L31
for where I call the components method.
I then have to do a bit more setup in html templates, but I get access to the element id.
There are other ways you could accomplish the same. Try playing with the components method to see what you get back.
Note that if you call the components method and also file_html or something like that different element ids will be created.
Sorry there isn’t better documentation on this - it’s a very new feature.
Bird
···
On Wed, Sep 16, 2015 at 12:10 PM, p4nzk1@gmail.com wrote:
Hi Sarah,
first I want to thank you for your time, effort and kindness. I already tinkered arround with the js you provided with the goal of resizing my plots to the complet width of the window.
Here I have a little sample page for testing: http://panzki.github.io/specs/test.html
My customized js can be found here: https://github.com/Panzki/specs/blob/gh-pages/js/resize.js
This are the first lines of javascript I’ve written, so chances are good that they contain some bullshit. For me it seems like, that the js is loaded and executed, because the console.log() statement from line 35 is executed. (I can see the message in the firefox/chrome console)
The problem is that the plots are not resized. One guess of mine is that I used a wrong modell id (or other id). I replaced the placeholders for the ids in the template by hand with the ids I found in my html.
I hope this information will help to find a solution.
-Panzki
–
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/5d0d64b9-4976-45f7-b9aa-bdbec95a18ab%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.