Make C3 chart interactive

I'm using the C3 package and trying to make a pie chart that replicates the one found on the website (

The examples for the C3 package and on the show something like the code below as working. Mine doesn't. Any ideas about what I need to do to replicate the behavior of the example? I want the tooltip to pop up onclick, along with the change in colors of the pie slices. This feels like I am missing something very simple.


data.frame(sugar = 20,
           fat = 45,
           salt = 10) %>% 
    c3(onclick = htmlwidgets::JS('function (d, i) { console.log("onclick", d, i)}')) %>%

1 Like

A %>% between c3() and c3_pie() ?

That was a typo. I've edited the original post. The %>% was not the problem. Thanks for catching that!

This is actually a recognised bug in the CRAN version 0.2 binary

apparently its fixed in later source, but one needs Rtools and to compile from source to get the benefit of this.


p.p.s this has led me down the rabbithole of getting the latest rlang from source:



Looks like that fixed it! Thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.