rcharts / gallery

A gallery for showcasing visualizations created using rCharts
http://rcharts.github.io/gallery
0 stars 2 forks source link

pie charts not working in new shiny versions? #6

Open HermanSontrop opened 10 years ago

HermanSontrop commented 10 years ago

Hi,

could it be the case that some of the bindings do not work anymore due to changes in recent Shiny versions? From your documentation I expected the following Shiny toy example to work:

require(rNVD3)

runApp(list( ui = pageWithSidebar( headerPanel("rNVD3: Interactive Charts from R using NVD3.js"),

sidebarPanel(
  selectInput(inputId = "gender",
              label = "Choose Gender",
              choices = c("Male", "Female"),
              selected = "Male"),
  selectInput(inputId = "type",
              label = "Choose Chart Type",
              choices = c("multiBarChart", "multiBarHorizontalChart"),
              selected = "multiBarChart"),
  checkboxInput(inputId = "stack",
                label = strong("Stack Bars?"),
                value = FALSE)
),
mainPanel(
  showOutput("myChart1"),
  showOutput("myChart2") 
)

), server = function(input, output) { output$myChart1 <- renderChart({ hair_eye = as.data.frame(HairEyeColor) p6 <- nvd3Plot(Freq ~ Hair | Eye, data = subset(hair_eye, Sex == input$gender), type = input$type, id = 'myChart', width = 800) p6$chart(color = c('brown', 'blue', '#594c26', 'green'), stacked = input$stack) return(p6) })

output$myChart2 <- renderChart({
  p3 <- nvd3Plot(~ cyl, data = mtcars, type = 'pieChart')
  return(p3)
})

} ))

session info

R version 3.1.1 (2014-07-10) Platform: x86_64-w64-mingw32/x64 (64-bit)

locale: [1] LC_COLLATE=Dutch_Netherlands.1252 LC_CTYPE=Dutch_Netherlands.1252 LC_MONETARY=Dutch_Netherlands.1252 [4] LC_NUMERIC=C LC_TIME=Dutch_Netherlands.1252

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

other attached packages: [1] rNVD3_0.0.1 rCharts_0.4.5 lubridate_1.3.3 digest_0.6.4 shinyExt_0.0.3.19
[6] shinysky_0.1.2 RJSONIO_1.2-0.2 shinyGridster_0.1 googleVis_0.5.3 ggplot2_1.0.0
[11] ReporteRs_0.5.8 ReporteRsjars_0.0.1 data.table_1.9.2 plyr_1.8.1 shinyBS_0.25
[16] shiny_0.10.1.9002

loaded via a namespace (and not attached): [1] base64_1.1 bitops_1.0-6 Cairo_1.5-6 caTools_1.17 colorspace_1.2-4 grid_3.1.1
[7] gtable_0.1.2 htmltools_0.2.6 httpuv_1.3.0 lattice_0.20-29 MASS_7.3-33 memoise_0.2.1
[13] munsell_0.4.2 proto_0.3-10 Rcpp_0.11.2 reshape2_1.4 rJava_0.9-6 rjson_0.2.14
[19] scales_0.2.4 stringr_0.6.2 tools_3.1.1 whisker_0.3-2 xtable_1.7-3 yaml_2.1.13

The bar plots appear in some browsers e.g. IE is ok, but in chrome 36.0.1985.143 this doesn't work. The pie chart works in no browser I tried (Chrome, Firefox or IE).

I'm aware of your rCharts package. However, I couldn't get it to work there either.

best Herman

ps: for arcane reasons I'm most interested in using a flexible pie chart in Shiny, as an alternative to the googleVis version.

ramnathv commented 10 years ago

You seem to be using the rNVD3 package and NOT rCharts. Development on rNVD3 was stopped long back.