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

好久不见. 提交于 2019-12-10 13:01:08

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/21758583/rcharts-plot-wont-appear-in-shiny-app-using-dimple-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!