Thanks to Sharon Machlis for helping put this document together.
You can display a default tooltip by adding
e_tooltip() to the code that creates your visualization, such as
Note that you can change the trigger to
Where the specific information you’d like to appear goes within return().
Here’s what you need to know about adding variables into that return() code:
Here’s how you might customize a tooltip for a scatter plot of mtcars wt and mpg, in order to show both wt and mpg in the tooltip:
If you’d like to add information about a data frame column that’s not included in the chart, you can pass in that data using the bind argument. As an example, you might want to include the name of the car model in the tooltip. With this particular data set, you’d first need to create that column, which you can do with code such as
mtcars <- tibble::rownames_to_column(mtcars, "model"). Then, you can pass that column into your scatter plot visualization with
e_scatter(mpg, bind = model).