Last active
December 13, 2015 20:38
-
-
Save mages/4970975 to your computer and use it in GitHub Desktop.
Example of renderGvis by Joe Cheng
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
# Contributed by Joe Cheng, February 2013 | |
# Requires googleVis version 0.4.0 and shiny 0.4.0 or higher | |
# server.R | |
library(googleVis) | |
library(shiny) | |
shinyServer(function(input, output) { | |
datasetInput <- reactive({ | |
switch(input$dataset, | |
"rock" = rock, | |
"pressure" = pressure, | |
"cars" = cars) | |
}) | |
output$view <- renderGvis({ | |
gvisScatterChart(datasetInput(), options=list(width=400, height=450)) | |
}) | |
}) |
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
# ui.R | |
shinyUI(pageWithSidebar( | |
headerPanel("Example 1: scatter chart"), | |
sidebarPanel( | |
selectInput("dataset", "Choose a dataset:", | |
choices = c("rock", "pressure", "cars")) | |
), | |
mainPanel( | |
htmlOutput("view") | |
) | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment