Here's a plot made with {echarts4r} that comes from this answer on GitHub:
library(echarts4r)
library(tibble)
mtcars %>%
rownames_to_column("model") %>%
e_charts(mpg) %>%
e_y_axis(drat) %>%
e_scatter(drat, symbol_size = 15, bind = model, scale = NULL) %>%
e_tooltip(formatter = htmlwidgets::JS("
function(params){
return('<strong>' + params.name +
'</strong><br />x-axis: ' + params.value[0] +
'<br />y-axis: ' + params.value[1]
)}
"))
As you can see, the name of the car model and the values are displayed when you hover a point. However, I don't know how to display the variable names in the same way. I know I could manually replace "x-axis" and "y-axis" with their names but I would like to do it automatically.
I checked the documentation of echarts about this, but using {a} (for example) does not work.
Any idea?
Edit: I use echarts4r 0.3.3