GithubHelp home page GithubHelp logo

cpsievert / shinyfullscreen Goto Github PK

View Code? Open in Web Editor NEW

This project forked from etiennebacher/shinyfullscreen

0.0 1.0 0.0 2.01 MB

Display HTML Elements on Full Screen in 'Shiny' Apps Using 'Screenfull.js'

License: Other

R 100.00%

shinyfullscreen's Introduction

shinyfullscreen

Codecov.io test coverage R build status CRAN status

The goal of {shinyfullscreen} is to enable users to put some items on fullscreen. This package is the adaptation in R of screenfull.js.

Table of contents

Demos

  • Two plots can be displayed on full screen

  • Interactive graphs and custom background color on fullscreen only

Installation

Install the CRAN version with:

install.packages("shinyfullscreen")

Install the development version with:

# install.packages("devtools")
devtools::install_github("etiennebacher/shinyfullscreen")

How to use

Note that {shinyfullscreen} only works when the Shiny app is launched in the browser. It won't work in an RStudio window.

This package provides three functions that are very similar:

  • fullscreen_this() is useful if you want to enable fullscreen for few elements. Simply wrap this function around the element for which you want to enable fullscreen, and then click on this element when the app runs to display it on fullscreen:
### Only works in browser

library(shiny)
library(shinyfullscreen)

ui <- fluidPage(

  fullscreen_this(plotOutput("plot"))
  
  # Also works with magrittr's pipe
  # plotOutput("plot") %>%
  #   fullscreen_this()
)

server <- function(input, output, session) {
  
  output$plot <- renderPlot(plot(mtcars))
  
}

shinyApp(ui, server, options = list(launch.browser = TRUE))
  • fullscreen_those() is useful if you want to enable fullscreen view for several items without rewriting the same code again and again. Simply write your UI as usual, and then call this function with a list of ids corresponding to the items for which you want to enable fullscreen view. Note that this function has to be called after having created these items:
### Only works in browser

library(shiny)
library(shinyfullscreen)

ui <- fluidPage(
  plotOutput("plot"),
  plotOutput("plot2"),
  
  # Has to be placed after plot and plot2
  fullscreen_those(items = list("plot", "plot2"))
)

server <- function(input, output, session) {
  
  output$plot <- renderPlot(plot(mtcars))
  output$plot2 <- renderPlot(plot(AirPassengers))
  
}

shinyApp(ui, server, options = list(launch.browser = TRUE))
  • fullscreen_all() allows you to put the whole page in fullscreen mode. Note however that this requires clicking on an HTML element.
### Only works in browser

library(shiny)
library(shinyfullscreen)

ui <- fluidPage(
  actionButton("page_full", "Show page in fullscreen"),
  plotOutput("plot"),
  fullscreen_all(click_id = "page_full")
)

server <- function(input, output, session) {

  output$plot <- renderPlot(plot(mtcars))

}

shinyApp(ui, server, options = list(launch.browser = TRUE))

Code of Conduct

Please note that the shinyfullscreen project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

shinyfullscreen's People

Contributors

etiennebacher avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.