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

Feature-request: Selection-Bar #7795

Closed
heoa opened this Issue Apr 15, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@heoa
Copy link

heoa commented Apr 15, 2018

This is a feature-request for a Selection-Bar. You can see an example about Selection-Bar here. I am interested to help to do this feature but I need to understand a few things.

How would you implement Selection-Bar on Bokeh? With Extension or build it to the base package?

@bryevdv

This comment has been minimized.

Copy link
Member

bryevdv commented Apr 16, 2018

Hi @heoa I think this would be a good addition, and I think that now all the necessary parts are in place to make it fairly straightforward to add to the core library. Here is what I would suggest:

  • Have a new RangeTool, declared on the Python as roughly:

    class RangeTool(Tool): 
        x_range = Instance(Range1d)
        y_range = Instance(Range1d)
    
  • On the JS side, the implementation will have a (internal) BoxAnnotation and it will use the ranges to set the dimensions of the box

    • One of the ranges may be None, in this case the box spans that entire dimension
    • The tool will respond to drag events: if the drag starts in the middle of the box, the entire box is moved (by updating the ranges appropriately). If the drag starts near a border, only that border is moved (by updating the range)
    • The tool will respond to move move events, and if the mouse is near a border, will display some kind of handle or highlight to suggest that it is draggable

With this in place you could do something like:

p1 = figure(...)

p2 = figure(...)
pe.add_tool(RangeTool(x_range=p1.x_range))

then you'd automatically be able to control the range of p1 by manipulating the box on p2. You could also add any standard JS or python callbacks to the ranges for other behaviours.

I think this would be a fantastic task for a new contributors. Are you interested in working up a PR for this? I am not sure of your background, so I do not know if this is enough context and information to get started, but can always go into more detail.

@bryevdv bryevdv added this to the 0.12.x milestone Apr 16, 2018

@bryevdv bryevdv referenced this issue Apr 29, 2018

Merged

Add Range Tool #7839

2 of 3 tasks complete

@bryevdv bryevdv modified the milestones: 0.13.x, 0.13.0 May 31, 2018

@bryevdv bryevdv closed this in #7839 Jun 7, 2018

@heoa

This comment has been minimized.

Copy link
Author

heoa commented Jun 7, 2018

Is there any demo yet available? I would like to learn bokeh better with this.

@bryevdv

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment