Bokeh Callback For Image Update
I have a Bokeh plot that can display an image, which can be changed by a slider (and also should update regularly) (similar to this question Sliding through images with Bokeh Slide
Solution 1:
As of Bokeh 1.4.0
there is no callback on the image load. The ImageURL
glyph is not one that is much used by the core developers, AFAIK, and we can't always anticipate every use case that every user might want. For this reason, we have made Bokeh itself extensible, so the best I can suggest at the moment is to extend Bokeh with a custom extension. The documentation for creating custom extensions is here:
http://docs.bokeh.org/en/latest/docs/user_guide/extensions.html
In abbreviated forms, you'd create a class like this that adds a callback
property, and supplies the JavaScript implementation for your custom ImageURL
glyph:
classMyImageURL(ImageURL):
callback =Instance(Callback, help="A callback to run when images load")
__implementation__ = JAVASCRIPT_CODE_HERE
Then it can be used like any low level glyoh:
my_glyph = MyImageURL(...)
source = ColumnDataSource(...)
plot.add_glyph(source, my_glyph)
Post a Comment for "Bokeh Callback For Image Update"