实现跨度点击情节并移动R闪亮

时间:2017-09-22 09:37:04

标签: r shiny shinydashboard

给定代码创建一个简单的scatterPlot。我希望点击绘图并将其移动到我想要的任何方向,基本上是跨度功能。附上快照供参考。请帮助和谢谢。

## app.R ##
library(shiny)
library(shinydashboard)
library(bupaR)
library(edeaR)
library(eventdataR)
library(processmapR)
library(processmonitR)
library(xesreadR)
library(lubridate)
library(dplyr)
library(knitr)
library(XML)
library(xml2)
library(data.table)
library(ggplot2)
library(ggthemes)
library(glue)
library(tibble)
library(miniUI)
library(tidyr)
library(shinyTime)
library(petrinetR)
library(magrittr)
library(shinyWidgets)
library(DiagrammeR)
ui <- dashboardPage(
dashboardHeader(title = "Zoom and Reset Dashboard",titleWidth = 290),
dashboardSidebar(
width = 0
),
dashboardBody(
# Creation of tabs and tabsetPanel
tabsetPanel(type = "tab",
            tabPanel("Resource Dashboard", 
                     fluidRow(column(10,
                                     grVizOutput("res_freq_plot")))),
            id= "tabselected"
)
))
server <- function(input, output) 
{ 
 output$res_freq_plot <- renderDiagrammeR(
 {
  patients %>% process_map()
 }
 )
 }
 shinyApp(ui, server)

1 个答案:

答案 0 :(得分:1)

您可以使用plotly

## app.R ##
library(shiny)
library(plotly)
library(shinydashboard)
ui <- dashboardPage(
  dashboardHeader(title = "Zoom and Reset Dashboard",titleWidth = 290),
  dashboardSidebar(
    width = 0
  ),
  dashboardBody(
    # Creation of tabs and tabsetPanel
    tabsetPanel(type = "tab",
                tabPanel("Resource Dashboard", 
                         fluidRow(column(10,
                                         plotlyOutput("res_freq_plot")))),
                id= "tabselected"
    )
  ))
server <- function(input, output) 
{ 
  output$res_freq_plot <- renderPlotly(
    {
      plot_ly(iris, x= iris$Petal.Length,  y = iris$Sepal.Length)
    }
  )
}
shinyApp(ui, server)