【发布时间】:2019-10-14 13:35:54
【问题描述】:
我使用 ggplot2 和 plotly 开发了一个闪亮的应用程序,但是,对于我添加为上限和下限的两条水平线,悬停文本没有正确显示。我想隐藏这两行的悬停文本。有人知道怎么实现吗?
我找到了一种解决方案,但它不适用于闪亮
Disable hover information for a specific layer (geom) of plotly
library(shiny)
shinyServer(
function(input,output,session){
reactivelab <- reactive({
gg <-labn %>% filter(PARCAT2 == input$Group & LBTEST ==
input$Par & SUBJID == input$ID) })
output$labpot <- renderPlotly({
req(nrow(reactivelab()) > 0)
q <- ggplot(data=reactivelab(),aes(x=ADY, y=AVAL))+
geom_point()+geom_line()+
geom_hline(aes(yintercept=ANRLO),linetype="longdash")+
geom_hline(aes(yintercept=ANRHI),linetype="longdash")+
ylab("Lab Standard Value") + xlab("Lab Test Day")
mm <- style(q, text = paste("Lab Parameter:", reactivelab()$PARAM,
"<br>Lab Test Day:", reactivelab()$ADY,
"<br>Lab Standard Value:", reactivelab()$AVAL,
"<br>Normal Range Upper Limit:", reactivelab()$ANRHI,
"<br>Normal Range Lower Limit:", reactivelab()$ANRLO
), hoverinfo = "text")})
})
【问题讨论】: