Created
February 15, 2016 04:01
-
-
Save sriyoda/96552588a4c1c1d2e7eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
output$calendar <- renderGvis({ | |
gvisCalendar(flights_by_day, datevar="date", numvar="count", | |
options=list( | |
title="Daily flight count in the United States", | |
height=400, | |
calendar="{yearLabel: { fontName: 'Times-Roman', | |
fontSize: 32, color: '#1A8763', bold: true}, cellSize: 10, | |
cellColor: { stroke: 'red', strokeOpacity: 0.2 }, | |
focusedCellColor: {stroke:'red'}}", | |
gvis.listener.jscode = "var selected_date = data.getValue(chart.getSelection()[0].row,0);var parsed_date = selected_date.getFullYear()+'-'+(selected_date.getMonth()+1)+'-'+selected_date.getDate(); | |
Shiny.onInputChange('selected_date',parsed_date)") | |
) | |
}) | |
flightsOutput <- reactive({ | |
date <- givs.listener.jscode #capturing user input | |
cat(date) | |
}) | |
observe( | |
if (!is.null(input$selected_date)) { | |
output$flights <- DT::renderDataTable(DT::datatable({ #Creating DataTable | |
data <- flights_by_year #loading data | |
data <- filter(data, data$date == input$selected_date) #filtering data by user input | |
data | |
}))} | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment