-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.R
More file actions
31 lines (25 loc) · 773 Bytes
/
app.R
File metadata and controls
31 lines (25 loc) · 773 Bytes
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
library(shiny)
library(sparklines)
library(colourpicker)
# devtools::install_github("hadley/shinySignals")
library(shinySignals)
ui <- fluidPage(
titlePanel("React Sparklines"),
sparklinesOutput('sparklines'),
colourInput("color_curve", "Curve color", "#253e56"),
colourInput("color_spots", "Spots color", "#56b45d")
)
nextWindow <- function(prev = round(runif(100, 0, 10)), t = NULL) {
c(prev[-1], round(runif(1, 0, 10)))
}
server <- function(input, output, session) {
data <- reducePast(fps(1), nextWindow, nextWindow())
output$sparklines <- renderSparklines(
sparklines(data = data(),
curve(color = input$color_curve),
spots(style = list(fill = input$color_spots)),
reference_line(type = "avg")
)
)
}
shinyApp(ui, server)