shinyServer(function(input,output){
datasetInput <- reactive({
switch(input$dataset,
"Car model" = mtcars,
"Car sth" = attitude)
})
mymtc <- reactive({
dataset <- datasetInput()
d3heatmap(dataset, colors ="Blues", scale = "col", dendrogram = "none")
})
output$mtc<-renderD3heatmap(mymtc())
output$wrt<-renderDygraph({
dygraph(weather, main = "Weather: Rainfall and Temperature") %>%
dyRangeSelector(height = 60) %>%
dyAxis("y", label = "Temperature (C)",independentTicks = TRUE) %>%
dyAxis("y2", label = "Rainfall") %>%
dySeries("rainfall", axis = 'y2')
})
output$down <- downloadHandler(
filename = function() {
paste("myreport", input$report, sep = ".")
},
content = function(file){
if(input$report == "png")
png(file)
else
pdf(file)
mymtc()
dev.off()
}
)
})