cosname / recharts

An interface to ECharts
https://recharts.cosx.org
BSD 3-Clause "New" or "Revised" License
337 stars 150 forks source link

Can't see echarts plot in shiny #24

Closed shenfei closed 8 years ago

shenfei commented 9 years ago

I can't see echarts plot when I use recharts in shiny app. Here is a reproducible example:

# server.R
library(shiny)

shinyServer(function(input, output) {
  library(recharts)
  option(shiny.transcode.json = FALSE)

  output$res <- renderEcharts({
    recharts.init()
    eBarOutput <- eBar(iris[1:6, 1:4])
    return(eBarOutput)
  })
})
# ui.R
library(shiny)
library(recharts)

shinyUI(fluidPage(
  titlePanel('test recharts shiny'),
  sidebarLayout(
    sidebarPanel(),
    mainPanel(
      includeHTML(recharts.shiny.init()),
      htmlOutput('res')
    )
  )
))

And I tried demo(recharts::recharts_shiny), still couldn't see the results. However, plot(eBar(iris[1:6, 1:4])) will show echarts plot correctly.

I got the same result in both Ubuntu(12.04) and OS X(10.10). See sessioninfo below:

> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)

locale:
[1] zh_CN.UTF-8/zh_CN.UTF-8/zh_CN.UTF-8/C/zh_CN.UTF-8/zh_CN.UTF-8

attached base packages:
[1] tools     stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
[1] recharts_0.01  shiny_0.11     RJSONIO_1.3-0  colorout_1.0-3

loaded via a namespace (and not attached):
[1] digest_0.6.8    htmltools_0.2.6 httpuv_1.3.2    mime_0.2       
[5] R6_2.0.1        Rcpp_0.11.3     xtable_1.7-4
> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=zh_CN.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=zh_CN.UTF-8        LC_COLLATE=zh_CN.UTF-8    
 [5] LC_MONETARY=zh_CN.UTF-8    LC_MESSAGES=zh_CN.UTF-8   
 [7] LC_PAPER=zh_CN.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=zh_CN.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] tools     stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] recharts_0.01   RJSONIO_1.2-0.2 shiny_0.9.1    

loaded via a namespace (and not attached):
[1] bitops_1.0-6 caTools_1.17 digest_0.6.4 httpuv_1.3.0 Rcpp_0.11.3  xtable_1.7-3