r - 强制 Shiny 的应用程序在移动设备上显示桌面 View

标签 r mobile deployment shiny

我正在将 shiny 应用程序部署到 shinyapps.io。它旨在与桌面浏览器一起使用,但在移动设备上访问该应用程序时,它会更改为移动 View (这很酷但在这种情况下没有用)。

知道如何为 Shiny 的应用程序强制桌面 View 吗?

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

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

最佳答案

这个问题有你需要的,包括 <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

关于r - 强制 Shiny 的应用程序在移动设备上显示桌面 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49919317/

相关文章:

r - Poisson MLE 的手工 R 代码

windows - Cordova Windows Universal App websockets 不工作

java - 如何从应用程序 (Android) 中禁用/启用移动数据

git - 使用gitlab自动部署

deployment - 在 gitlab 中自动运行构建

ruby-on-rails - 如何在自定义 capistrano 任务中使用事务?

performance - R和Matlab速度之间的差异

r - Quandl、Quantmod 或 TrueFX 每小时数据

r - 如何在 R 中将因子级别转换为列表

javascript - react : onClick on Mobile (iPhone) requires 2 taps?