tool_hover: Add "hover" tool to a Bokeh figure

View source: R/fig_tool.R

tool_hoverR Documentation

Add "hover" tool to a Bokeh figure

Description

Add "hover" tool to a Bokeh figure

Usage

tool_hover(fig, callback, ref_layer)

Arguments

fig

figure to modify

callback

a callback to be applied to this tool - either a character string of javascript code or any one of debug_callback, shiny_callback, console_callback, custom_callback

ref_layer

name of the layer that the callback should be applied to

Note

Tools can be easily specified as a vector of tool names in the tools argument when instantiating a figure. In this case, they are added with defaults. Explicitly calling these tool_ functions will manually add the tool to a figure and allow additional specification of parameters.

See Also

Other tools: tool_box_select(), tool_box_zoom(), tool_crosshair(), tool_lasso_select(), tool_pan(), tool_reset(), tool_resize(), tool_save(), tool_tap(), tool_wheel_zoom()

Examples


# hover over the blue points and make the orange points move
figure(title = "hover a blue point") %>%
  ly_points(1:10, lname = "blue", lgroup = "g1") %>%
  ly_points(2:12, lname = "orange", lgroup = "g1") %>%
  tool_hover(custom_callback(
    code = "debugger;if(cb_data.index['1d'].indices.length > 0)
    orange_data.get('data').x[cb_data.index['1d'].indices] += 0.1
    orange_data.trigger('change')", "orange"), "blue")


bokeh/rbokeh documentation built on Nov. 3, 2023, 2:36 a.m.