How to change a pie-chart color based on the pie slice value in Apex 19.1

Опубликовано: 05 Май 2026
на канале: Ricky B
3,035
10

How to control pie chart color in Oracle Application Express (APEX)
The function is below:
Note: Replace '<' with the less than symbol since the less than symbol is not allowed in the description.

function (options){
options.dataFilter = function (data){
for(var i = 0; i < data.series.length; i++){
var testName = data.series[i].name;
if (testName.startsWith("Excellent")){
data.series[i].color = "green";
}else if (testName.startsWith("Good")){
data.series[i].color = "lightgreen";
}else if (testName.startsWith("Satisfactory")){
data.series[i].color = "orange";
}else {
data.series[i].color = "red";
}
}//end of for loop

return data;
};
return options;
}