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

Plot tooltips #369

Open
caxelrud opened this issue May 10, 2022 · 4 comments
Open

Plot tooltips #369

caxelrud opened this issue May 10, 2022 · 4 comments
Labels
feature request New feature or request Informational Kept open for instructional use and help

Comments

@caxelrud
Copy link

How to add plot tooltips, since it is a parameter of figure and not an extra parameter of the plot (as bar and line)?
Here an example from Bokeh documentation.

TOOLTIPS = [
    ("index", "$index"),
    ("(x,y)", "($x, $y)"),
    ("desc", "@desc"),
]
p = figure(width=400, height=400, tooltips=TOOLTIPS,
           title="Mouse over the dots")
p.circle('x', 'y', size=20, source=source)
show(p)
@caxelrud caxelrud added ? - Needs Triage Need team to review and classify feature request New feature or request labels May 10, 2022
@AjayThorve
Copy link
Member

In cuxfilter, for bar and line charts, the .chart api option exposes the bokeh plot object underneath, and can be updated using the add_tools function to add hover options.

Here is a snippet to add hover options to the bar chart:

import cudf
import cuxfilter
from bokeh.models import HoverTool

cux_df = cuxfilter.DataFrame.from_dataframe(cudf.DataFrame({'key': [0, 1, 2, 3, 4], 'val':[float(i + 10) for i in range(5)]}))
bar_chart_1 = cuxfilter.charts.bar('key', 'val', data_points=5, add_interaction=False)

d = cux_df.dashboard([bar_chart_1])

#add tools
bar_chart_1.chart.add_tools(HoverTool(tooltips=[
    ("index", "$index"),
    ("(x,y)", "($x, $y)")
]))

bar_chart_1.view()

image

@exactlyallan
Copy link
Member

@AjayThorve Keep this issue open for now - I think this would be a good addition into the docs.

@github-actions
Copy link

This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.

@github-actions
Copy link

This issue has been labeled inactive-90d due to no recent activity in the past 90 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed.

@AjayThorve AjayThorve added Informational Kept open for instructional use and help and removed ? - Needs Triage Need team to review and classify labels Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request Informational Kept open for instructional use and help
Projects
Status: Informational
Development

No branches or pull requests

3 participants