I have a app, where I want to use rCharts and polycharts, to create a plot with a tooltip. But the plot doesn't show up, when I load the shiny app, and I can't figure out why.
Here is my 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")
)
)
))
And here's my 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)
})
})
I've tried different things, such as options(RCHART_LIB = 'polycharts'), using as.formula around input$TestSel ~ Temperature, adding a reactive element on the TestSelection-ui, I've tried changing browser, from internal, to Firefox, to Chrome.
I am suspecting the input$TestSel ~ Temperature to be the reason, as when I inspect the javascript with Chrome, it doesn't look like input$TestSel has been interpreted to the desired value. But I am a total noob to javascript, so I wouldn't know. EDIT: I am fairly certain that my error occurs here, as setting the changing input$TestSel to a desired value results in the desired plot... Still don't know how to solve it, though.
When just using R the plot shows up as desired in the viewer.