Skip to content

Instantly share code, notes, and snippets.

@sriyoda
Created February 15, 2016 04:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sriyoda/96552588a4c1c1d2e7eb to your computer and use it in GitHub Desktop.
Save sriyoda/96552588a4c1c1d2e7eb to your computer and use it in GitHub Desktop.
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