-
Notifications
You must be signed in to change notification settings - Fork 8
/
app.R
90 lines (80 loc) · 2.02 KB
/
app.R
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
## shinyglide modal example app
library(shiny)
library(shinyglide)
ui <- fixedPage(
titlePanel("shinyglide modal example"),
sidebarLayout(
sidebarPanel(
numericInput("mean", "Mean", value = 0),
numericInput("sd", "Standard deviation", value = 1, min = 0),
numericInput("n", "n", value = 100, min = 1),
p(
tags$a(
href = "https://github.com/juba/shinyglide/blob/master/inst/examples/03_modal/app.R",
"Source code on GitHub"
)
)
),
mainPanel(
plotOutput("plot")
)
)
)
server <- function(input, output, session) {
modal_controls <- glideControls(
list(
prevButton(),
firstButton(
class = "btn btn-danger",
`data-dismiss` = "modal",
"No, thanks !"
)
),
list(
nextButton(),
lastButton(
class = "btn btn-success",
`data-dismiss` = "modal",
"Done"
)
)
)
glide_modal <- modalDialog(
title = "Startup assistant",
easyClose = FALSE,
footer = NULL,
glide(
custom_controls = modal_controls,
screen(
next_label = 'Yes, please ! <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>',
p("Let's initialize some values, would you ?")
),
screen(
p("First, please select a mean value"),
numericInput("mean_modal", "Mean", value = 0)
),
screen(
p("Next, please select a standard deviation value"),
numericInput("sd_modal", "Standard deviation", value = 1, min = 0)
),
screen(
p("Thanks, we're all set !")
)
)
)
showModal(glide_modal)
output$plot <- renderPlot({
hist(rnorm(req(input$n), req(input$mean), req(input$sd)),
main = "Such wow",
xlab = "Wonderful x values",
ylab = "Incredible frequencies"
)
})
observe({
updateNumericInput(session, "mean", value = input$mean_modal)
})
observe({
updateNumericInput(session, "sd", value = input$sd_modal)
})
}
shinyApp(ui, server)