_templates directory
In [5]:
class BokehScriptComponents(object):
def __init__(self, plot_object, elementid=None):
if not elementid:
elementid = str(uuid.uuid4())
self.elementid = elementid
self.modelid = plot_object.ref["id"]
self.modeltype = plot_object.ref["type"]
self.all_models = serialize_json(plot_object.dump())
var modelid = "{{ figure.modelid }}";
var modeltype = "{{ figure.modeltype }}";
var elementid = "{{ figure.elementid }}";
Bokeh.logger.info("start plotting " + elementid);
var all_models = {{ figure.all_models|safe }};
Bokeh.load_models(all_models);
var model = Bokeh.Collections(modeltype).get(modelid);
var view = new model.default_view({model: model, el: '#{{ figure.elementid }}'});
Bokeh.index[modelid] = view
principle is simple - listen for a change, change the data, push the update
seperating the plot server and the client
need a "blueprint" of the things you want to make / respond to
keep alive ping on heroku