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

Basic Tooltips creation without html #100

Open
leopoletti opened this issue Apr 23, 2021 · 3 comments
Open

Basic Tooltips creation without html #100

leopoletti opened this issue Apr 23, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@leopoletti
Copy link

Hello,

It is more a feature request but I did not find how to create one.

It could be nice to be able to complete the hovertools by adding other column.
The best way I see could be in the same format as bokeh with a list of tuple:

TOOLTIPS = [
    ("index", "$index"),
    ("(x,y)", "($x, $y)"),
    ("desc", "@desc"),
]

that you get a basic funcy tooltips without to dive into html code

@PatrikHlobil
Copy link
Owner

Hi @leopoletti,

I had a look at the code and I would propose the following API change:

  1. Deprecation of hovertool_string
  2. Usage of hovertool parameter as:
    • string: Use HTML for Hovertool
    • List of tuples: pass to tooltips ( as shown above)
    • True (default): use default tooltips with passed columns
    • False: Do not use tooltips

This feature however needs some development and refactoring. As a quickfix, you can go to pandas-bokeh/plot.py and comment out the following 2 lines:
image

Hope this helps you,

best Patrik

@leopoletti
Copy link
Author

Hello @PatrikHlobil ,

It was not working since the code is based on string for hovertool_string and the new input is list of tuples.
Thus I change the code to this and its work as a first quick fix:

    if hovertool_string is not None:
        lstColumns=[tup[1] for tup in hovertool_string]
        lstColumns=[col.replace('@',"").replace('{',"").replace('}',"") for col in lstColumns]

        additional_columns=[col for col in lstColumns if col in df.columns ]

best Léopold

@PatrikHlobil
Copy link
Owner

hi @leopoletti ,

yes this seems better for now. However, as I mentioned above the whole API should be changed.

Best Patrik

@PatrikHlobil PatrikHlobil added the enhancement New feature or request label May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants