Learn R Programming

echarts4r (version 0.1.1)

e_showtip_p: Tooltip Proxy

Description

Proxies to show or hide tooltip.

Usage

e_showtip_p(proxy, position = c(10, 10), series.index = NULL,
  name = NULL)

e_hidetip_p(proxy)

Arguments

proxy

An echarts4r proxy as returned by echarts4rProxy.

position

Tooltip position.

series.index

Index of serie.

name

Name of serie.

Examples

Run this code
# NOT RUN {
   library(shiny)
 
   ui <- fluidPage(
     fluidRow(
       actionButton("show", "Show tooltip"),
       actionButton("hide", "Hide tooltip")
     ),
     fluidRow(
       echarts4rOutput("plot"),
       h3("clicked Data"),
       verbatimTextOutput("clickedData"),
       h3("clicked Serie"),
       verbatimTextOutput("clickedSerie"),
       h3("clicked Row"),
       verbatimTextOutput("clickedRow")
     )
   )
   
   server <- function(input, output, session){
     output$plot <- renderEcharts4r({
       mtcars %>% 
         e_charts(mpg) %>% 
         e_line(disp, bind = carb, name = "displacement") %>% 
         e_line(hp) %>% 
         e_x_axis(min = 10) %>% 
         e_theme("westeros") 
     })
     
     observeEvent(input$show, {
       echarts4rProxy("plot") %>% 
         e_showtip_p(0)
     })
     
     observeEvent(input$hide, {
       echarts4rProxy("plot") %>% 
         e_hidetip_p()
     })
     
     output$clickedData <- renderPrint({
       input$plot_clicked_data
     })
     
     output$clickedSerie <- renderPrint({
       input$plot_clicked_serie
     })
     
     output$clickedRow <- renderPrint({
       input$plot_clicked_row
     })
     
   }
   
   shinyApp(ui, server)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab