我正在构建一个闪亮的应用程序
我正在使用ggplot绘制图表.
当我鼠标悬停在图表上的点时,我想要一个工具提示,显示数据框中的一列(可自定义的工具提示)
能否请您建议最好的前进方向.
简单应用:
# ui.R
shinyUI(fluidPage(
sidebarLayout(
sidebarPanel(
h4("TEst PLot")),
mainPanel(
plotOutput("plot1")
)
)
))
# server.R
library(ggplot2)
data(mtcars)
shinyServer(
function(input, output) {
output$plot1 <- renderPlot({
p <- ggplot(data=mtcars,aes(x=mpg,y=disp,color=factor(cyl)))
p <- p + geom_point()
print(p)
})
}
)
Run Code Online (Sandbox Code Playgroud)
当我将鼠标悬停在点上时,我希望它显示mtcars $ wt