Wednesday 1 September 2021

add relevant information tooltip echarts4r boxplot outliers

I am trying to add some relevant hover information to the tooltip of a echarts4r plot. I want to make an boxplot that shows the user the name (or some other information) of the outliers. This is somewhat related to Add extra variables to tooltip pie chart echarts4r and Add extra variables to tooltip pie chart echarts4r, but those solutions do not work as bind = does not work for e_boxplot.

This is what I have so far

library(echarts4r)

df <- data.frame(
  my_name = letters[1:11],
  x = c(1:10, 25),
  y = c(1:10, -6)
) 

df |>
  e_charts() |>
  e_boxplot(y, outliers = TRUE) |>
  e_boxplot(x, outliers = TRUE) |>
  e_tooltip(formatter = htmlwidgets::JS("
                                        function(params)
                                        {
                                            return `<strong>${params.name}</strong>
                                                    <br/>val: ${params.value[1]}
                                                    <br/>name: ${params.my_name}`
                                        }  "))




from add relevant information tooltip echarts4r boxplot outliers

No comments:

Post a Comment