Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bokeh Callbacks #275

Merged
merged 23 commits into from
Dec 1, 2015
Merged

Bokeh Callbacks #275

merged 23 commits into from
Dec 1, 2015

Conversation

philippjfr
Copy link
Member

This PR adds support for Bokeh callbacks to HoloViews, allowing both pure javascript callbacks and callbacks to the IPython kernel. The design allows defining various attributes on the plot, data source and callback object to listen to, which are sent to Python allowing the user to modify any the plot object or data source. It also automatically chains multiple callbacks defined on one plot object. This means the design should easily extend to support what we call Streams, allowing the user to link any callback to a DynamicMap, even across plots.

The two baseclasses that are added are:

  • Callback: A ParameterizedFunction which defines the attributes to subscribe to, any custom js code and __call__ method, which defines what operation to apply to the data, returning the bokeh plot objects that are to be updated.
  • Callbacks: A Parameterized object allowing the user to define callbacks for various plot attributes as parameters. It initializes the Callback functions, setting up any javascript code required to listen to the requested bokehjs attributes, sets the callback on the corresponding plot object and chains callbacks if multiple are defined on one plot object.

Currently only callbacks on ranges are implemented and two examples are provided. One downsamples any Image depending on the current zoom level, the other applies downsampling to any Points or Scatter object. I've put together a little video demo of the callback to demonstrate what the downsampling looks like in action, you can view it here. As you can see the downsampling callbacks allow me to display and interactively explore a 21600x10800 pixel image and 1M scatter points with great responsiveness. It even works for axes shared across plots and multiple objects being downsampled at once.

HoloViews Callback Demo

@philippjfr philippjfr added the type: feature A major new feature label Sep 27, 2015
@philippjfr philippjfr self-assigned this Sep 27, 2015
@philippjfr philippjfr added this to the v1.4.0 milestone Sep 27, 2015
@jlstevens
Copy link
Contributor

The functionality here is great and I see you've implemented some of the API we discussed together earlier on. I'm not certain it should be merged with master (or at least not just yet) as I think we should think this through this system carefully.

Given that this functionality is tied to Bokeh, there are other systems that will make use of the callbacks (e.g the proposed Stream dimensions for DynamicMap) how about we update the existing bokeh branch and merge with that? The bokeh branch will then be for testing these more advanced plotting features now that all the basic bokeh plots have been merged with master.

@philippjfr philippjfr mentioned this pull request Nov 10, 2015
42 tasks
@philippjfr
Copy link
Member Author

This PR is ready to merge, we might revisit the API after the release, but it works and we can improvements and finalize the API after it's been in usage for a while.

philippjfr added a commit that referenced this pull request Dec 1, 2015
@philippjfr philippjfr merged commit a69c530 into master Dec 1, 2015
@jlstevens jlstevens deleted the callbacks branch January 28, 2016 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature A major new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants