我有一个应用程序,我想在其中使用 rCharts 和 polycharts 来创建带有工具提示的绘图。但是当我加载闪亮的应用程序时,情节没有出现,我不知道为什么。
这是我的 ui.R:
library(shiny)
require(rCharts)
shinyUI(fluidPage(
titlePanel("Please work..."),
sidebarLayout(
sidebarPanel( "Test:",
uiOutput("TestSelection")),
mainPanel("Plots (show me the money, please!):",
showOutput("tempplot","polycharts")
)
)
))
这是我的server.R:
library(shiny)
require(rCharts)
#Test of rcharts and shiny.
df1 <- read.csv("//KED-FILE/ASIC-Shared/users/jhertel/Work/R_workspace/oban_test_data.csv",quote="")
shinyServer(function(input, output, session){
output$TestSelection <- renderUI({
df <- df1
selectInput("TestSel", "Test Variable", ls(df, pattern = ".*?_meas|.*?_calc"))
})
output$tempplot <- renderChart2({
dataPlot <- df1[,c("DUT", input$TestSel, "Temperature")]
r1 <- rPlot(input$TestSel ~ Temperature,
data = dataPlot,
type = "point",
tooltip = "#!function(item){return item.DUT}!#",
sample = FALSE)
r1$guides(
x = list(
min = pretty( dataPlot$Temperature ) [1],
max = tail( pretty( dataPlot$Temperature ), 1 ),
numticks = length( pretty( dataPlot$Temperature ) ),
labels = pretty( dataPlot$Temperature )
),
y = list(
min = pretty( dataPlot[, input$TestSel] ) [1],
max = tail( pretty( dataPlot[, input$TestSel] ), 1 )
)
)
return(r1)
})
})
我尝试了不同的东西,例如options(RCHART_LIB = 'polycharts') ,在input$TestSel ~ Temperature周围使用as.formula,在 TestSelection-ui 上添加一个反应元素,我尝试将浏览器从内部更改为火狐,到 Chrome。
我怀疑input$TestSel ~ Temperature是原因,因为当我用 Chrome 检查 javascript 时,它看起来不像input$TestSel已被解释为所需的值。但我完全是 javascript 的菜鸟,所以我不知道。编辑:我相当肯定我的错误发生在这里,因为将更改的input$TestSel设置为所需的值会导致所需的情节......但仍然不知道如何解决它。
仅使用 R 时,该图会根据需要在查看器中显示。