Skip to content

Instantly share code, notes, and snippets.

@aagarw30
Created February 7, 2016 14:52
Show Gist options
  • Save aagarw30/f2531bc32bb3176a550c to your computer and use it in GitHub Desktop.
Save aagarw30/f2531bc32bb3176a550c to your computer and use it in GitHub Desktop.
Example of R Shiny and googlevis package
library(shiny)
library(googleVis)
shinyServer(function(input, output, session){
output$bubble <- renderGvis({
gvisBubbleChart(Fruits, idvar="Fruit",
xvar="Sales", yvar="Expenses",
colorvar="Year", sizevar="Profit",
options=list(title = "An example of Bubble Chart",
hAxis='{title: "Sales", minValue:75, maxValue:125}',
vAxis='{title: "Expenses"}'
)
) })
output$scatter <- renderGvis({
gvisScatterChart(women,
options=list(
legend="none",
lineWidth=0, pointSize=1,
title="Example of Scatterplot using Women dataset", vAxis="{title:'weight (lbs)'}",
hAxis="{title:'height (in)'}",
width=300, height=300))
})
output$guage <- renderGvis({
gvisGauge(CityPopularity,
options=list(title= 'Example of Guage', min=0, max=800, greenFrom=500,
greenTo=800, yellowFrom=300, yellowTo=500,
redFrom=0, redTo=300, width=400, height=300))
})
})
library(shiny)
library(googleVis)
shinyUI(fluidPage(
titlePanel("GoogleVis example"),
sidebarLayout(
sidebarPanel(
h4("GoogleVis and Shiny")
),
mainPanel(
htmlOutput("bubble"),
htmlOutput("scatter"),
htmlOutput("guage")
)
))
)
@isingh09
Copy link

It's really amazing to see Shiny and googleVis together.
Great Work

@fissehab
Copy link

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment