强制闪亮的应用程序在移动设备上显示桌面视图

时间:2018-04-19 10:54:39

标签: r mobile deployment shiny

我正在为shinyapps.io部署一个闪亮的应用程序。它设计用于桌面浏览器,但在移动设备上访问应用程序时,它会更改为移动视图(这很酷但在这种情况下无用)。

任何想法如何强制桌面视图的闪亮应用程序?

我尝试了这个答案:How to force desktop view on mobile devices - Bootstrap?但是没有让它发挥作用。

(不幸的是没有javascript经验......)

1 个答案:

答案 0 :(得分:3)

该问题符合您的要求,请在<meta>中添加HTML标记:

library(shiny)

# Define UI for application that draws a histogram
ui <- fluidPage(

   HTML('<meta name="viewport" content="width=1024">'),

   # Application title
   titlePanel("Old Faithful Geyser Data"),

   # Sidebar with a slider input for number of bins
   sidebarLayout(
      sidebarPanel(
         sliderInput("bins",
                     "Number of bins:",
                     min = 1,
                     max = 50,
                     value = 30)
      ),

      # Show a plot of the generated distribution
      mainPanel(
         plotOutput("distPlot")
      )
   )
)

# Define server logic required to draw a histogram
server <- function(input, output) {

   output$distPlot <- renderPlot({
      # generate bins based on input$bins from ui.R
      x    <- faithful[, 2]
      bins <- seq(min(x), max(x), length.out = input$bins + 1)

      # draw the histogram with the specified number of bins
      hist(x, breaks = bins, col = 'darkgray', border = 'white')
   })
}

# Run the application
shinyApp(ui = ui, server = server)

没有标记:

enter image description here

标记后:

enter image description here

相关问题