2016-02-17 64 views
1

我使用閃亮,我不能得到一個密謀圖出現。它出現之前,我不知道是什麼改變了。密謀圖不顯示

MRE:

global.r(或將此放入server.r)

library(shinydashboard) 
library(plotly) 

server.r

shinyServer(function(input, output, session) { 

    output$plotlyGraph <- renderPlotly({ 
    input$regraph 
    print("graphing...") 
    return(plot_ly(list(blank = 0))) 
    }) 

}) 

ui.r

dashboardPage(
     dashboardHeader(title = "The Title"), 
     dashboardSidebar(
     actionButton("regraph", "graph again") 
    ), 
     dashboardBody(
     box(plotlyOutput("plotlyGraph")) 
    ) 
    ) 

ř版本3.2.3

閃亮的13.0版本

shinydashbaord 0.5.1

plotly 2.0.16

空環境

我注意到,當我運行上面的代碼,我得到一個錯誤 Error in gregexpr(calltext, singleline, fixed = TRUE) : regular expression is invalid UTF-8.

經過debug(gregexpr)的進一步調查,我看到這個

Called from: inherits(x, "ggplot") 
debugging in: gregexpr(calltext, singleline, fixed = TRUE) 
debug: { 
    if (!is.character(text)) 
     text <- as.character(text) 
    .Internal(gregexpr(as.character(pattern), text, ignore.case, 
     perl, fixed, useBytes)) 
} 
Browse[2]> text 
[1] "function (x) inherits(x, \"ggplot\")" 

不知道該怎麼做。是否真的有一些內置的代碼可以修改後來評估爲函數的字符串?

我發現了另一個程序,我在那裏的情節圖呈現罰款。 gregrexpr()永遠不會被調用。縱觀生成的HTML,有問題的人有這種風格下

width: 100%; height: 400px; visibility: hidden; 

而那些可見有

width: 100%; height: 400px; visibility: inherit; 

所以我想這是有關(雖然因果關係方向不明......)

+0

時是否設置斷點它發生之前做更多的工作? RStudio存在這樣的問題:https://groups.google.com/forum/#!topic/shiny-discuss/j-qY_rIBpkQ –

回答

1
renderPlotly({ 
return(plot_ly(x)) 
}) 

已損壞。

renderPlotly(plot_ly(x)) 

的作品。

在渲染plotly,這樣做

renderPlotly(yourFunctThatGeneratesAPlotly(input$Whatever))