Created
February 7, 2016 14:52
-
-
Save aagarw30/f2531bc32bb3176a550c to your computer and use it in GitHub Desktop.
Example of R Shiny and googlevis package
This file contains hidden or 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
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)) | |
}) | |
}) | |
This file contains hidden or 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
library(shiny) | |
library(googleVis) | |
shinyUI(fluidPage( | |
titlePanel("GoogleVis example"), | |
sidebarLayout( | |
sidebarPanel( | |
h4("GoogleVis and Shiny") | |
), | |
mainPanel( | |
htmlOutput("bubble"), | |
htmlOutput("scatter"), | |
htmlOutput("guage") | |
) | |
)) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's really amazing to see Shiny and googleVis together.
Great Work