2016-02-12 94 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 –

相關問題