Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rCharts plot won't appear in shiny app using dimple.js

I came along with this problem, that rCharts plot won't show in my shiny app. I found this example which perfectly suits my needs. Even though this chart works perfectly while just plotting in R, in shiny it is an blank page.

I am not sure what is wrong with it. Firstly, I am not sure if I am choosing right library in showOuput(), but I didn't find any better solution.

I am trying to plot it more sophisticated app, however, I reproducing my simple app code below of server:

server.R

library(rCharts)
library(reshape2)
options(RCHART_WIDTH = 1700)
meansconferences <-read.csv("https://raw.github.com/patilv/ESPNBball/master/meansconferences.csv")

shinyServer(function(input, output) {
    output$test <- renderChart({
      meltmeansconferences=melt(meansconferences[-c(1,10:14)], id.vars=c("Conference","Year"))
      d1=dPlot(y="Year", x="value",data=meltmeansconferences, groups="variable",type="bar")
      d1$yAxis(type="addCategoryAxis", orderRule="Year")
      d1$xAxis(type="addPctAxis")
      return(d1)
    })
}
)

And ui:

ui.R
options(RCHART_LIB = 'dimple')

shinyUI(pageWithSidebar(

headerPanel("rCharts and shiny"),

sidebarPanel(),

mainPanel(
h4("Graph here"),
showOutput("test","dimple")
)
))

EDITED: I am using R version 3.0.2 and rCharts 0.4.2 shiny 0.8.0.99

If you have any ideas, just let me know. Thank you in advance!

like image 851
adomasb Avatar asked Feb 13 '14 15:02

adomasb


1 Answers

Posting my comment as an answer so that this question can be closed

Switch to renderChart2 or explicitly set d1$set(dom = "test") if you are using renderChart. I would recommend renderChart2, since I hope to combing the two functions in the next version.

like image 172
Ramnath Avatar answered Sep 29 '22 12:09

Ramnath