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

Multiple series tooltips: not working example on StackOverFlow #3454

Closed
VelizarVESSELINOV opened this issue Dec 30, 2015 · 8 comments
Closed

Comments

@VelizarVESSELINOV
Copy link

As you can see the example is not working anymore from the comments.

http://stackoverflow.com/questions/27545842/hovertool-for-multiple-data-series-in-bokeh-scatter-plot

I got the same issue trying to use tooltips per line/scatter:
AttributeError: 'generator' object has no attribute 'tooltips'

Please provide proper guideline how to use hover for multiple series.

@bryevdv
Copy link
Member

bryevdv commented Dec 30, 2015

I've updated the response. The short answer is that we got repeated requests for fig.circle(...) to return the glyph renderer instead of returning the figure, so that change was made last year. The hover tool is on the figure, which is why searching for (now on the glyph renderer) did not find anything. The error message could be improved, however, so I am marking this issue a task to improve the messaging.

@bryevdv bryevdv added this to the 0.11.1 milestone Dec 30, 2015
@VelizarVESSELINOV
Copy link
Author

Thank you for edits, now I managed to make it work for each p.line().

But as a consequence, I have new challenges:
overhover

Any option to define a proper name for each HoverTool?

Today my code is sequential, but I'm planning to move to parallel insert of p.line() (I hope Bokeh is thread safe), any option to define the display order in the long list in the toolbar or in the legend box?

UX suggestion to be able to switch on/off all the hovers with one click and potentially add option for advanced users to select individual hovers to switch on/off, like Office is handling borders: http://www.excel-exercice.com/wp-content/uploads/2011/06/3D_Borders.png

@bryevdv
Copy link
Member

bryevdv commented Dec 31, 2015

@VelizarVESSELINOV First thanks for all your detailed feedback an suggestions. A question: do you have a different set of tooltips for each line? Or do you want individual control per line? If neither of those, you can also just make one tooltip that will interrogate all the renderers at once.

Adding a name is a great idea, it will require a little new development. Can you make a separate feature request to cover enhancements to hover tool handing in the toolbar?

Also please be advised we are in the middle of a freeze for 0.11 and everyone is working furiously on docs and examples so there will likely not be movement on this until mid January.

@VelizarVESSELINOV
Copy link
Author

As you can see the tooltip is almost the same, except legend and line_color that change for each object:

for number in range(10000):
    name = object_name(number)
    df = load_data(name)
    color = smart_color(number)

    l = p.line(df[x], df[y], legend=name, line_color=color)

    p.add_tools(HoverTool(renderers=[l], tooltips=[
        ('Name', name),
        ('Color', '<span class="bk-tooltip-color-block" '
                  'style="background-color:{}"> </span>'.format(color)),
        (x_label, "@x"),
        (y_label, "@y{int}")
    ]))

I would like to have single tooltip and be able to use @legend and @line_color.

I will open another ticket specific of management of multi hover tools.

And I saw on you website very interesting functionality in 0.11dev7 for more interactive applications.

@mbhall88
Copy link

mbhall88 commented Jun 19, 2017

It would make sense to just allow for reference the name attribute in line?

Then you could just do

for number in range(10000):
    name = object_name(number)
    df = load_data(name)
    color = smart_color(number)

    l = p.line(df[x], df[y], legend=name, line_color=color, name=name)

p.add_tools(HoverTool(tooltips=[
    ('Name', '$name'),
    ('Color', '<span class="bk-tooltip-color-block" '
              'style="background-color:{}"> </span>'.format($color)),
    (x_label, "@x"),
    (y_label, "@y{int}")
    ]))

@bryevdv
Copy link
Member

bryevdv commented Jun 19, 2017

That would be great actually. Would you be interested in working up a PR yourself?

@mbhall88
Copy link

@bryevdv I would love to help out. Although I wouldn't know where to start as I haven't worked on big production packages before and I must admit I don't know what you mean by PR? Happy to learn though if you don't mind pointing me in the right direction. Feel free to continue conversation via email if you want (or another means that is more convenient).

@bryevdv
Copy link
Member

bryevdv commented Jun 23, 2018

The $name special variable was added in 0.13.0, so I am going to close this.

@bryevdv bryevdv closed this as completed Jun 23, 2018
@bryevdv bryevdv removed this from the short-term milestone Jun 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants