Sunburst Chart
chartData <- list(
list(type = 't1', value = 2300, children = list(
list(type = 't1', value = 500),
list(type = 't2', value = 700, children = list(
list(type = 't2', value = 400, children = list(
list(type = 't3', value = 100),
list(type = 't4', value = 100)
)),
list(type = 't3', value = 100)
)),
list(type = 't3', value = 300)
)),
list(type = 't2', value = 2800, children = list(
list(type = 't1', value = 300),
list(type = 't2', value = 500, children = list(
list(type = 't2', value = 200),
list(type = 't3', value = 300)
)),
list(type = 't3', value = 1500, children = list(
list(type = 't1', value = 200),
list(type = 't2', value = 400),
list(type = 't3', value = 100),
list(type = 't4', value = 500, children = list(
list(type = 't1', value = 200, children = list(
list(type = 't4', value = 100)
)),
list(type = 't4', value = 100)
))
))
)),
list(type = 't3', value = 1000, children = list(
list(type = 't1', value = 200),
list(type = 't3', value = 100),
list(type = 't4', value = 700, children = list(
list(type = 't2', value = 100),
list(type = 't4', value = 400)
))
)),
list(type = 't4', value = 3900, children = list(
list(type = 't2', value = 1200, children = list(
list(type = 't1', value = 400),
list(type = 't2', value = 700)
)),
list(type = 't3', value = 1800, children = list(
list(type = 't1', value = 200),
list(type = 't2', value = 1200, children = list(
list(type = 't3', value = 900, children = list(
list(type = 't1', value = 200),
list(type = 't4', value = 600, children = list(
list(type = 't1', value = 400, children = list(
list(type = 't2', value = 200)
)),
list(type = 't2', value = 100)
))
)),
list(type = 't4', value = 300)
)),
list(type = 't3', value = 100),
list(type = 't4', value = 300)
)),
list(type = 't4', value = 700, children = list(
list(type = 't2', value = 100),
list(type = 't4', value = 400)
))
))
)
types <- list(
t1 = 'Treatment One',
t2 = 'Treatment Two',
t3 = 'Treatment Three',
t4 = 'Treatment Four'
)
nswidgets::create_sunburst(
data = chartData,
types = types
)