-
Notifications
You must be signed in to change notification settings - Fork 206
Closed
Description
Dear all,
I'm using the current version of shiny and htmlwidgets, with R 3.1.3 and RStudio 0.99.386 under OSX. Do you see any reason why my x parameter is always undefined in my own widget. In the following example x$svg is the content of an SVG file. Thanks for your help!!
file cola.R
cola <- function(fileName, width = NULL, height = NULL) {
# forward options using x
x<- list()
x$svg <- paste(readLines(fileName), collapse="")
# create widget
htmlwidgets::createWidget(name = 'cola', x, width = width, height = height, package = 'cola')
}
file cola.js
HTMLWidgets.widget({
name: 'cola',
type: 'output',
initialize: function(el, width, height) {
//create a vis object with the library d3.js
return {
vis : vis
}
},
renderValue: function(el, x, instance) {
console.log(el); //OK!
console.log(x); //always undefined according to the javascript console
console.log(instance); //OK!
},
resize: function(el, width, height, instance) {
}
});
file server.R
output$test <- renderCola({
cola(system.file("htmlwidgets/examples/sucrose.svg", package = "cola"))
})
Metadata
Metadata
Assignees
Labels
No labels