我的数据集Det有以下代码,
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 :(得分:2)
您需要在renderGvis
文件中使用renderPlot
代替server.R
。