Inspired by this StackOverflow question, it would be nice to have a little more flexibility when displaying the values below labels. Currently, showRatioDonut and showRatioPie can only be set to TRUE or FALSE to show or hide the values.
Proposed solution
The parameters showRatioDonut and showRatioPie could instead be assigned a character string value or a function.
"percentage" to display the ratio percentages (default behavior of TRUE),
"absolute" to display the absolute values,
"none" to hide values (default behavior of FALSE),
a function to have more flexibility in how to transform the values. I.e., say we pass showRatioDonut = function(a) scales::scientific(a), then the absolute values are first converted into scientific notation before being displayed below the labels.
To stay backward compatible, we'd only have to verify if showRatioDonut or showRatioPie is a logical value - if so, then it needs to be reassigned the appropriate string value ("percentage" for TRUE, "none" for FALSE).
Inspired by this StackOverflow question, it would be nice to have a little more flexibility when displaying the values below labels. Currently,
showRatioDonut
andshowRatioPie
can only be set toTRUE
orFALSE
to show or hide the values.Proposed solution
The parameters
showRatioDonut
andshowRatioPie
could instead be assigned a character string value or a function."percentage"
to display the ratio percentages (default behavior ofTRUE
),"absolute"
to display the absolute values,"none"
to hide values (default behavior ofFALSE
),showRatioDonut = function(a) scales::scientific(a)
, then the absolute values are first converted into scientific notation before being displayed below the labels.To stay backward compatible, we'd only have to verify if
showRatioDonut
orshowRatioPie
is a logical value - if so, then it needs to be reassigned the appropriate string value ("percentage"
forTRUE
,"none"
forFALSE
).