I want to add onclick event to c3.js chart in Shiny R. I`v read this article with c3 examples and try to do some simple app with print in console when clicked on chart. But in my case, onclick I have this error in console:
Could you, please, say what I do wrong?
##devtools::install_github("mrjoh3/c3")
library(c3)
library(shiny)
shinyApp(
ui = fluidPage(
c3Output("c3test")
),
server = function(input, output, session) {
output$c3test <- renderC3({
pie.chart <- data.frame(sugar=20,fat=45,salt=10) %>%
c3(onclick="function(d,element) {
console.log(d.id);
}") %>%
c3_donut()
})
}
)