I've recently updated my SunburstR package in R to the 2.0 Version and suddenly the sorting of the slices (by size, descending, clockwise) does not happen automatically as it used to. Any R & JS/d3.js expert around to help me implement a custom JS sortFunction or say how to solve the problem? For reproduction purposes:
library(jsonlite)
library(sunburstR)
b = read.csv(
file = paste0(
"https://gist.githubusercontent.com/rileycrane/",
"92a2c36eb932b4f99e51/raw/",
"a0212b4ca8043af47ec82369aa5f023530279aa3/visit-sequences.csv"
),header=FALSE
,stringsAsFactors = FALSE
)
sequence_json <- jsonlite::fromJSON(
system.file("examples/visit-sequences.json",package="sunburstR"),
simplifyDataFrame = FALSE
)
sunburst(sequence_json)
sunburst function provides a sortFunction parameeter where one can write custom JS, like in:
sunburst(df,
# create a trivial sort function
sortFunction = htmlwidgets::JS('function(x) {return x;}'))
Thanks!
How it used to look like (notice the order of slices):