hostessLoader: Loader

Description Usage Arguments Presets Examples

Description

Customise the Hostess laoding bar.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
hostess_loader(
  id = "hostess",
  preset = NULL,
  text_color = "#FFFFFF",
  center_page = FALSE,
  class = "",
  min = 0,
  max = 100,
  svg = NULL,
  progress_type = c("stroke", "fill"),
  fill_direction = c("btt", "ttb", "ltr", "rtl"),
  stroke_direction = c("normal", "reverse"),
  fill_color = NULL,
  stroke_color = NULL,
  ...
)

hostess_gradient(angle = 0, duration = 1, colors = c("red", "white", "blue"))

hostess_bubble(
  color_background = "#697682",
  color_bubble = "#f7fff7",
  count = 25,
  duration = 1
)

hostess_stripe(color1 = "#697682", color2 = "#f7fff7", duration = 1)

Arguments

id

Id of hostess (valid CSS).

preset

A loading bar preset, see section below.

text_color

The color of the loading text.

center_page

By default the hostess is not centered in the middle of the screen, centering in the middle of the page is however ideal when using it with waiter full screen, for the latter set to TRUE.

class

CSS class.

min, max

Minimum and maximum representing the starting and ending points of the progress bar.

svg

Either an svg path e.g.: M10 10L90 10 or the path to a .svg file. Note that if passing the latter it must be made available to Shiny by placing it either in the www folder or using shiny::addResourcePath().

progress_type

The progress type, either stroke or fill. Ther former traces the path of the svg while the latter fills it progressively.

fill_direction, stroke_direction

The direction which the progress bar should take. Wether fill_direction or stroke_direction is used depends on progress_type.

fill_color, stroke_color

The color to use for the progress bar. Wether fill_color or stroke_color is used depends on progress_type.

...

Any other other advanced options to pass to the loaded see the official documentation.

angle

Angle of gradient.

duration

Duration of the loop.

colors

Color vectors composing the gradient.

color_background

The background of the color.

color_bubble

The color of the bubbles contour.

count

The number of bubbles.

color1, color2

Colors of stripes.

Presets

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
library(shiny)
library(waiter)

# diagonal line
path <- "M10 10L90 30"

ui <- fluidPage(
 use_waiter(),
 use_hostess(),
 actionButton("draw", "redraw"),
 plotOutput("plot")
)

server <- function(input, output) {

 dataset <- reactive({
   input$draw

   hostess <- Hostess$new(min = 0, max = 10)
   hostess$set_loader <- hostess_loader(
     progress_type = "stroke",
     stroke_color = hostess_stripe()
   )
   waiter <- Waiter$new(
     "plot", 
     hostess$loader()
   )

   waiter$show()

   for(i in 1:10){
     Sys.sleep(.2)
     hostess$inc(1)
   }

   runif(100)

 })

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

}

if(interactive()) shinyApp(ui, server)

waiter documentation built on Jan. 16, 2021, 5:39 p.m.