Search code examples
rgooglevisshiny

Combine R shiny and googlevis motion chart


I'd like to deploy a web site using R shiny with a googleVis motion chart, but when running the app, the motion chart showed up in another window in IE browser.

I'm wondering how the motion chart can show up together along with the R shiny. Thanks in advance.

server.R

  shinyServer(function(input, output) {

   project_sub<-subset(project_all, select=c("name", "generation",
                                      "man_cost", "quantity"))
   motionchart2<-gvisMotionChart(project_sub, "name", "year2") 

   output$view_gviz <- renderGvis
   ({
           plot(motionchart2)
   })
})

ui.R

  shinyUI(fluidPage(
     titlePanel("Analysis of Project NRE"),
     mainPanel(

        h1("Motion Chart"),
        h4("A Motion Chart is an alternative to providing a quick visual 
        overview ofprojects."),
        plotOutput("view_gviz")
      )
  ))

Solution

  • I ran into this problem. Try this in your ui.R

    # googleVis needs htmlOutput not usual PlotOutput
    htmlOutput("view_gviz")