timelyportfolio / rcdimple

htmlwidgets for rCharts + dimple
http://www.buildingwidgets.com/blog/2015/3/18/week-11-dimple-as-htmlwidget
MIT License
28 stars 9 forks source link

Simple shiny example not working #10

Closed jpmarindiaz closed 9 years ago

jpmarindiaz commented 9 years ago

Hi @timelyportfolio

I am trying out rcdimple with shiny. I tried the following simple example but it is not working.

library(shiny)
library(rcdimple)

ui = shinyUI(fluidPage(  
  sidebarLayout(
    sidebarPanel(
      helpText("rcdimple shiny test ")
    ),
    mainPanel(
      dimpleOutput("dimple")
    )
  )
))

server = function(input, output) {
  output$dimple <- renderDimple({
    my_data <- data.frame(variable = c("A", "B", "C", "D"),value = c(0.2, 0.2, 0.2, 0.4))
    s <- dimple(my_data, x = "variable", y = "value", type = "bar"  )
    s <- add_title(s, html =
                     "<div style='text-align:center;width:100%'>
      <b style = 'font-size:130%;'>Fig 2.4 Three Dimensinal Pie Data:<br/>
        Two Dimensional Bar Chart
      </b>
    </div>"
    ) 
    s
  })
}

shinyApp(ui = ui, server = server)

I get this in the console

Uncaught TypeError: Cannot read property 'options' of undefined            dimple.js:17

Any ideas?

jpmarindiaz commented 9 years ago

I just updated shiny to version 0.11.1.9004 and it is working now. Cheers!

timelyportfolio commented 9 years ago

Good to hear. The change to jsonlite in both Shiny and htmlwidgets has widespread but positive effects. Glad it worked for you.