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

Add hover_tooltips, hover_formatters, hover_mode #1385

Merged
merged 2 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions doc/user_guide/Customization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@
" hover_cols (default=[]): list or str\n",
" Additional columns to add to the hover tool or 'all' which will\n",
" includes all columns (including indexes if use_index is True).\n",
" hover_tooltips list[str] or list[tuple]:\n",
" A list of dimensions to be displayed in the hover tooltip. See\n",
" [HoloViews docs](https://holoviews.org/user_guide/Plotting_with_Bokeh.html#hover-tools)\n",
" or [Bokeh docs](https://docs.bokeh.org/en/latest/docs/user_guide/interaction/tools.html#hovertool)\n",
" for more info on structuring.\n",
" hover_formatters:\n",
" A dict of formatting options for the hover tooltip.\n",
" hover_mode (default='mouse'):\n",
" The hover mode determines how the hover tool is activated;\n",
" select from 'mouse', 'vline', or 'hline'.\n",
" invert (default=False): boolean\n",
" Swaps x- and y-axis\n",
" frame_width/frame_height: int\n",
Expand Down
15 changes: 15 additions & 0 deletions hvplot/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ class HoloViewsConverter:
hover_cols (default=[]): list or str
Additional columns to add to the hover tool or 'all' which will
includes all columns (including indexes if use_index is True).
hover_tooltips list[str] or list[tuple]:
A list of dimensions to be displayed in the hover tooltip.
hover_formatters:
A dict of formatting options for the hover tooltip.
hover_mode (default='mouse'):
The hover mode determines how the hover tool is activated.
hoxbro marked this conversation as resolved.
Show resolved Hide resolved
invert (default=False): boolean
Swaps x- and y-axis
frame_width/frame_height: int
Expand Down Expand Up @@ -550,6 +556,9 @@ def __init__(
logy=None,
loglog=None,
hover=None,
hover_tooltips=None,
hover_formatters=None,
hover_mode=None,
subplots=False,
label=None,
invert=False,
Expand Down Expand Up @@ -818,6 +827,12 @@ def __init__(
else:
tools.append('hover')
plot_opts['tools'] = tools
if hover_tooltips:
plot_opts['hover_tooltips'] = hover_tooltips
if hover_formatters:
plot_opts['hover_formatters'] = hover_formatters
if hover_mode:
plot_opts['hover_mode'] = hover_mode

if self.crs and global_extent:
plot_opts['global_extent'] = global_extent
Expand Down
Loading