2014-10-08 183 views
1

我有我的数据集,挪威下面的代码,GoogleVis上闪亮R中

ui.R

library(googleVis) 

library(shiny) 

shinyUI(fluidPage(
    titlePanel("Visualization Tool"), 
    sidebarLayout(
    #headerPanel('Data Selection'), 
    sidebarPanel(

     selectInput('x', 'X Variable', choices = c("Demand", "CapacityWeek", "EstTotal", "NewTotal")), 
     selectInput('y', 'Y Variable', choices = c("Demand", "CapacityWeek", "EstTotal", "NewTotal")), 
     selectInput('w', 'Size', choices = c("Demand", "CapacityWeek", "EstTotal", "NewTotal")), 
     selectInput('z', 'colour', choices = c("PHYSICIAN","NURSE PRACTIONER")), 
     dateRangeInput("Date", label = h3("Date range")) 
    ), 
    mainPanel(
     htmlOutput("plot") 
    ) 
) 
) 
) 

server.R

library(shiny) 

library(googleVis) 

shinyServer(function(input, output){ 

    datasetInput <- reactive({Det[Det$Position %in% input$Position,]}) 

    output$chart <- renderPlot({ 

    M <- gvisMotionChart(Det, idvar="Clinic", timevar="Date", xvar=input$x, yvar=input$y, 

        colour=input$z, sizevar=input$w) 
    plot(M) 

     }) 

}) 

它不给我一个错误,但它不绘制运动图。请告诉我这段代码有什么问题。

+0

什么是Det? ... – jdharrison 2014-10-08 20:59:47

+0

这是我的数据表。 – user3439050 2014-10-08 21:54:11

回答

2

您需要在server.R文件中使用renderGvis而不是renderPlot

+0

我做了这个,但它不工作! – user3439050 2014-10-08 20:36:46

+2

我遇到了你的问题,因为我遇到了同样的问题。我在你的'ui.R'中注意到你的输出是“plot”,但在你的'server.R'中,你的输出是“chart”。 – Tom 2014-11-11 06:09:30