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,
showRatioDonutandshowRatioPiecan only be set toTRUEorFALSEto show or hide the values.Proposed solution
The parameters
showRatioDonutandshowRatioPiecould 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
showRatioDonutorshowRatioPieis a logical value - if so, then it needs to be reassigned the appropriate string value ("percentage"forTRUE,"none"forFALSE).