dmc
February 12, 2020, 9:25pm
1
I'm using the C3 package and trying to make a pie chart that replicates the one found on the c3js.org website (https://c3js.org/samples/chart_pie.html ).
The examples for the C3 package and on the c3js.org 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 c3js.org 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.
library(c3)
data.frame(sugar = 20,
fat = 45,
salt = 10) %>%
c3(onclick = htmlwidgets::JS('function (d, i) { console.log("onclick", d, i)}')) %>%
c3_pie()
1 Like
A %>% between c3() and c3_pie() ?
dmc
February 13, 2020, 12:04am
3
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
opened 07:44AM - 20 Apr 18 UTC
closed 04:50PM - 11 Jul 18 UTC
Tooltips and Mouse [hover and click events](http://c3js.org/reference.html#data-… onclick) aren't working on pie charts.
For example, the official pie chart example from docs doesn't show any console logs from mouse events:
http://c3js.org/samples/chart_pie.html
* **C3 version**: 0.5.3
* **D3 version**: 4.13.0
* **Browser**: Chrome 66.0.3359.81
* **OS**: Mac OS X
apparently its fixed in later source, but one needs Rtools and to compile from source to get the benefit of this.
devtools::install_github("mrjoh3/c3")
p.p.s this has led me down the rabbithole of getting the latest rlang from source:
remotes::install_github("r-lib/rlang")
2 Likes
dmc
February 13, 2020, 1:32am
5
Looks like that fixed it! Thanks!
system
Closed
February 20, 2020, 1:32am
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.