Ashmin Kaul
Ashmin Kaul

Reputation: 860

Implementing span to click on plot and move in R shiny

The given code creates a simple scatterPlot. I wish to click on the plot and move it in any direction that I want to, basically the span functionality. Attached the snapshot for references.Please help and thanks.

## 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)

Upvotes: 0

Views: 251

Answers (1)

amrrs
amrrs

Reputation: 6325

You can use 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)

Upvotes: 1

Related Questions