How to disable tooltip when hovering on label in e_mark_line in echarts4r

Viewed 9

I am building a scatter chart in echarts4r and have added a markline to represent the average with a label that indicates the average value of the axis. However, on hovering on the label, the tooltip of one of the items in the chart appears. All my attempt to remove it has failed till now.

Grateful if anyone can help me with this. A code example with the problem is shown below.

library(dplyr)
library(plyr)
library(echarts4r)

mydata <- data.frame(Sector_Description= c('Wood','Vehicle', 'Vegetables'),
                     y = c(10, 8, 16),
                     x = c(5,7, 3),
                     tradevalue = c(316, 266, 356))


avg_y <- mean(mydata[,2])

mydata %>%
  e_charts(x) %>%
  e_scatter(
    y,
    tradevalue,
    label = list(
      show = TRUE,
      color = "black",
      fontSize = 10,
      position = "right",
      formatter = htmlwidgets::JS(
        "function(params){
          return(params.data.sector.Sector_Description)
                          }"
      )
    ),
    labelLayout = list(hideOverlap = TRUE, dy = 0)
  )  %>%
  e_add_nested('sector', Sector_Description) |>
  e_tooltip(
    trigger= 'item',formatter = htmlwidgets::JS("function(params){
       return(
      '<strong>Sector: </strong>' + params.data.sector.Sector_Description +
   '<br/><strong>X: </strong>' + (params.value[0]) +
    '<br/><strong>Y: </strong>' +  (params.value[1]) )   }  "
    )
  ) %>% e_hide_grid_lines() %>%
  e_y_axis(
           axisLine = list(lineStyle = list(color = "#F0F0F0")),
           axisLabel = list(color = "#000000" )
  ) %>%
  e_x_axis(
    axisLine = list(lineStyle = list(color = "#F0F0F0")),
    axisLabel = list(color = "#000000")
  ) %>%
  e_mark_line(symbol = "none",emphasis = list(disabled = TRUE),
              label = list(triggerTooltip = FALSE,
                color = "#000000",silient= FALSE),
              data = list(yAxis =avg_y ))
0 Answers
Related