2016-02-12 127 views
2
server <- function (input , output ) 
{ 
    output$bar_plot <- renderPlot( 
     { 
      input$click 
      inFile <- input$file1 
      if (is.null(inFile)) 
       return(NULL) 
      mydata <- read.csv(inFile$datapath) 
      resources <- factor (mydata$Resource.Name) 
      stan <- tapply (mydata$Standard.Hours,resources, sum , na.rm=TRUE) 
      bil <- tapply (mydata$Billable.Hours,resources, sum , na.rm=TRUE) 
      bu <- bil*100/stan 
      mp <- barplot (bu,col=colors(27),las=2,yaxt="n",ylim=c(0,200),main="Billable  Utilization India-DSI") 
      bu<- round(bu,2) 
      text(mp, bu,labels=bu, pos = 3) 
     } 
    ) 
} 

这是我server.r code.I已经创建了输入ID“点击”动作按钮生成barplot但一旦我上传的文件,而无需点击操作按钮的图表中直接生成我应该在代码中做些什么改变?我试着用eventReactive,但结果仍然是相同的闪亮服务器和应用程序光泽

回答

1

您应该使用

shiny server <- function (input, output) 
{ 
    plot <- eventReactive (input $click, 
    { 
     [code to develop plot] 
    } 
) 

output$bar_plot <- renderPlot ({ plot() }) 
} 
+0

谢谢! @Benjamin –

相关问题