-
Notifications
You must be signed in to change notification settings - Fork 7
/
app.R
38 lines (31 loc) · 1020 Bytes
/
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
library(shiny)
library(coindeskr) #R-Package connecting to Coindesk API
library(dygraphs)
last31 <- get_last31days_price()
ui <- shinyUI(
fluidPage(
titlePanel('Bitcoin USD Price for Last 31 days'),
mainPanel(
h3('Minimum'),
h3(htmlOutput('minprice')),
h3('Maximum'),
h3(htmlOutput('maxprice')),
dygraphOutput("btcprice")
)
))
server <- function(input,output){
output$minprice <- renderText(
paste('Price : $', min(last31), '<br>Date :', rownames(last31)[which.min(last31$Price)] )
)
output$maxprice <- renderText(
paste('Price : $', max(last31), '<br>Date :', rownames(last31)[which.max(last31$Price)] )
)
output$btcprice <- renderDygraph(
dygraph(data = last31, main = "Bitcoin USD Price for Last 31 days") %>%
dyHighlight(highlightCircleSize = 5,
highlightSeriesBackgroundAlpha = 0.2,
hideOnMouseOut = FALSE, highlightSeriesOpts = list(strokeWidth = 3)) %>%
dyRangeSelector()
)
}
shinyApp(ui,server)